Example #1
0
    public void OpenInMemory()
    {
                #if !SQLITE_NATIVE
        if (db != null)
                #else
        if (db != IntPtr.Zero)
                #endif
        {
            throw new Exception("Error database already open!");
        }

        if (Sqlite3.sqlite3_open(":memory:", out db) != Sqlite3.SQLITE_OK)
        {
                        #if !SQLITE_NATIVE
            db = null;
                        #else
            db = IntPtr.Zero;
                        #endif
            throw new IOException("Error with opening database :memory:!");
        }
    }
Example #2
0
    public void Open(string filename)
    {
                #if !SQLITE_NATIVE
        if (db != null)
                #else
        if (db != IntPtr.Zero)
                #endif
        {
            throw new Exception("Error database already open!");
        }

        if (Sqlite3.sqlite3_open(filename, out db) != Sqlite3.SQLITE_OK)
        {
                        #if !SQLITE_NATIVE
            db = null;
                        #else
            db = IntPtr.Zero;
                        #endif
            throw new IOException("Error with opening database " + filename + " !");
        }
    }