[chore] update github.com/ncruces/go-sqlite3 -> v0.16.3 (#3029)
This commit is contained in:
parent
e543fbc80e
commit
15e0bf6e5a
2
go.mod
2
go.mod
|
@ -45,7 +45,7 @@ require (
|
||||||
github.com/miekg/dns v1.1.61
|
github.com/miekg/dns v1.1.61
|
||||||
github.com/minio/minio-go/v7 v7.0.71
|
github.com/minio/minio-go/v7 v7.0.71
|
||||||
github.com/mitchellh/mapstructure v1.5.0
|
github.com/mitchellh/mapstructure v1.5.0
|
||||||
github.com/ncruces/go-sqlite3 v0.16.2
|
github.com/ncruces/go-sqlite3 v0.16.3
|
||||||
github.com/oklog/ulid v1.3.1
|
github.com/oklog/ulid v1.3.1
|
||||||
github.com/prometheus/client_golang v1.19.1
|
github.com/prometheus/client_golang v1.19.1
|
||||||
github.com/spf13/cobra v1.8.1
|
github.com/spf13/cobra v1.8.1
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -441,8 +441,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
|
||||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||||
github.com/moul/http2curl v1.0.0 h1:dRMWoAtb+ePxMlLkrCbAqh4TlPHXvoGUSQ323/9Zahs=
|
github.com/moul/http2curl v1.0.0 h1:dRMWoAtb+ePxMlLkrCbAqh4TlPHXvoGUSQ323/9Zahs=
|
||||||
github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ=
|
github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ=
|
||||||
github.com/ncruces/go-sqlite3 v0.16.2 h1:HesVRr0BC6QSGSEQfEXOntFWS9wd4Z8ms4nJzfUv4Rg=
|
github.com/ncruces/go-sqlite3 v0.16.3 h1:Ky0denOdmAGOoCE6lQlw6GCJNMD8gTikNWe8rpu+Gjc=
|
||||||
github.com/ncruces/go-sqlite3 v0.16.2/go.mod h1:wkUIvOrAjFQnefVlivJfcowKUcfMHs4mvLfhVanzHHI=
|
github.com/ncruces/go-sqlite3 v0.16.3/go.mod h1:sAU/vQwBmZ2hq5BlW/KTzqRFizL43bv2JQoBLgXhcMI=
|
||||||
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
|
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
|
||||||
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
|
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
|
||||||
github.com/ncruces/julianday v1.0.0 h1:fH0OKwa7NWvniGQtxdJRxAgkBMolni2BjDHaWTxqt7M=
|
github.com/ncruces/julianday v1.0.0 h1:fH0OKwa7NWvniGQtxdJRxAgkBMolni2BjDHaWTxqt7M=
|
||||||
|
|
|
@ -33,6 +33,8 @@ Go, wazero and [`x/sys`](https://pkg.go.dev/golang.org/x/sys) are the _only_ run
|
||||||
provides the [`array`](https://sqlite.org/carray.html) table-valued function.
|
provides the [`array`](https://sqlite.org/carray.html) table-valued function.
|
||||||
- [`github.com/ncruces/go-sqlite3/ext/blobio`](https://pkg.go.dev/github.com/ncruces/go-sqlite3/ext/blobio)
|
- [`github.com/ncruces/go-sqlite3/ext/blobio`](https://pkg.go.dev/github.com/ncruces/go-sqlite3/ext/blobio)
|
||||||
simplifies [incremental BLOB I/O](https://sqlite.org/c3ref/blob_open.html).
|
simplifies [incremental BLOB I/O](https://sqlite.org/c3ref/blob_open.html).
|
||||||
|
- [`github.com/ncruces/go-sqlite3/ext/bloom`](https://pkg.go.dev/github.com/ncruces/go-sqlite3/ext/bloom)
|
||||||
|
provides a [Bloom filter](https://github.com/nalgeon/sqlean/issues/27#issuecomment-1002267134) virtual table.
|
||||||
- [`github.com/ncruces/go-sqlite3/ext/csv`](https://pkg.go.dev/github.com/ncruces/go-sqlite3/ext/csv)
|
- [`github.com/ncruces/go-sqlite3/ext/csv`](https://pkg.go.dev/github.com/ncruces/go-sqlite3/ext/csv)
|
||||||
reads [comma-separated values](https://sqlite.org/csv.html).
|
reads [comma-separated values](https://sqlite.org/csv.html).
|
||||||
- [`github.com/ncruces/go-sqlite3/ext/fileio`](https://pkg.go.dev/github.com/ncruces/go-sqlite3/ext/fileio)
|
- [`github.com/ncruces/go-sqlite3/ext/fileio`](https://pkg.go.dev/github.com/ncruces/go-sqlite3/ext/fileio)
|
||||||
|
@ -51,12 +53,12 @@ Go, wazero and [`x/sys`](https://pkg.go.dev/golang.org/x/sys) are the _only_ run
|
||||||
provides [Unicode aware](https://sqlite.org/src/dir/ext/icu) functions.
|
provides [Unicode aware](https://sqlite.org/src/dir/ext/icu) functions.
|
||||||
- [`github.com/ncruces/go-sqlite3/ext/zorder`](https://pkg.go.dev/github.com/ncruces/go-sqlite3/ext/zorder)
|
- [`github.com/ncruces/go-sqlite3/ext/zorder`](https://pkg.go.dev/github.com/ncruces/go-sqlite3/ext/zorder)
|
||||||
maps multidimensional data to one dimension.
|
maps multidimensional data to one dimension.
|
||||||
|
- [`github.com/ncruces/go-sqlite3/vfs/adiantum`](https://pkg.go.dev/github.com/ncruces/go-sqlite3/vfs/adiantum)
|
||||||
|
wraps a VFS to offer encryption at rest.
|
||||||
- [`github.com/ncruces/go-sqlite3/vfs/memdb`](https://pkg.go.dev/github.com/ncruces/go-sqlite3/vfs/memdb)
|
- [`github.com/ncruces/go-sqlite3/vfs/memdb`](https://pkg.go.dev/github.com/ncruces/go-sqlite3/vfs/memdb)
|
||||||
implements an in-memory VFS.
|
implements an in-memory VFS.
|
||||||
- [`github.com/ncruces/go-sqlite3/vfs/readervfs`](https://pkg.go.dev/github.com/ncruces/go-sqlite3/vfs/readervfs)
|
- [`github.com/ncruces/go-sqlite3/vfs/readervfs`](https://pkg.go.dev/github.com/ncruces/go-sqlite3/vfs/readervfs)
|
||||||
implements a VFS for immutable databases.
|
implements a VFS for immutable databases.
|
||||||
- [`github.com/ncruces/go-sqlite3/vfs/adiantum`](https://pkg.go.dev/github.com/ncruces/go-sqlite3/vfs/adiantum)
|
|
||||||
wraps a VFS to offer encryption at rest.
|
|
||||||
|
|
||||||
### Advanced features
|
### Advanced features
|
||||||
|
|
||||||
|
|
|
@ -229,6 +229,7 @@ func (c *conn) Raw() *sqlite3.Conn {
|
||||||
return c.Conn
|
return c.Conn
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deprecated: use BeginTx instead.
|
||||||
func (c *conn) Begin() (driver.Tx, error) {
|
func (c *conn) Begin() (driver.Tx, error) {
|
||||||
return c.BeginTx(context.Background(), driver.TxOptions{})
|
return c.BeginTx(context.Background(), driver.TxOptions{})
|
||||||
}
|
}
|
||||||
|
@ -301,7 +302,7 @@ func (c *conn) PrepareContext(ctx context.Context, query string) (driver.Stmt, e
|
||||||
s.Close()
|
s.Close()
|
||||||
return nil, util.TailErr
|
return nil, util.TailErr
|
||||||
}
|
}
|
||||||
return &stmt{Stmt: s, tmRead: c.tmRead, tmWrite: c.tmWrite}, nil
|
return &stmt{Stmt: s, tmRead: c.tmRead, tmWrite: c.tmWrite, inputs: -2}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *conn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) {
|
func (c *conn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) {
|
||||||
|
@ -335,6 +336,7 @@ type stmt struct {
|
||||||
*sqlite3.Stmt
|
*sqlite3.Stmt
|
||||||
tmWrite sqlite3.TimeFormat
|
tmWrite sqlite3.TimeFormat
|
||||||
tmRead sqlite3.TimeFormat
|
tmRead sqlite3.TimeFormat
|
||||||
|
inputs int
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -345,12 +347,17 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *stmt) NumInput() int {
|
func (s *stmt) NumInput() int {
|
||||||
|
if s.inputs >= -1 {
|
||||||
|
return s.inputs
|
||||||
|
}
|
||||||
n := s.Stmt.BindCount()
|
n := s.Stmt.BindCount()
|
||||||
for i := 1; i <= n; i++ {
|
for i := 1; i <= n; i++ {
|
||||||
if s.Stmt.BindName(i) != "" {
|
if s.Stmt.BindName(i) != "" {
|
||||||
|
s.inputs = -1
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
s.inputs = n
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,12 +396,7 @@ func (s *stmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driv
|
||||||
return &rows{ctx: ctx, stmt: s}, nil
|
return &rows{ctx: ctx, stmt: s}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *stmt) setupBindings(args []driver.NamedValue) error {
|
func (s *stmt) setupBindings(args []driver.NamedValue) (err error) {
|
||||||
err := s.Stmt.ClearBindings()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
var ids [3]int
|
var ids [3]int
|
||||||
for _, arg := range args {
|
for _, arg := range args {
|
||||||
ids := ids[:0]
|
ids := ids[:0]
|
||||||
|
@ -558,19 +560,20 @@ func (r *rows) Next(dest []driver.Value) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *rows) decodeTime(i int, v any) (_ time.Time, _ bool) {
|
func (r *rows) decodeTime(i int, v any) (_ time.Time, ok bool) {
|
||||||
if r.tmRead == sqlite3.TimeFormatDefault {
|
if r.tmRead == sqlite3.TimeFormatDefault {
|
||||||
return
|
// handled by maybeTime
|
||||||
}
|
|
||||||
switch r.declType(i) {
|
|
||||||
case "DATE", "TIME", "DATETIME", "TIMESTAMP":
|
|
||||||
// maybe
|
|
||||||
default:
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
switch v.(type) {
|
switch v.(type) {
|
||||||
case int64, float64, string:
|
case int64, float64, string:
|
||||||
// maybe
|
// could be a time value
|
||||||
|
default:
|
||||||
|
return
|
||||||
|
}
|
||||||
|
switch r.declType(i) {
|
||||||
|
case "DATE", "TIME", "DATETIME", "TIMESTAMP":
|
||||||
|
// could be a time value
|
||||||
default:
|
default:
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,4 +24,7 @@ See the [configuration options](../sqlite3/sqlite_cfg.h),
|
||||||
and [patches](../sqlite3) applied.
|
and [patches](../sqlite3) applied.
|
||||||
|
|
||||||
Built using [`wasi-sdk`](https://github.com/WebAssembly/wasi-sdk),
|
Built using [`wasi-sdk`](https://github.com/WebAssembly/wasi-sdk),
|
||||||
and [`binaryen`](https://github.com/WebAssembly/binaryen).
|
and [`binaryen`](https://github.com/WebAssembly/binaryen).
|
||||||
|
|
||||||
|
The build is easily reproducible, and verifiable, using
|
||||||
|
[Artifact Attestations](https://github.com/ncruces/go-sqlite3/attestations).
|
Binary file not shown.
|
@ -51,6 +51,7 @@ const (
|
||||||
_IOERR_BEGIN_ATOMIC _ErrorCode = util.IOERR_BEGIN_ATOMIC
|
_IOERR_BEGIN_ATOMIC _ErrorCode = util.IOERR_BEGIN_ATOMIC
|
||||||
_IOERR_COMMIT_ATOMIC _ErrorCode = util.IOERR_COMMIT_ATOMIC
|
_IOERR_COMMIT_ATOMIC _ErrorCode = util.IOERR_COMMIT_ATOMIC
|
||||||
_IOERR_ROLLBACK_ATOMIC _ErrorCode = util.IOERR_ROLLBACK_ATOMIC
|
_IOERR_ROLLBACK_ATOMIC _ErrorCode = util.IOERR_ROLLBACK_ATOMIC
|
||||||
|
_BUSY_SNAPSHOT _ErrorCode = util.BUSY_SNAPSHOT
|
||||||
_CANTOPEN_FULLPATH _ErrorCode = util.CANTOPEN_FULLPATH
|
_CANTOPEN_FULLPATH _ErrorCode = util.CANTOPEN_FULLPATH
|
||||||
_CANTOPEN_ISDIR _ErrorCode = util.CANTOPEN_ISDIR
|
_CANTOPEN_ISDIR _ErrorCode = util.CANTOPEN_ISDIR
|
||||||
_READONLY_CANTINIT _ErrorCode = util.READONLY_CANTINIT
|
_READONLY_CANTINIT _ErrorCode = util.READONLY_CANTINIT
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Go `"memdb"` SQLite VFS
|
# Go `memdb` SQLite VFS
|
||||||
|
|
||||||
This package implements the [`"memdb"`](https://sqlite.org/src/doc/tip/src/memdb.c)
|
This package implements the [`"memdb"`](https://sqlite.org/src/doc/tip/src/memdb.c)
|
||||||
SQLite VFS in pure Go.
|
SQLite VFS in pure Go.
|
||||||
|
|
|
@ -29,5 +29,12 @@ func osReadLock(file *os.File, _ /*start*/, _ /*len*/ int64, _ /*timeout*/ time.
|
||||||
}
|
}
|
||||||
|
|
||||||
func osWriteLock(file *os.File, _ /*start*/, _ /*len*/ int64, _ /*timeout*/ time.Duration) _ErrorCode {
|
func osWriteLock(file *os.File, _ /*start*/, _ /*len*/ int64, _ /*timeout*/ time.Duration) _ErrorCode {
|
||||||
return osLock(file, unix.LOCK_EX|unix.LOCK_NB, _IOERR_LOCK)
|
rc := osLock(file, unix.LOCK_EX|unix.LOCK_NB, _IOERR_LOCK)
|
||||||
|
if rc == _BUSY {
|
||||||
|
// The documentation states the lock is upgraded by releasing the previous lock,
|
||||||
|
// then acquiring the new lock.
|
||||||
|
// This is a race, so return BUSY_SNAPSHOT to ensure the transaction is aborted.
|
||||||
|
return _BUSY_SNAPSHOT
|
||||||
|
}
|
||||||
|
return rc
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ func osDowngradeLock(file *os.File, state LockLevel) _ErrorCode {
|
||||||
// In theory, the downgrade to a SHARED cannot fail because another
|
// In theory, the downgrade to a SHARED cannot fail because another
|
||||||
// process is holding an incompatible lock. If it does, this
|
// process is holding an incompatible lock. If it does, this
|
||||||
// indicates that the other process is not following the locking
|
// indicates that the other process is not following the locking
|
||||||
// protocol. If this happens, return _IOERR_RDLOCK. Returning
|
// protocol. If this happens, return IOERR_RDLOCK. Returning
|
||||||
// BUSY would confuse the upper layer.
|
// BUSY would confuse the upper layer.
|
||||||
return _IOERR_RDLOCK
|
return _IOERR_RDLOCK
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,10 +128,11 @@ func (s *vfsShm) shmOpen() (rc _ErrorCode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lock and truncate the file, if not readonly.
|
// Lock and truncate the file, if not readonly.
|
||||||
|
// The lock is only released by closing the file.
|
||||||
if s.readOnly {
|
if s.readOnly {
|
||||||
rc = _READONLY_CANTINIT
|
rc = _READONLY_CANTINIT
|
||||||
} else {
|
} else {
|
||||||
if rc := osWriteLock(f, 0, 0, 0); rc != _OK {
|
if rc := osLock(f, unix.LOCK_EX|unix.LOCK_NB, _IOERR_LOCK); rc != _OK {
|
||||||
return rc
|
return rc
|
||||||
}
|
}
|
||||||
if err := f.Truncate(0); err != nil {
|
if err := f.Truncate(0); err != nil {
|
||||||
|
|
|
@ -16,14 +16,15 @@ func CreateModule[T VTab](db *Conn, name string, create, connect VTabConstructor
|
||||||
var flags int
|
var flags int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
VTAB_CREATOR = 0x01
|
VTAB_CREATOR = 0x001
|
||||||
VTAB_DESTROYER = 0x02
|
VTAB_DESTROYER = 0x002
|
||||||
VTAB_UPDATER = 0x04
|
VTAB_UPDATER = 0x004
|
||||||
VTAB_RENAMER = 0x08
|
VTAB_RENAMER = 0x008
|
||||||
VTAB_OVERLOADER = 0x10
|
VTAB_OVERLOADER = 0x010
|
||||||
VTAB_CHECKER = 0x20
|
VTAB_CHECKER = 0x020
|
||||||
VTAB_TXN = 0x40
|
VTAB_TXN = 0x040
|
||||||
VTAB_SAVEPOINTER = 0x80
|
VTAB_SAVEPOINTER = 0x080
|
||||||
|
VTAB_SHADOWTABS = 0x100
|
||||||
)
|
)
|
||||||
|
|
||||||
if create != nil {
|
if create != nil {
|
||||||
|
@ -52,6 +53,9 @@ func CreateModule[T VTab](db *Conn, name string, create, connect VTabConstructor
|
||||||
if implements[VTabSavepointer](vtab) {
|
if implements[VTabSavepointer](vtab) {
|
||||||
flags |= VTAB_SAVEPOINTER
|
flags |= VTAB_SAVEPOINTER
|
||||||
}
|
}
|
||||||
|
if implements[VTabShadowTabler](vtab) {
|
||||||
|
flags |= VTAB_SHADOWTABS
|
||||||
|
}
|
||||||
|
|
||||||
defer db.arena.mark()()
|
defer db.arena.mark()()
|
||||||
namePtr := db.arena.string(name)
|
namePtr := db.arena.string(name)
|
||||||
|
@ -174,6 +178,17 @@ type VTabOverloader interface {
|
||||||
FindFunction(arg int, name string) (ScalarFunction, IndexConstraintOp)
|
FindFunction(arg int, name string) (ScalarFunction, IndexConstraintOp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A VTabShadowTabler allows a virtual table to protect the content
|
||||||
|
// of shadow tables from being corrupted by hostile SQL.
|
||||||
|
//
|
||||||
|
// Implementing this interface signals that a virtual table named
|
||||||
|
// "mumble" reserves all table names starting with "mumble_".
|
||||||
|
type VTabShadowTabler interface {
|
||||||
|
VTab
|
||||||
|
// https://sqlite.org/vtab.html#the_xshadowname_method
|
||||||
|
ShadowTables()
|
||||||
|
}
|
||||||
|
|
||||||
// A VTabChecker allows a virtual table to report errors
|
// A VTabChecker allows a virtual table to report errors
|
||||||
// to the PRAGMA integrity_check and PRAGMA quick_check commands.
|
// to the PRAGMA integrity_check and PRAGMA quick_check commands.
|
||||||
//
|
//
|
||||||
|
|
|
@ -516,7 +516,7 @@ github.com/modern-go/concurrent
|
||||||
# github.com/modern-go/reflect2 v1.0.2
|
# github.com/modern-go/reflect2 v1.0.2
|
||||||
## explicit; go 1.12
|
## explicit; go 1.12
|
||||||
github.com/modern-go/reflect2
|
github.com/modern-go/reflect2
|
||||||
# github.com/ncruces/go-sqlite3 v0.16.2
|
# github.com/ncruces/go-sqlite3 v0.16.3
|
||||||
## explicit; go 1.21
|
## explicit; go 1.21
|
||||||
github.com/ncruces/go-sqlite3
|
github.com/ncruces/go-sqlite3
|
||||||
github.com/ncruces/go-sqlite3/driver
|
github.com/ncruces/go-sqlite3/driver
|
||||||
|
|
Loading…
Reference in New Issue