Skip to content

Commit 361fdc5

Browse files
committed
SQLite 3.51.3.
1 parent 1008ddc commit 361fdc5

24 files changed

Lines changed: 73 additions & 68 deletions

‎blob.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (b *Blob) Read(p []byte) (n int, err error) {
112112
err = io.EOF
113113
}
114114

115-
copy(p, b.c.wrp.Slice(b.bufptr, want))
115+
copy(p, b.c.wrp.Bytes(b.bufptr, want))
116116
return int(want), err
117117
}
118118

@@ -142,7 +142,7 @@ func (b *Blob) WriteTo(w io.Writer) (n int64, err error) {
142142
return n, err
143143
}
144144

145-
mem := b.c.wrp.Slice(b.bufptr, want)
145+
mem := b.c.wrp.Bytes(b.bufptr, want)
146146
m, err := w.Write(mem[:want])
147147
b.offset += int64(m)
148148
n += int64(m)
@@ -204,7 +204,7 @@ func (b *Blob) ReadFrom(r io.Reader) (n int64, err error) {
204204
}
205205

206206
for {
207-
mem := b.c.wrp.Slice(b.bufptr, want)
207+
mem := b.c.wrp.Bytes(b.bufptr, want)
208208
m, err := r.Read(mem[:want])
209209
if m > 0 {
210210
rc := res_t(b.c.wrp.Xsqlite3_blob_write(int32(b.handle),

‎const.go‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ const (
180180
PREPARE_NORMALIZE PrepareFlag = 0x02
181181
PREPARE_NO_VTAB PrepareFlag = 0x04
182182
PREPARE_DONT_LOG PrepareFlag = 0x10
183-
PREPARE_FROM_DDL PrepareFlag = 0x20
183+
// PREPARE_FROM_DDL PrepareFlag = 0x20
184184
)
185185

186186
// FunctionFlag is a flag that can be passed to
@@ -267,6 +267,7 @@ const (
267267
DBCONFIG_ENABLE_ATTACH_CREATE DBConfig = 1020
268268
DBCONFIG_ENABLE_ATTACH_WRITE DBConfig = 1021
269269
DBCONFIG_ENABLE_COMMENTS DBConfig = 1022
270+
// SQLITE_DBCONFIG_FP_DIGITS DBConfig = 1023
270271
// DBCONFIG_MAX DBConfig = 1022
271272
)
272273

@@ -308,7 +309,7 @@ const (
308309
LIMIT_VARIABLE_NUMBER LimitCategory = 9
309310
LIMIT_TRIGGER_DEPTH LimitCategory = 10
310311
LIMIT_WORKER_THREADS LimitCategory = 11
311-
LIMIT_PARSER_DEPTH LimitCategory = 12
312+
// LIMIT_PARSER_DEPTH LimitCategory = 12
312313
)
313314

314315
// AuthorizerActionCode are the integer action codes

‎context.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func (ctx Context) ResultTime(value time.Time, format TimeFormat) {
146146
func (ctx Context) resultRFC3339Nano(value time.Time) {
147147
const maxlen = 48
148148
ptr := ctx.c.wrp.New(maxlen)
149-
buf := ctx.c.wrp.Slice(ptr, maxlen)
149+
buf := ctx.c.wrp.Bytes(ptr, maxlen)
150150
buf = value.AppendFormat(buf[:0], time.RFC3339Nano)
151151
_ = append(buf, 0)
152152

‎ext/pivot/pivot.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func declare(db *sqlite3.Conn, _, _, _ string, arg ...string) (ret *table, err e
4343

4444
// Row key query.
4545
t.scan = "SELECT * FROM\n" + arg[0]
46-
stmt, tail, err := db.PrepareFlags(t.scan, sqlite3.PREPARE_FROM_DDL)
46+
stmt, tail, err := db.PrepareFlags(t.scan, 0 /*PREPARE_FROM_DDL*/)
4747
if err != nil {
4848
return nil, err
4949
}
@@ -65,7 +65,7 @@ func declare(db *sqlite3.Conn, _, _, _ string, arg ...string) (ret *table, err e
6565
stmt.Close()
6666

6767
// Column definition query.
68-
stmt, tail, err = db.PrepareFlags("SELECT * FROM\n"+arg[1], sqlite3.PREPARE_FROM_DDL)
68+
stmt, tail, err = db.PrepareFlags("SELECT * FROM\n"+arg[1], 0 /*PREPARE_FROM_DDL*/)
6969
if err != nil {
7070
return nil, err
7171
}
@@ -89,7 +89,7 @@ func declare(db *sqlite3.Conn, _, _, _ string, arg ...string) (ret *table, err e
8989

9090
// Pivot cell query.
9191
t.cell = "SELECT * FROM\n" + arg[2]
92-
stmt, tail, err = db.PrepareFlags(t.cell, sqlite3.PREPARE_FROM_DDL)
92+
stmt, tail, err = db.PrepareFlags(t.cell, 0 /*PREPARE_FROM_DDL*/)
9393
if err != nil {
9494
return nil, err
9595
}
@@ -196,7 +196,7 @@ func (c *cursor) Filter(idxNum int, idxStr string, arg ...sqlite3.Value) error {
196196
return err
197197
}
198198

199-
const prepflags = sqlite3.PREPARE_DONT_LOG | sqlite3.PREPARE_FROM_DDL
199+
const prepflags = sqlite3.PREPARE_DONT_LOG /*PREPARE_FROM_DDL*/
200200

201201
c.scan, _, err = c.table.db.PrepareFlags(idxStr, prepflags)
202202
if err != nil {

‎ext/statement/stmt.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func declare(db *sqlite3.Conn, _, _, _ string, arg ...string) (*table, error) {
3636
sql := "SELECT * FROM\n" + arg[0]
3737

3838
stmt, tail, err := db.PrepareFlags(sql,
39-
sqlite3.PREPARE_PERSISTENT|sqlite3.PREPARE_FROM_DDL)
39+
sqlite3.PREPARE_PERSISTENT /*PREPARE_FROM_DDL*/)
4040
if err != nil {
4141
return nil, err
4242
}
@@ -135,7 +135,7 @@ func (t *table) Open() (_ sqlite3.VTabCursor, err error) {
135135
t.inuse = true
136136
} else {
137137
stmt, _, err = t.stmt.Conn().PrepareFlags(t.sql,
138-
sqlite3.PREPARE_DONT_LOG|sqlite3.PREPARE_FROM_DDL)
138+
sqlite3.PREPARE_DONT_LOG /*PREPARE_FROM_DDL*/)
139139
if err != nil {
140140
return nil, err
141141
}

‎func.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ func (e *env) Xgo_collation_needed(pArg, pDB, eTextRep, zName int32) {
189189
func (e *env) Xgo_compare(pApp, nKey1, pKey1, nKey2, pKey2 int32) int32 {
190190
fn := e.GetHandle(ptr_t(pApp)).(CollatingFunction)
191191
return int32(fn(
192-
e.Slice(ptr_t(pKey1), int64(nKey1)),
193-
e.Slice(ptr_t(pKey2), int64(nKey2))))
192+
e.Bytes(ptr_t(pKey1), int64(nKey1)),
193+
e.Bytes(ptr_t(pKey2), int64(nKey2))))
194194
}
195195

196196
func (e *env) Xgo_func(pCtx, pApp, nArg, pArg int32) {

‎go.mod‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
module github.com/ncruces/go-sqlite3
22

3-
go 1.24.0
3+
go 1.26.0
44

55
require (
6-
github.com/ncruces/go-sqlite3-wasm v0.0.0-20260312160048-b96020e92601
6+
github.com/ncruces/go-sqlite3-wasm v1.0.1-0.20260318174050-59cb2401d3ff
77
github.com/ncruces/julianday v1.0.0
88
github.com/ncruces/sort v0.1.6
99
github.com/ncruces/wbt v1.0.0

‎go.sum‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ github.com/dchest/siphash v1.2.3 h1:QXwFc8cFOR2dSa/gE6o/HokBMWtLUaNDVd+22aKHeEA=
22
github.com/dchest/siphash v1.2.3/go.mod h1:0NvQU092bT0ipiFN++/rXm69QG9tVxLAlQHIXMPAkHc=
33
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
44
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
5-
github.com/ncruces/go-sqlite3-wasm v0.0.0-20260312160048-b96020e92601 h1:XHbLfN7k+bFuWz9OWfZVert0feJUAs/ngRewsn3EW4I=
6-
github.com/ncruces/go-sqlite3-wasm v0.0.0-20260312160048-b96020e92601/go.mod h1:CLtq3B4C0mgdclnRUUkn4pLYYo1MsugQNXWjjAIxoPo=
5+
github.com/ncruces/go-sqlite3-wasm v1.0.1-0.20260318174050-59cb2401d3ff h1:jabe/IWMvK2glihBo1hWsF4Cz+wsZ4YJq9W9pQPX8wI=
6+
github.com/ncruces/go-sqlite3-wasm v1.0.1-0.20260318174050-59cb2401d3ff/go.mod h1:gaCJnWv69r9BPn0w7jAYg/CUht+PnTK8IIMB1K5C1uw=
77
github.com/ncruces/julianday v1.0.0 h1:fH0OKwa7NWvniGQtxdJRxAgkBMolni2BjDHaWTxqt7M=
88
github.com/ncruces/julianday v1.0.0/go.mod h1:Dusn2KvZrrovOMJuOt0TNXL6tB7U2E8kvza5fFc9G7g=
99
github.com/ncruces/sort v0.1.6 h1:TrsJfGRH1AoWoaeB4/+gCohot9+cA6u/INaH5agIhNk=

‎internal/sqlite3_wrap/mem.go‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type (
1818
Res_t int32
1919
)
2020

21-
func (mem *Memory) Slice(ptr Ptr_t, size int64) []byte {
21+
func (mem *Memory) Bytes(ptr Ptr_t, size int64) []byte {
2222
if ptr == 0 {
2323
panic(errutil.NilErr)
2424
}
@@ -98,19 +98,19 @@ func (mem *Memory) ReadString(ptr Ptr_t, maxlen int64) string {
9898
if int64(len(buf)) > maxlen {
9999
buf = buf[:maxlen]
100100
}
101-
if i := bytes.IndexByte(buf, 0); i >= 0 {
102-
return string(buf[:i])
101+
if before, _, ok := bytes.Cut(buf, []byte{0}); ok {
102+
return string(before)
103103
}
104104
panic(errutil.NoNulErr)
105105
}
106106

107107
func (mem *Memory) WriteBytes(ptr Ptr_t, b []byte) {
108-
buf := mem.Slice(ptr, int64(len(b)))
108+
buf := mem.Bytes(ptr, int64(len(b)))
109109
copy(buf, b)
110110
}
111111

112112
func (mem *Memory) WriteString(ptr Ptr_t, s string) {
113-
buf := mem.Slice(ptr, int64(len(s))+1)
113+
buf := mem.Bytes(ptr, int64(len(s))+1)
114114
buf[len(s)] = 0
115115
copy(buf, s)
116116
}

‎internal/sqlite3_wrap/mem_other.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ package sqlite3_wrap
44

55
type Memory struct {
66
Buf []byte
7-
Max int32
7+
Max int64
88
}
99

10-
func (m *Memory) Data() *[]byte {
10+
func (m *Memory) Slice() *[]byte {
1111
return &m.Buf
1212
}
1313

14-
func (m *Memory) Grow(delta, _ int32) int32 {
14+
func (m *Memory) Grow(delta, _ int64) int64 {
1515
len := len(m.Buf)
16-
old := int32(len >> 16)
16+
old := int64(len >> 16)
1717
if delta == 0 {
1818
return old
1919
}

0 commit comments

Comments
 (0)