sqlite3_open16() private method

private sqlite3_open16 ( string utf16Filename, IntPtr &db ) : int
utf16Filename string
db IntPtr
return int
Ejemplo n.º 1
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)
            {
                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);
        }
Ejemplo n.º 2
0
        internal override void Open(string strFilename)
        {
            if (_sql != IntPtr.Zero)
            {
                return;
            }
            int n = UnsafeNativeMethods.sqlite3_open16(strFilename, out _sql);

            if (n > 0)
            {
                throw new SqliteException(n, SqliteLastError());
            }

            _functionsArray = SqliteFunction.BindFunctions(this);
        }
Ejemplo n.º 3
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);
        }