summaryrefslogtreecommitdiff
path: root/vendor/github.com/ncruces/go-sqlite3/txn.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2024-08-15 00:30:58 +0000
committerLibravatar GitHub <noreply@github.com>2024-08-15 00:30:58 +0000
commit586639ccf0e2fefbd1da2c59d5abcb8d64d37434 (patch)
tree52a9d7412e98ef406c39f09a6fad6e3fa7a7ad49 /vendor/github.com/ncruces/go-sqlite3/txn.go
parentupdate go-ffmpreg to v0.2.5 (pulls in latest tetratelabs/wazero) (#3203) (diff)
downloadgotosocial-586639ccf0e2fefbd1da2c59d5abcb8d64d37434.tar.xz
update go-sqlite3 to v0.18.0 (#3204)
Diffstat (limited to 'vendor/github.com/ncruces/go-sqlite3/txn.go')
-rw-r--r--vendor/github.com/ncruces/go-sqlite3/txn.go23
1 files changed, 22 insertions, 1 deletions
diff --git a/vendor/github.com/ncruces/go-sqlite3/txn.go b/vendor/github.com/ncruces/go-sqlite3/txn.go
index 0efbc2d80..7121778d6 100644
--- a/vendor/github.com/ncruces/go-sqlite3/txn.go
+++ b/vendor/github.com/ncruces/go-sqlite3/txn.go
@@ -32,6 +32,19 @@ func (c *Conn) Begin() Txn {
return Txn{c}
}
+// BeginConcurrent starts a concurrent transaction.
+//
+// Experimental: requires a custom build of SQLite.
+//
+// https://sqlite.org/cgi/src/doc/begin-concurrent/doc/begin_concurrent.md
+func (c *Conn) BeginConcurrent() (Txn, error) {
+ err := c.Exec(`BEGIN CONCURRENT`)
+ if err != nil {
+ return Txn{}, err
+ }
+ return Txn{c}, nil
+}
+
// BeginImmediate starts an immediate transaction.
//
// https://sqlite.org/lang_transaction.html
@@ -217,7 +230,7 @@ func (c *Conn) txnExecInterrupted(sql string) error {
return err
}
-// TxnState starts a deferred transaction.
+// TxnState determines the transaction state of a database.
//
// https://sqlite.org/c3ref/txn_state.html
func (c *Conn) TxnState(schema string) TxnState {
@@ -292,3 +305,11 @@ func updateCallback(ctx context.Context, mod api.Module, pDB uint32, action Auth
c.update(action, schema, table, int64(rowid))
}
}
+
+// CacheFlush flushes caches to disk mid-transaction.
+//
+// https://sqlite.org/c3ref/db_cacheflush.html
+func (c *Conn) CacheFlush() error {
+ r := c.call("sqlite3_db_cacheflush", uint64(c.handle))
+ return c.error(r)
+}