Ejemplo n.º 1
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.DangerousGetWrapper(), 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;
            }
        }
Ejemplo n.º 2
0
        public static SafeSqliteBlobHandle sqlite3_blob_open(SafeSqliteHandle db, utf8z sdb, utf8z table, utf8z col, long rowid, int flags, out Result result)
        {
            using var _ = db.Lease();

            result = (Result)raw.sqlite3_blob_open(db.DangerousGetWrapper(), 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;
            }
        }
Ejemplo n.º 3
0
 public static Result sqlite3_busy_timeout(SafeSqliteHandle db, int ms)
 {
     using var _ = db.Lease();
     return((Result)raw.sqlite3_busy_timeout(db.DangerousGetWrapper(), ms));
 }
Ejemplo n.º 4
0
 public static int sqlite3_extended_errcode(SafeSqliteHandle db)
 {
     using var _ = db.Lease();
     return(raw.sqlite3_extended_errcode(db.DangerousGetWrapper()));
 }
Ejemplo n.º 5
0
 public static string sqlite3_errmsg(SafeSqliteHandle db)
 {
     using var _ = db.Lease();
     return(raw.sqlite3_errmsg(db.DangerousGetWrapper()).utf8_to_string());
 }
Ejemplo n.º 6
0
 public static long sqlite3_last_insert_rowid(SafeSqliteHandle db)
 {
     using var _ = db.Lease();
     return(raw.sqlite3_last_insert_rowid(db.DangerousGetWrapper()));
 }