Yasuhiro Matsumoto
c3e96cd5bb
call sqlite3_value_blob before sqlite3_value_bytes in callbackArgString
2026-06-10 02:17:43 +09:00
mattn
518ffdba0a
Merge pull request #1406 from dxbjavid/function-text-embedded-nul
...
preserve embedded NUL bytes in custom function text values
2026-06-09 17:14:21 +00:00
dxbjavid
b1e8d68f31
read text value before its byte length to match documented order
2026-06-09 21:51:53 +05:30
dxbjavid
6b68c20301
preserve embedded NUL bytes in custom function text values
2026-06-09 16:29:57 +05:30
mattn
c63653b7ff
Merge pull request #1405 from dxbjavid/oversize-blob-result-guard
...
guard oversized blob length in callbackRetBlob
2026-06-06 02:04:01 +00:00
dxbjavid
5f1e21dd1e
guard oversized blob length in callbackRetBlob
2026-06-05 20:44:39 +05:30
Yasuhiro Matsumoto
78b95b7777
Clean up accidental v2 references
2026-06-05 21:15:35 +09:00
mattn
7ca6a979f9
Merge pull request #1404 from mattn/sqlite-amalgamation-3053002
...
Upgrade SQLite to version 3053002
2026-06-05 11:18:09 +00:00
Yasuhiro Matsumoto
e2ab9318ee
Upgrade SQLite to version 3053002
2026-06-05 20:09:45 +09:00
mattn
75d8c60d0d
Merge pull request #1403 from dxbjavid/bind-text64-length
...
bind via sqlite3_bind_text64/blob64 to avoid 32-bit length truncation
2026-06-05 11:08:15 +00:00
dxbjavid
d1ab49c04b
bind via sqlite3_bind_text64/blob64 to avoid 32-bit length truncation
2026-06-05 15:04:25 +05:30
mattn
b3b5216890
Merge pull request #1402 from dxbjavid/guard-resulttext-oversize
...
guard oversized string length in ResultText
2026-06-03 11:25:03 +00:00
dxbjavid
2af23f777e
guard oversized string length in ResultText
2026-06-03 14:33:41 +05:30
mattn
1a7264c5a6
Merge pull request #1400 from calmh/unsafereflect
...
modernise reflect.SliceHeader to unsafe.Slice
2026-06-02 02:29:27 +00:00
mattn
9accb920a6
Merge pull request #1399 from calmh/uintsize
...
avoid out of bounds write in unlock_notify_wait on 64 bit platforms
2026-06-02 02:18:01 +00:00
mattn
9d6bf2c4ad
Merge pull request #1338 from calmh/dbstat
...
add sqlite_dbstat tag for the DBSTAT virtual table
2026-05-23 08:28:30 +00:00
Jakob Borg
fed9970582
modernise reflect.SliceHeader to unsafe.Slice
...
Signed-off-by: Jakob Borg <jakob@kastelo.net >
2026-05-19 13:57:13 +02:00
Jakob Borg
904664d0b0
avoid out of bounds write in unlock_notify_wait on 64 bit platforms
...
While `C.sizeof_unit` is 4, we convert to a Go uint and write it to the
pointer. The Go uint is eight bytes on 64 bit platforms.
Signed-off-by: Jakob Borg <jakob@kastelo.net >
2026-05-19 12:47:48 +02:00
Jakob Borg
822b476511
add sqlite_dbstat tag for the DBSTAT virtual table
...
Used to gather statistics information about table disk usage.
2026-05-09 08:34:20 +02:00
mattn
20826e87d8
Merge pull request #1394 from mattn/sqlite-amalgamation-3053000
...
Upgrade SQLite to version 3053000
2026-04-29 18:20:20 +09:00
Yasuhiro Matsumoto
2d4d220883
fix changelog URL when minor or patch version is zero
2026-04-29 18:13:23 +09:00
Yasuhiro Matsumoto
3761cf7ca6
Upgrade SQLite to version 3053000
2026-04-29 18:09:13 +09:00
mattn
1aa7317331
Merge pull request #1388 from mattn/stmt-cache-lru
...
evict least-recently-used stmt when cache is full
2026-04-29 17:21:47 +09:00
mattn
c719e205f4
Merge pull request #1392 from mattn/fix-issue-1390-query-comment-panic
...
Fix panic when querying input with no SQL (only comments/whitespace)
2026-04-29 16:13:09 +09:00
Yasuhiro Matsumoto
869e516d63
fix panic when querying input with no SQL (only comments/whitespace)
...
sqlite3_prepare_v2 returns SQLITE_OK with a NULL statement handle when
the input contains no SQL. exec() already handled this; query() forwarded
the NULL handle to bind(), which crashed in sqlite3_clear_bindings(NULL).
Make query() skip NULL statements like exec() does, and make SQLiteRows
safe against a nil underlying statement so the empty-rows return value
does not crash.
Closes #1390
2026-04-29 15:54:05 +09:00
Yasuhiro Matsumoto
66902381f2
extract finalizeCachedStmt helper and drop redundant tail reset
2026-04-14 14:23:22 +09:00
Yasuhiro Matsumoto
59e8e756b9
only set stmt cacheKey when cache is enabled
2026-04-14 14:14:47 +09:00
Yasuhiro Matsumoto
2badb4cfef
use slice len/cap for stmt cache instead of separate counters
2026-04-14 14:13:43 +09:00
Yasuhiro Matsumoto
7716c20f00
evict LRU stmt when stmt cache is full
2026-04-11 20:47:55 +09:00
mattn
58e032d79a
Revise SECURITY.md for version support and reporting
...
Updated security policy to reflect supported versions and reporting guidelines.
2026-04-10 16:17:13 +09:00
Yasuhiro Matsumoto
1627011105
add _stmt_cache_size to DSN parameters table in README
2026-04-08 22:32:40 +09:00
mattn
5df13a0e80
Merge pull request #1387 from mattn/codex/stmt-cache
...
[codex] add opt-in statement cache
2026-04-08 22:29:35 +09:00
Yasuhiro Matsumoto
e302e5cb8c
document that _stmt_cache_size is per connection
...
Clarify that each connection in the sql.DB pool maintains its own
independent statement cache.
2026-04-08 13:43:47 +09:00
Yasuhiro Matsumoto
867dcbfbdc
move reset/clear into putCachedStmt and always finalize on failure
...
This avoids an unnecessary reset when the cache is full, guarantees
a statement cannot enter the cache without being reset/cleared, and
fixes a leak where sqlite3_finalize was not called when reset failed.
2026-04-08 13:42:26 +09:00
Yasuhiro Matsumoto
0e58fa4d72
simplify prepareWithCache to call prepare instead of duplicating logic
...
prepareWithCache now delegates to prepare and sets cacheKey
afterward, removing the useCache boolean parameter.
2026-04-08 13:41:29 +09:00
Yasuhiro Matsumoto
e9f47da5c5
do not bail out on finalize error in closeCachedStmtsLocked
...
Finalize all cached statements even if one fails. Leaving a
finalized statement in the cache map would be a use-after-finalize
bug per SQLite documentation.
2026-04-08 13:40:21 +09:00
Yasuhiro Matsumoto
325cb8d5d9
remove redundant stmtCacheSize check in putCachedStmt
...
When stmtCacheSize <= 0, stmtCacheCount >= stmtCacheSize is always
true, so the explicit check is unnecessary.
2026-04-08 13:39:22 +09:00
Yasuhiro Matsumoto
061c2a5f43
check stmtCacheSize before acquiring mutex in takeCachedStmt
...
stmtCacheSize is immutable after connection open, so checking it
before the lock avoids mutex overhead when cache is not enabled.
2026-04-08 13:38:45 +09:00
Yasuhiro Matsumoto
efa9b1c75d
add opt-in statement cache
2026-04-07 14:08:53 +09:00
mattn
8d12439413
Merge pull request #1386 from mattn/perf/reduce-cgo-overhead
...
reduce CGO call overhead for exec and bind paths
2026-04-06 22:36:14 +09:00
Yasuhiro Matsumoto
89f4bbe489
fix build with SQLITE_ENABLE_UNLOCK_NOTIFY
...
Move extern declarations for _sqlite3_*_blocking functions before
_sqlite3_exec_no_args which references them. Remove unused
_sqlite3_prepare_v2_nolen function.
2026-04-06 22:29:28 +09:00
Yasuhiro Matsumoto
49540487ae
reduce CGO call overhead for exec and bind paths
...
- Add _sqlite3_exec_no_args() C function that combines prepare+step+finalize
into a single CGO crossing for parameterless exec (most common case)
- Add _sqlite3_reset_clear() C function that combines sqlite3_reset and
sqlite3_clear_bindings into a single CGO crossing
- Use semaphore channel instead of result struct channel in context-aware
exec/Next paths to reduce allocations
- Use time.AppendFormat with stack buffer to avoid heap allocation in
time.Time binding
- Optimize bindNamedIndices to reuse a single buffer instead of 3
separate C.CString allocations
- Remove intermediate bindIndices slice allocation in named parameter
binding path
- Pass explicit query length to sqlite3_prepare_v2 to avoid C-side strlen
benchstat (n=8):
BenchmarkExec: -29.44% sec/op, -50% B/op, -33% allocs/op
BenchmarkQuery: -9.83% sec/op
BenchmarkParams: -6.38% sec/op
geomean: -6.72% sec/op
2026-04-06 22:22:20 +09:00
mattn
4a311ff7de
Merge pull request #1385 from mattn/perf/reduce-bind-overhead
...
Reduce sqlite bind overhead
2026-04-06 21:38:56 +09:00
Yasuhiro Matsumoto
61c5b98535
reduce sqlite bind overhead
2026-04-06 21:30:35 +09:00
mattn
f92973809d
Merge pull request #1384 from mattn/raise-go121-cleanup
...
Raise minimum Go version to 1.21
2026-04-03 22:09:55 +09:00
Yasuhiro Matsumoto
efae5e7686
raise minimum Go version to 1.21
2026-04-03 17:41:32 +09:00
mattn
b23d54cb76
Merge pull request #1383 from mattn/codex/next-row-batch-fetch
...
[codex] batch row column fetches in Next
2026-04-03 17:39:28 +09:00
Yasuhiro Matsumoto
e1557be6ce
batch row column fetches in Next
2026-04-03 12:47:30 +09:00
mattn
cc39db7160
Merge pull request #1382 from mattn/codex/sqlite3-bind-fastpath
...
[codex] optimize sqlite bind fast path
2026-04-03 12:00:00 +09:00
Yasuhiro Matsumoto
9a908a9fd0
optimize sqlite bind fast path
2026-04-03 11:47:49 +09:00