mirror of
https://github.com/ncruces/go-sqlite3.git
synced 2026-01-12 05:59:14 +00:00
Enable memdb on speedtest1.
This commit is contained in:
@@ -14,7 +14,14 @@ import (
|
||||
type vfs struct{}
|
||||
|
||||
func (vfs) Open(name string, flags sqlite3vfs.OpenFlag) (sqlite3vfs.File, sqlite3vfs.OpenFlag, error) {
|
||||
if flags&sqlite3vfs.OPEN_MAIN_DB == 0 {
|
||||
// Allowed file types:
|
||||
// - databases, which only do page aligned reads/writes;
|
||||
// - temp journals, used by the sorter, which does the same.
|
||||
const types = sqlite3vfs.OPEN_MAIN_DB |
|
||||
sqlite3vfs.OPEN_TRANSIENT_DB |
|
||||
sqlite3vfs.OPEN_TEMP_DB |
|
||||
sqlite3vfs.OPEN_TEMP_JOURNAL
|
||||
if flags&types == 0 {
|
||||
return nil, flags, sqlite3.CANTOPEN
|
||||
}
|
||||
|
||||
@@ -54,6 +61,7 @@ func (vfs) FullPathname(name string) (string, error) {
|
||||
return name, nil
|
||||
}
|
||||
|
||||
// Must be a multiple of 64K (the largest page size).
|
||||
const sectorSize = 65536
|
||||
|
||||
type dbase struct {
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"github.com/tetratelabs/wazero/experimental"
|
||||
"github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1"
|
||||
|
||||
_ "github.com/ncruces/go-sqlite3/sqlite3memdb"
|
||||
"github.com/ncruces/go-sqlite3/sqlite3vfs"
|
||||
)
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ func vfsRead(ctx context.Context, mod api.Module, pFile, zBuf, iAmt uint32, iOfs
|
||||
if n == int(iAmt) {
|
||||
return _OK
|
||||
}
|
||||
if n == 0 && err != io.EOF {
|
||||
if err != io.EOF {
|
||||
return vfsErrorCode(err, _IOERR_READ)
|
||||
}
|
||||
clear(buf[n:])
|
||||
|
||||
Reference in New Issue
Block a user