mirror of
https://github.com/ncruces/go-sqlite3.git
synced 2026-01-12 14:09:13 +00:00
Windows fixes.
This commit is contained in:
@@ -13,4 +13,4 @@ zig cc --target=wasm32-wasi -flto -g0 -Os \
|
||||
-mbulk-memory -mreference-types \
|
||||
-mnontrapping-fptoint -msign-ext \
|
||||
-D_HAVE_SQLITE_CONFIG_H \
|
||||
$(awk '{print "-Wl,--export="$0}' ../sqlite3/exports.txt)
|
||||
$(awk '{print "-Wl,--export="$0}' exports.txt)
|
||||
@@ -5,6 +5,9 @@
|
||||
//
|
||||
// import _ "github.com/ncruces/go-sqlite3/embed"
|
||||
//
|
||||
// The following optional features are compiled in:
|
||||
// math functions, JSON, FTS3/4/5, R*Tree, GeoPoly.
|
||||
//
|
||||
// You can obtain this build of SQLite from:
|
||||
// https://github.com/ncruces/go-sqlite3/tree/main/embed
|
||||
package embed
|
||||
|
||||
2
vfs.go
2
vfs.go
@@ -169,6 +169,8 @@ func vfsDelete(ctx context.Context, mod api.Module, pVfs, zPath, syncDir uint32)
|
||||
return _OK
|
||||
}
|
||||
if err != nil {
|
||||
// TODO: fix windows.ERROR_SHARING_VIOLATION
|
||||
// https://github.com/golang/go/issues/32088
|
||||
return uint32(IOERR_DELETE)
|
||||
}
|
||||
if runtime.GOOS != "windows" && syncDir != 0 {
|
||||
|
||||
@@ -63,6 +63,9 @@ func (vfsOSMethods) ReleaseLock(file *os.File, state vfsLockState) xErrorCode {
|
||||
func (vfsOSMethods) unlock(file *os.File, start, len uint32) xErrorCode {
|
||||
err := windows.UnlockFileEx(windows.Handle(file.Fd()),
|
||||
0, len, 0, &windows.Overlapped{Offset: start})
|
||||
if err == windows.ERROR_NOT_LOCKED {
|
||||
return _OK
|
||||
}
|
||||
if err != nil {
|
||||
return IOERR_UNLOCK
|
||||
}
|
||||
@@ -95,8 +98,14 @@ func (vfsOSMethods) lockErrorCode(err error, def xErrorCode) xErrorCode {
|
||||
if err == nil {
|
||||
return _OK
|
||||
}
|
||||
if errno, _ := err.(syscall.Errno); errno == windows.ERROR_INVALID_HANDLE {
|
||||
return def
|
||||
if errno, ok := err.(syscall.Errno); ok {
|
||||
// https://devblogs.microsoft.com/oldnewthing/20140905-00/?p=63
|
||||
switch errno {
|
||||
case
|
||||
windows.ERROR_LOCK_VIOLATION,
|
||||
windows.ERROR_IO_PENDING:
|
||||
return xErrorCode(BUSY)
|
||||
}
|
||||
}
|
||||
return xErrorCode(BUSY)
|
||||
return def
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user