Click or drag to resize
GDSqlite Class
This class is simply a wrapper around standard sqlite3 functions. Consult the sqlite3 documentation for details.
Inheritance Hierarchy
SystemObject
  GDGDSqlite

Namespace:  GD
Assembly:  GD (in GD.dll) Version: 255.255.255.255
Syntax
public sealed class GDSqlite

The GDSqlite type exposes the following members.

Constructors
  NameDescription
Public methodGDSqlite
Initializes a new instance of the GDSqlite class
Top
Methods
Remarks

This class allows to operate on raw SQL queries, but also can be used as backend in some common ORM engines e.g. sqlite-net. Its interface is coherent with common sqlite3 implementations for .NET platform.

For instructions how to integrate GDSqlite with sqlite-net engine refer to Examples section.

Examples

The following examples show how to integrate GDSqlite with sqlite-net.

There are 4 steps required to allow sqlite-net to use BlackBerry Dynamics sqlite implementation:

1. Download sqlite-net source code and add it to your project.

2. Add conditional compilation symbol USE_GD_SQLITE in your project settings (Project Properties, Build Tab). This will allow compiler to pick BlackBerry Dynamics provided sqlite3 implementation.

3. On the beginning of SQLite.cs file from sqlite-net add the following preprocessor directives (around line 22 - just below the copyright notice):

#if USE_GD_SQLITE
#define USE_WP8_NATIVE_SQLITE
#endif

4. In SQLite.cs find section which defines usings for different sqlite3 backends that starts with:

#if USE_CSHARP_SQLITE
using Sqlite3 = Community.CsharpSqlite.Sqlite3;
using Sqlite3DatabaseHandle = Community.CsharpSqlite.Sqlite3.sqlite3;
using Sqlite3Statement = Community.CsharpSqlite.Sqlite3.Vdbe;
#elif USE_WP8_NATIVE_SQLITE
....
and change it to:
#if USE_GD_SQLITE
using Sqlite3 = GD.GDSqlite;
using Sqlite3DatabaseHandle = GD.GDSqliteDatabase;
using Sqlite3Statement = GD.GDSqliteStatement;
#elif USE_CSHARP_SQLITE
using Sqlite3 = Community.CsharpSqlite.Sqlite3;
using Sqlite3DatabaseHandle = Community.CsharpSqlite.Sqlite3.sqlite3;
using Sqlite3Statement = Community.CsharpSqlite.Sqlite3.Vdbe;
#elif USE_WP8_NATIVE_SQLITE
....

Known issues: On 29.12.2014 there are some known issues with sqlite-net that causes compilation error for configuration given above. To fix them, follow tips below.

Find implementation of public SQLiteConnection(string databasePath, SQLiteOpenFlags openFlags, bool storeDateTimeAsTicks = false) method and replace following section:

...
#if NETFX_CORE
    SQLite3.SetDirectory(/*temp directory type*/2, Windows.Storage.ApplicationData.Current.TemporaryFolder.Path);
#endif

    Sqlite3DatabaseHandle handle;

#if SILVERLIGHT || USE_CSHARP_SQLITE || USE_SQLITEPCL_RAW
    var r = SQLite3.Open (databasePath, out handle, (int)openFlags, IntPtr.Zero);
#else
...
with:
...
#if NETFX_CORE && !USE_CSHARP_SQLITE && !USE_WP8_NATIVE_SQLITE && !USE_SQLITEPCL_RAW
    SQLite3.SetDirectory(/*temp directory type*/2, Windows.Storage.ApplicationData.Current.TemporaryFolder.Path);
#endif

    Sqlite3DatabaseHandle handle;

#if SILVERLIGHT || USE_CSHARP_SQLITE || USE_SQLITEPCL_RAW || USE_WP8_NATIVE_SQLITE
    var r = SQLite3.Open(databasePath, out handle, (int)openFlags, IntPtr.Zero);
#else
...

See Also

Reference