Пример #1
0
        public static SafeSqliteBlobHandle sqlite3_blob_open(SafeSqliteHandle db, string sdb, string table, string col, long rowid, int flags, out Result result)
        {
            using var _ = db.Lease();

            result = (Result)raw.sqlite3_blob_open(db.DangerousGetHandle(), sdb, table, col, rowid, flags, out var wrapper);
            if (result != (int)Result.OK)
            {
                wrapper = null;
            }

            try
            {
                // Always return a non-null handle to match default P/Invoke marshaling behavior. SafeHandle.IsInvalid
                // will be true when the handle is not usable, but the handle instance can be disposed either way.
                return(new SafeSqliteBlobHandle(db, wrapper));
            }
            catch
            {
                raw.sqlite3_blob_close(wrapper);
                throw;
            }
        }
Пример #2
0
        public static SafeSqliteStatementHandle sqlite3_prepare_v2(SafeSqliteHandle db, string sql, out Result result)
        {
            using var _ = db.Lease();

            result = (Result)raw.sqlite3_prepare_v2(db.DangerousGetHandle(), sql, out var wrapper);
            if (result != (int)Result.OK)
            {
                wrapper = null;
            }

            try
            {
                // Always return a non-null handle to match default P/Invoke marshaling behavior. SafeHandle.IsInvalid
                // will be true when the handle is not usable, but the handle instance can be disposed either way.
                return(new SafeSqliteStatementHandle(db, wrapper));
            }
            catch
            {
                raw.sqlite3_finalize(wrapper);
                throw;
            }
        }
Пример #3
0
 public static Result sqlite3_busy_timeout(SafeSqliteHandle db, int ms)
 {
     using var _ = db.Lease();
     return((Result)raw.sqlite3_busy_timeout(db.DangerousGetHandle(), ms));
 }
Пример #4
0
 public static int sqlite3_extended_errcode(SafeSqliteHandle db)
 {
     using var _ = db.Lease();
     return(raw.sqlite3_extended_errcode(db.DangerousGetHandle()));
 }
Пример #5
0
 public static string sqlite3_errmsg(SafeSqliteHandle db)
 {
     using var _ = db.Lease();
     return(raw.sqlite3_errmsg(db.DangerousGetHandle()));
 }
Пример #6
0
 public static long sqlite3_last_insert_rowid(SafeSqliteHandle db)
 {
     using var _ = db.Lease();
     return(raw.sqlite3_last_insert_rowid(db.DangerousGetHandle()));
 }