SQLite 3.51.0.

This commit is contained in:
Nuno Cruces
2025-10-18 11:06:50 +01:00
parent 191d1337e7
commit 6d92aa16ef
20 changed files with 68 additions and 58 deletions

View File

@@ -20,11 +20,12 @@ The main differences to be aware of are
### File Locking
POSIX advisory locks,
which SQLite uses on [Unix](https://github.com/sqlite/sqlite/blob/5d60f4/src/os_unix.c#L13-L14),
are [broken by design](https://github.com/sqlite/sqlite/blob/5d60f4/src/os_unix.c#L1074-L1162).
which SQLite uses on [Unix](https://github.com/sqlite/sqlite/blob/41fda52/src/os_unix.c#L13-L14),
are [broken by design](https://github.com/sqlite/sqlite/blob/41fda52/src/os_unix.c#L1188-L1276).
Instead, on Linux and macOS, this package uses
[OFD locks](https://gnu.org/software/libc/manual/html_node/Open-File-Description-Locks.html)
[OFD locks](https://sourceware.org/glibc/manual/2.25/html_node/Open-File-Description-Locks.html)
to synchronize access to database files.
OFD locks require [Linux 3.15](https://lwn.net/Articles/586904/).
This package can also use
[BSD locks](https://man.freebsd.org/cgi/man.cgi?query=flock&sektion=2),

View File

@@ -56,7 +56,7 @@ func (h *hbshVFS) OpenFilename(name *vfs.Filename, flags vfs.OpenFlag) (file vfs
if hbsh == nil {
file.Close()
return nil, flags, sqlite3.CANTOPEN
return nil, flags, sqlite3.IOERR_BADKEY
}
return &hbshFile{File: file, hbsh: hbsh, init: h.init}, flags, nil
}
@@ -108,7 +108,7 @@ func (h *hbshFile) Pragma(name string, value string) (string, error) {
if h.hbsh = h.init.HBSH(key); h.hbsh != nil {
return "ok", nil
}
return "", sqlite3.CANTOPEN
return "", sqlite3.IOERR_BADKEY
}
func (h *hbshFile) ReadAt(p []byte, off int64) (n int, err error) {

View File

@@ -207,6 +207,10 @@ type blockingSharedMemory interface {
shmEnableBlocking(block bool)
}
// FileControl makes it easy to forward all fileControl methods,
// which we want to do for the checksum VFS.
// However, this is not a safe default, and other VFSes
// should explicitly wrap the methods they want to wrap.
type fileControl interface {
File
fileControl(ctx context.Context, mod api.Module, op _FcntlOpcode, pArg ptr_t) _ErrorCode

View File

@@ -120,7 +120,7 @@ func (n *Filename) URIParameter(key string) string {
}
// Parse the format from:
// https://github.com/sqlite/sqlite/blob/b74eb0/src/pager.c#L4797-L4840
// https://github.com/sqlite/sqlite/blob/41fda52/src/pager.c#L4821-L4864
// This avoids having to alloc/free the key just to find a value.
for {
k := util.ReadString(n.mod, ptr, _MAX_NAME)
@@ -160,7 +160,7 @@ func (n *Filename) URIParameters() url.Values {
var params url.Values
// Parse the format from:
// https://github.com/sqlite/sqlite/blob/b74eb0/src/pager.c#L4797-L4840
// https://github.com/sqlite/sqlite/blob/41fda52/src/pager.c#L4821-L4864
// This is the only way to support multiple valued keys.
for {
k := util.ReadString(n.mod, ptr, _MAX_NAME)

Binary file not shown.

View File

@@ -55,7 +55,7 @@ func (x *xtsVFS) OpenFilename(name *vfs.Filename, flags vfs.OpenFlag) (file vfs.
if cipher == nil {
file.Close()
return nil, flags, sqlite3.CANTOPEN
return nil, flags, sqlite3.IOERR_BADKEY
}
return &xtsFile{File: file, cipher: cipher, init: x.init}, flags, nil
}
@@ -103,7 +103,7 @@ func (x *xtsFile) Pragma(name string, value string) (string, error) {
if x.cipher = x.init.XTS(key); x.cipher != nil {
return "ok", nil
}
return "", sqlite3.CANTOPEN
return "", sqlite3.IOERR_BADKEY
}
func (x *xtsFile) ReadAt(p []byte, off int64) (n int, err error) {