diff options
author | EuAndreh <eu@euandre.org> | 2024-08-12 15:42:56 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2024-08-12 15:52:16 -0300 |
commit | 6bbc33b9e998af7ee45cca86e1290474603dff48 (patch) | |
tree | 5d0aff47783bc20dcf3f7862afdba0445e4c2fae /sqlite3_opt_unlock_notify.c | |
parent | Add Makefile and build skeleton (diff) | |
download | golite-6bbc33b9e998af7ee45cca86e1290474603dff48.tar.gz golite-6bbc33b9e998af7ee45cca86e1290474603dff48.tar.xz |
Build with "go tool" and hackishly bundle code from same package into one file each
Diffstat (limited to 'sqlite3_opt_unlock_notify.c')
-rw-r--r-- | sqlite3_opt_unlock_notify.c | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/sqlite3_opt_unlock_notify.c b/sqlite3_opt_unlock_notify.c deleted file mode 100644 index fc37b33..0000000 --- a/sqlite3_opt_unlock_notify.c +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (C) 2018 Yasuhiro Matsumoto <mattn.jp@gmail.com>. -// -// Use of this source code is governed by an MIT-style -// license that can be found in the LICENSE file. - -#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY -#include <stdio.h> -#include "sqlite3-binding.h" - -extern int unlock_notify_wait(sqlite3 *db); - -int -_sqlite3_step_blocking(sqlite3_stmt *stmt) -{ - int rv; - sqlite3* db; - - db = sqlite3_db_handle(stmt); - for (;;) { - rv = sqlite3_step(stmt); - if (rv != SQLITE_LOCKED) { - break; - } - if (sqlite3_extended_errcode(db) != SQLITE_LOCKED_SHAREDCACHE) { - break; - } - rv = unlock_notify_wait(db); - if (rv != SQLITE_OK) { - break; - } - sqlite3_reset(stmt); - } - - return rv; -} - -int -_sqlite3_step_row_blocking(sqlite3_stmt* stmt, long long* rowid, long long* changes) -{ - int rv; - sqlite3* db; - - db = sqlite3_db_handle(stmt); - for (;;) { - rv = sqlite3_step(stmt); - if (rv!=SQLITE_LOCKED) { - break; - } - if (sqlite3_extended_errcode(db) != SQLITE_LOCKED_SHAREDCACHE) { - break; - } - rv = unlock_notify_wait(db); - if (rv != SQLITE_OK) { - break; - } - sqlite3_reset(stmt); - } - - *rowid = (long long) sqlite3_last_insert_rowid(db); - *changes = (long long) sqlite3_changes(db); - return rv; -} - -int -_sqlite3_prepare_v2_blocking(sqlite3 *db, const char *zSql, int nBytes, sqlite3_stmt **ppStmt, const char **pzTail) -{ - int rv; - - for (;;) { - rv = sqlite3_prepare_v2(db, zSql, nBytes, ppStmt, pzTail); - if (rv!=SQLITE_LOCKED) { - break; - } - if (sqlite3_extended_errcode(db) != SQLITE_LOCKED_SHAREDCACHE) { - break; - } - rv = unlock_notify_wait(db); - if (rv != SQLITE_OK) { - break; - } - } - - return rv; -} -#endif |