Yasuhiro Matsumoto
82d5507d2c
Check preupdate value fetch result to avoid NULL dereference
2026-07-13 10:48:33 +09:00
mattn
78710fc089
Merge pull request #1417 from mattn/add-coderabbit-sponsor
...
Add CodeRabbit as a sponsor
2026-07-08 13:38:47 +00:00
Yasuhiro Matsumoto
9d436de279
Add CodeRabbit as a sponsor
2026-07-08 22:28:34 +09:00
mattn
83baa779b9
Merge pull request #1416 from mattn/fix-stmt-close-race
...
Fix race in SQLiteStmt.Close by holding conn lock across cache check
2026-07-06 16:42:34 +00:00
Yasuhiro Matsumoto
34c9c34da4
Fix race in SQLiteStmt.Close by holding conn lock across cache check
2026-07-07 00:31:45 +09:00
Yasuhiro Matsumoto
a40eeff51e
Add upgrade/check.sh to check if SQLite upgrade is available
2026-06-22 00:27:39 +09:00
mattn
693de12676
Merge pull request #1408 from dxbjavid/getfilename-cstring-leak
...
free leaked schema string in GetFilename
2026-06-21 15:11:48 +00:00
mattn
837b4f2860
Merge pull request #1413 from mattn/cache-stmt-column-metadata
...
cache column metadata for prepared and cached statements
2026-06-18 05:23:30 +00:00
Yasuhiro Matsumoto
e99486c6b5
cache column metadata for prepared and cached statements
...
Column names and declared types are invariant for the lifetime of a
prepared statement, but Columns()/declTypes() called C.sqlite3_column_name
and sqlite3_column_decltype on every query, once per column. On hot
QueryRow paths reusing an explicit Prepare or a _stmt_cache_size statement,
this is a fixed set of cgo crossings paid on every execution.
Cache the names and decltypes on the SQLiteStmt the first time they are
materialized and reuse them on subsequent executions. Caching is gated by
cacheMetadata(): explicit prepared statements always cache, Query-created
ephemeral statements cache only when they live in the connection stmt
cache. One-shot statements keep the previous per-call behavior.
2026-06-18 14:15:01 +09:00
mattn
eb06f26148
Merge pull request #1412 from mattn/codex-5sxu1n
...
Use atomic.Value for handle table and add concurrent lookup benchmark
2026-06-18 04:41:29 +00:00
mattn
423f9605f3
Make callback handle lookups lock-free
2026-06-18 04:28:39 +00:00
dxbjavid
a3cd5cd6fd
free leaked schema string in GetFilename
2026-06-11 15:22:46 +05:30
mattn
379319c0d8
Merge pull request #1407 from mattn/blob-arg-call-order
...
Follow documented call order for sqlite3_value_blob in callbackArgString
2026-06-09 17:33:29 +00:00
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