diff options
Diffstat (limited to 'vendor/github.com/ncruces/go-sqlite3/txn.go')
-rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/txn.go | 23 |
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) +} |