diff options
Diffstat (limited to 'vendor/github.com/ncruces/go-sqlite3')
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/driver/driver.go | 16 | ||||
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/embed/init.go | 4 | ||||
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/embed/sqlite3.wasm | bin | 1411584 -> 1406614 bytes | |||
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/internal/util/mmap_windows.go | 17 | ||||
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/sqlite.go | 6 | ||||
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/util/sql3util/wasm/sql3parse_table.wasm | bin | 16432 -> 16455 bytes | |||
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/vfs/shm_windows.go | 2 | ||||
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/vfs/vfs.go | 2 |
8 files changed, 38 insertions, 9 deletions
diff --git a/vendor/github.com/ncruces/go-sqlite3/driver/driver.go b/vendor/github.com/ncruces/go-sqlite3/driver/driver.go index 5d2847369..c3cdf7c92 100644 --- a/vendor/github.com/ncruces/go-sqlite3/driver/driver.go +++ b/vendor/github.com/ncruces/go-sqlite3/driver/driver.go @@ -442,6 +442,22 @@ func (c *conn) CheckNamedValue(arg *driver.NamedValue) error { return nil } +// Deprecated: for Litestream use only; may be removed at any time. +func (c *conn) FileControlPersistWAL(schema string, mode int) (int, error) { + // notest + arg := make([]any, 1) + if mode >= 0 { + arg[0] = mode > 0 + } else { + arg = arg[:0] + } + res, err := c.Conn.FileControl(schema, sqlite3.FCNTL_PERSIST_WAL, arg...) + if res == true { + return 1, err + } + return 0, err +} + type stmt struct { *sqlite3.Stmt tmWrite sqlite3.TimeFormat diff --git a/vendor/github.com/ncruces/go-sqlite3/embed/init.go b/vendor/github.com/ncruces/go-sqlite3/embed/init.go index 5ffd69516..275cdefdf 100644 --- a/vendor/github.com/ncruces/go-sqlite3/embed/init.go +++ b/vendor/github.com/ncruces/go-sqlite3/embed/init.go @@ -17,5 +17,7 @@ import ( var binary string func init() { - sqlite3.Binary = unsafe.Slice(unsafe.StringData(binary), len(binary)) + if sqlite3.Binary == nil { + sqlite3.Binary = unsafe.Slice(unsafe.StringData(binary), len(binary)) + } } diff --git a/vendor/github.com/ncruces/go-sqlite3/embed/sqlite3.wasm b/vendor/github.com/ncruces/go-sqlite3/embed/sqlite3.wasm Binary files differindex 8d094140b..936c9a8f7 100644 --- a/vendor/github.com/ncruces/go-sqlite3/embed/sqlite3.wasm +++ b/vendor/github.com/ncruces/go-sqlite3/embed/sqlite3.wasm diff --git a/vendor/github.com/ncruces/go-sqlite3/internal/util/mmap_windows.go b/vendor/github.com/ncruces/go-sqlite3/internal/util/mmap_windows.go index 913a5f733..f1fee0b50 100644 --- a/vendor/github.com/ncruces/go-sqlite3/internal/util/mmap_windows.go +++ b/vendor/github.com/ncruces/go-sqlite3/internal/util/mmap_windows.go @@ -1,12 +1,10 @@ package util import ( - "context" "os" "reflect" "unsafe" - "github.com/tetratelabs/wazero/api" "golang.org/x/sys/windows" ) @@ -16,14 +14,21 @@ type MappedRegion struct { addr uintptr } -func MapRegion(ctx context.Context, mod api.Module, f *os.File, offset int64, size int32) (*MappedRegion, error) { - h, err := windows.CreateFileMapping(windows.Handle(f.Fd()), nil, windows.PAGE_READWRITE, 0, 0, nil) +func MapRegion(f *os.File, offset int64, size int32) (*MappedRegion, error) { + maxSize := offset + int64(size) + h, err := windows.CreateFileMapping( + windows.Handle(f.Fd()), nil, windows.PAGE_READWRITE, + uint32(maxSize>>32), uint32(maxSize), nil) if h == 0 { return nil, err } + const allocationGranularity = 64 * 1024 + align := offset % allocationGranularity + offset -= align + a, err := windows.MapViewOfFile(h, windows.FILE_MAP_WRITE, - uint32(offset>>32), uint32(offset), uintptr(size)) + uint32(offset>>32), uint32(offset), uintptr(size)+uintptr(align)) if a == 0 { windows.CloseHandle(h) return nil, err @@ -32,9 +37,9 @@ func MapRegion(ctx context.Context, mod api.Module, f *os.File, offset int64, si ret := &MappedRegion{Handle: h, addr: a} // SliceHeader, although deprecated, avoids a go vet warning. sh := (*reflect.SliceHeader)(unsafe.Pointer(&ret.Data)) + sh.Data = a + uintptr(align) sh.Len = int(size) sh.Cap = int(size) - sh.Data = a return ret, nil } diff --git a/vendor/github.com/ncruces/go-sqlite3/sqlite.go b/vendor/github.com/ncruces/go-sqlite3/sqlite.go index 52532e077..532f05183 100644 --- a/vendor/github.com/ncruces/go-sqlite3/sqlite.go +++ b/vendor/github.com/ncruces/go-sqlite3/sqlite.go @@ -5,12 +5,14 @@ import ( "context" "math/bits" "os" + "runtime" "strings" "sync" "unsafe" "github.com/tetratelabs/wazero" "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/experimental" "github.com/ncruces/go-sqlite3/internal/util" "github.com/ncruces/go-sqlite3/vfs" @@ -79,7 +81,9 @@ func compileSQLite() { return } - instance.compiled, instance.err = instance.runtime.CompileModule(ctx, bin) + instance.compiled, instance.err = instance.runtime.CompileModule( + experimental.WithCompilationWorkers(ctx, runtime.GOMAXPROCS(0)/4), + bin) } type sqlite struct { diff --git a/vendor/github.com/ncruces/go-sqlite3/util/sql3util/wasm/sql3parse_table.wasm b/vendor/github.com/ncruces/go-sqlite3/util/sql3util/wasm/sql3parse_table.wasm Binary files differindex 198f1007f..0d7c8810c 100644 --- a/vendor/github.com/ncruces/go-sqlite3/util/sql3util/wasm/sql3parse_table.wasm +++ b/vendor/github.com/ncruces/go-sqlite3/util/sql3util/wasm/sql3parse_table.wasm diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/shm_windows.go b/vendor/github.com/ncruces/go-sqlite3/vfs/shm_windows.go index ad3e153ae..80ddad5df 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/shm_windows.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/shm_windows.go @@ -98,7 +98,7 @@ func (s *vfsShm) shmMap(ctx context.Context, mod api.Module, id, size int32, ext // Maps regions into memory. for int(id) >= len(s.shared) { - r, err := util.MapRegion(ctx, mod, s.File, int64(id)*int64(size), size) + r, err := util.MapRegion(s.File, int64(id)*int64(size), size) if err != nil { return 0, err } diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/vfs.go b/vendor/github.com/ncruces/go-sqlite3/vfs/vfs.go index 569346fb2..db53b6f4a 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/vfs.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/vfs.go @@ -470,6 +470,8 @@ func vfsErrorCode(ctx context.Context, err error, code _ErrorCode) _ErrorCode { switch v := reflect.ValueOf(err); v.Kind() { case reflect.Uint8, reflect.Uint16: code = _ErrorCode(v.Uint()) + default: + sys = err } } |
