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) { SqliteConnectionHandle db; if ((flags & SQLiteOpenFlagsEnum.Create) == 0 && FileExists(strFilename) == false) { throw new SqliteException((int)SQLiteErrorCode.CantOpen, strFilename); } int n = UnsafeNativeMethods.sqlite3_open16(strFilename, out db); if (n > 0) { throw new SqliteException(n, null); } _sql = db; } _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) { if ((flags & SQLiteOpenFlagsEnum.Create) == 0 && FileExists(strFilename) == false) { throw new SqliteException((int)SQLiteErrorCode.CantOpen, strFilename); } SqliteConnectionHandle db; int n = UnsafeNativeMethods.sqlite3_open_v2(ToUTF8(strFilename), out db, (int)flags, string.Empty); 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); }
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); }
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_open16_interop(ToUTF8(strFilename), (int)flags, out db); #else if ((flags & SQLiteOpenFlagsEnum.Create) == 0 && System.IO.File.Exists(strFilename) == false) { throw new SqliteException((int)SQLiteErrorCode.CantOpen, strFilename); } int n = UnsafeNativeMethods.sqlite3_open16(strFilename, out db); #endif if (n > 0) { throw new SqliteException(n, null); } _sql = db; } _functionsArray = SqliteFunction.BindFunctions(this); }