private sqlite3_open ( byte utf8Filename, IntPtr &db ) : int | ||
utf8Filename | byte | |
db | IntPtr | |
return | int |
internal override void Open(string strFilename) { if (_sql != IntPtr.Zero) { return; } int n = UnsafeNativeMethods.sqlite3_open(ToUTF8(strFilename), out _sql); if (n > 0) { throw new SqliteException(n, SqliteLastError()); } _functionsArray = SqliteFunction.BindFunctions(this); }
internal override void Open(string strFilename, SQLiteOpenFlagsEnum flags, int maxPoolSize, bool usePool) { if (_sql != null) { return; } _usePool = usePool; if (usePool) { _fileName = strFilename; _sql = SqliteConnectionPool.Remove(strFilename, maxPoolSize, out _poolVersion); } if (_sql == null) { IntPtr db; #if !SQLITE_STANDARD int n = UnsafeNativeMethods.sqlite3_open_interop(ToUTF8(strFilename), (int)flags, out db); #else // Compatibility with versions < 3.5.0 int n; if (UnsafeNativeMethods.use_sqlite3_open_v2) { n = UnsafeNativeMethods.sqlite3_open_v2(ToUTF8(strFilename), out db, (int)flags, IntPtr.Zero); } else { Console.WriteLine("Your sqlite3 version is old - please upgrade to at least v3.5.0!"); n = UnsafeNativeMethods.sqlite3_open(ToUTF8(strFilename), out db); } #endif if (n > 0) { throw new SqliteException(n, null); } _sql = db; } // Bind functions to this connection. If any previous functions of the same name // were already bound, then the new bindings replace the old. _functionsArray = SqliteFunction.BindFunctions(this); SetTimeout(0); }