예제 #1
0
        public Result Open(byte[] filename, out IDbHandle db, int flags, IntPtr zvfs)
        {
            IntPtr dbPtr;
            Result r = SQLiteApiWin32Internal.sqlite3_open_v2(filename, out dbPtr, flags, zvfs);

            db = new DbHandle(dbPtr);
            return(r);
        }
예제 #2
0
        public IDbStatement Prepare2(IDbHandle db, string query)
        {
            var    internalDbHandle = (DbHandle)db;
            IntPtr stmt;
            Result r = SQLiteApiWin32Internal.sqlite3_prepare16_v2(internalDbHandle.DbPtr, query, -1, out stmt, IntPtr.Zero);

            if (r != Result.OK)
            {
                throw SQLiteException.New(r, Errmsg16(internalDbHandle));
            }
            return(new DbStatement(stmt));
        }
예제 #3
0
        public int CreateCollation(IDbHandle db, ICollation collation)
        {
            var internalDbHandle = (DbHandle)db;

            var compareCallbackExecutor = new CompareCallbackExecutor(
                collation,
                SQLiteApiWin32Internal.GetCompareCallbackStringBytes);

            var func = new SQLiteApiWin32Internal.CompareCallback(compareCallbackExecutor.Execute);

            _allocatedGCHandles.Add(GCHandle.Alloc(func));

            return(SQLiteApiWin32Internal.sqlite3_create_collation(
                       internalDbHandle.DbPtr,
                       Encoding.UTF8.GetBytes(collation.Name),
                       SQLiteEncodings.SQLITE_UTF8,
                       IntPtr.Zero,
                       func));
        }
예제 #4
0
        public IDbBackupHandle BackupInit(IDbHandle destHandle, string destName, IDbHandle srcHandle, string srcName)
        {
            var internalDestDb = (DbHandle)destHandle;
            var internalSrcDb  = (DbHandle)srcHandle;

            IntPtr p = SQLiteApiWin32Internal.sqlite3_backup_init(internalDestDb.DbPtr,
                                                                  destName,
                                                                  internalSrcDb.DbPtr,
                                                                  srcName);

            if (p == IntPtr.Zero)
            {
                return(null);
            }
            else
            {
                return(new DbBackupHandle(p));
            }
        }
예제 #5
0
        public int CreateScalarFunction(IDbHandle db, IScalarFunction sqliteFunction)
        {
            var internalDbHandle = (DbHandle)db;

            var funcCallbackExecutor = new FuncCallbackExecutor(
                sqliteFunction,
                SQLiteApiWin32Internal.GetAnsiString,
                SQLiteApiWin32Internal.sqlite3_result_int
                );

            var func = new SQLiteApiWin32Internal.FuncCallback(funcCallbackExecutor.Execute);

            _allocatedGCHandles.Add(GCHandle.Alloc(func));

            return(SQLiteApiWin32Internal.sqlite3_create_function(
                       internalDbHandle.DbPtr,
                       Encoding.UTF8.GetBytes(sqliteFunction.Name),
                       sqliteFunction.ValueGetters.Length,
                       SQLiteEncodings.SQLITE_UTF8,
                       IntPtr.Zero,
                       func,
                       null,
                       null));
        }
예제 #6
0
 public int Sleep(int millis)
 {
     return(SQLiteApiWin32Internal.sqlite3_sleep(millis));
 }
예제 #7
0
 public int LibVersionNumber()
 {
     return(SQLiteApiWin32Internal.sqlite3_libversion_number());
 }
예제 #8
0
        public int BackupRemaining(IDbBackupHandle handle)
        {
            var internalBackup = (DbBackupHandle)handle;

            return(SQLiteApiWin32Internal.sqlite3_backup_remaining(internalBackup.DbBackupPtr));
        }
예제 #9
0
        public int BackupPagecount(IDbBackupHandle handle)
        {
            var internalBackup = (DbBackupHandle)handle;

            return(SQLiteApiWin32Internal.sqlite3_backup_pagecount(internalBackup.DbBackupPtr));
        }
예제 #10
0
 public Result Shutdown()
 {
     return(SQLiteApiWin32Internal.sqlite3_shutdown());
 }
예제 #11
0
        public string ColumnName16(IDbStatement stmt, int index)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiWin32Internal.ColumnName16(internalStmt.StmtPtr, index));
        }
예제 #12
0
        public ExtendedResult ExtendedErrCode(IDbHandle db)
        {
            var internalDbHandle = (DbHandle)db;

            return(SQLiteApiWin32Internal.sqlite3_extended_errcode(internalDbHandle.DbPtr));
        }
예제 #13
0
        public Result Close(IDbHandle db)
        {
            var internalDbHandle = (DbHandle)db;

            return(SQLiteApiWin32Internal.sqlite3_close(internalDbHandle.DbPtr));
        }
예제 #14
0
        public int ColumnBytes(IDbStatement stmt, int index)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiWin32Internal.sqlite3_column_bytes(internalStmt.StmtPtr, index));
        }
예제 #15
0
        public byte[] ColumnByteArray(IDbStatement stmt, int index)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiWin32Internal.ColumnByteArray(internalStmt.StmtPtr, index));
        }
예제 #16
0
        public string ColumnText16(IDbStatement stmt, int index)
        {
            var internalStmt = (DbStatement)stmt;

            return(Marshal.PtrToStringUni(SQLiteApiWin32Internal.sqlite3_column_text16(internalStmt.StmtPtr, index)));
        }
예제 #17
0
        public double ColumnDouble(IDbStatement stmt, int index)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiWin32Internal.sqlite3_column_double(internalStmt.StmtPtr, index));
        }
예제 #18
0
        public long ColumnInt64(IDbStatement stmt, int index)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiWin32Internal.sqlite3_column_int64(internalStmt.StmtPtr, index));
        }
예제 #19
0
 public string SourceID()
 {
     return(Marshal.PtrToStringAnsi(SQLiteApiWin32Internal.sqlite3_sourceid()));
 }
예제 #20
0
        public Result BusyTimeout(IDbHandle db, int milliseconds)
        {
            var internalDbHandle = (DbHandle)db;

            return(SQLiteApiWin32Internal.sqlite3_busy_timeout(internalDbHandle.DbPtr, milliseconds));
        }
예제 #21
0
        public Result EnableLoadExtension(IDbHandle db, int onoff)
        {
            var internalDbHandle = (DbHandle)db;

            return(SQLiteApiWin32Internal.sqlite3_enable_load_extension(internalDbHandle.DbPtr, onoff));
        }
예제 #22
0
        public int BindBlob(IDbStatement stmt, int index, byte[] val, int n, IntPtr free)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiWin32Internal.sqlite3_bind_blob(internalStmt.StmtPtr, index, val, n, free));
        }
예제 #23
0
 public Result Initialize()
 {
     return(SQLiteApiWin32Internal.sqlite3_initialize());
 }
예제 #24
0
        public int BindText16(IDbStatement stmt, int index, string val, int n, IntPtr free)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiWin32Internal.sqlite3_bind_text16(internalStmt.StmtPtr, index, val, n, free));
        }
예제 #25
0
 public Result Config(ConfigOption option)
 {
     return(SQLiteApiWin32Internal.sqlite3_config(option));
 }
예제 #26
0
        public int ColumnCount(IDbStatement stmt)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiWin32Internal.sqlite3_column_count(internalStmt.StmtPtr));
        }
예제 #27
0
        public int Changes(IDbHandle db)
        {
            var internalDbHandle = (DbHandle)db;

            return(SQLiteApiWin32Internal.sqlite3_changes(internalDbHandle.DbPtr));
        }
예제 #28
0
        public Result BackupStep(IDbBackupHandle handle, int pageCount)
        {
            var internalBackup = (DbBackupHandle)handle;

            return(SQLiteApiWin32Internal.sqlite3_backup_step(internalBackup.DbBackupPtr, pageCount));
        }
예제 #29
0
        public Result Step(IDbStatement stmt)
        {
            var internalStmt = (DbStatement)stmt;

            return(SQLiteApiWin32Internal.sqlite3_step(internalStmt.StmtPtr));
        }
예제 #30
0
        public Result BackupFinish(IDbBackupHandle handle)
        {
            var internalBackup = (DbBackupHandle)handle;

            return(SQLiteApiWin32Internal.sqlite3_backup_finish(internalBackup.DbBackupPtr));
        }