0
0
mirror of https://gitlab.com/cznic/sqlite.git synced 2025-06-11 23:41:48 +00:00
Commit Graph

84 Commits

Author SHA1 Message Date
0bbf6555cb Allow registering custom collations 2023-09-15 12:57:10 +00:00
f9f836d4dc Update sqlite.go's docs for Driver.Open() 2023-08-23 07:02:33 +00:00
134c4cb6b7 Fix ScanType returned for BLOB
Previously ColumnTypeScanType returned the reflect.Type of [][]byte
for BLOB columns, resulting in a failure to scan when the type was
constructed dynamically based on this return.
2023-07-08 16:53:02 +09:30
d2e2403abb (*stmt).query(): do not return (nil, nil), fixes 2023-07-05 12:18:51 +02:00
cd98b8c912 update godocs 2023-07-05 11:54:34 +02:00
ae41c4a62d Add API to online backup API (sqlite3_backup_*) 2023-07-04 09:17:46 +02:00
84fc97a4b2 Add API to sqlite3_serialize/deserialize 2023-07-04 09:17:46 +02:00
b82b94e968 revert tip to v1.23.1, updates 2023-07-01 16:17:25 +02:00
2a8ff5d5e8 SQLite 3.42, 28 errors out of 839686 tests on linux/amd64 2023-06-10 23:01:20 +02:00
91c2fe3015 expose sqlite3_limit, updates 2023-06-08 17:01:32 +02:00
b5a7962754 Use static callbacks for user-defined functions
This ensures that they cannot be GCed.

See https://gitlab.com/cznic/sqlite/-/merge_requests/54#note_1396299066
for more details.
2023-05-30 21:01:32 +01:00
4a676e6e9d Allow registering aggregate and window functions
This allows registering custom aggregate and window functions (which
provide Step, Inverse, Value, and Final callbacks). It uses basically
the same interface as the zombiezen.com/go/sqlite package, which already
handles some trickier cases around multiple or concurrent invocations of
the same function.
2023-05-30 20:58:07 +01:00
e01fa04a2b Use FunctionImpl to represent user-defined functions
This is basically the same as the one from zombiezen.com/go/sqlite, but
only supports scalar functions for now.
2023-05-07 17:57:35 +01:00
0099444126 add debug facitlity, updates 2023-04-30 14:34:58 +02:00
5dd3c6f93e do not bail out eraly on url param _time_format, updates 2023-02-08 22:27:13 +01:00
abc96aa568 sqlite: only add tx_lock begin directive for write txs
Only add the `beginMode`, set by `_txlock`, after BEGIN in non-readonly
transactions. Use the `ReadOnly` member of the `driver.TxOptions`
parameter to determine when and when not to add the `beginMode`.
2023-01-18 19:52:34 +02:00
2c0b2bda58 handle ?vfs=name, fixes 2022-12-13 20:25:03 +01:00
c128158b86 remove user-facing global state 2022-07-23 12:46:41 +02:00
8be0ef8f37 switch from embed.FS to fs.FS 2022-07-23 11:24:08 +02:00
85dd432315 implement embed support prototype 2022-07-22 14:45:40 +02:00
f2a990b23b Fix handling of nil []byte as NULL values
This fixes a regression introduced in 87412bbfa9,
which changed nil []byte values by storing them as zero-sized blobs, instead of
NULLs.

Closes 
2022-05-18 23:52:19 +03:00
f2c77c5fed upgrade to SQLite 3.38.3 2022-05-02 16:41:55 +02:00
07ddc240d9 document v1.16 release 2022-04-04 14:52:56 +02:00
a922751947 driver: add a way to register scalar functions 2022-04-03 15:57:52 +02:00
87412bbfa9 driver: fix inserting empty blobs 2022-04-03 10:09:39 +00:00
f5a64f2267 sqlite: initial handling for user defined functions
This PR adds handling for user defined functions. Initially only the
xFunc parameter will be set, the others will come in subsequent PRs.
A test for a 'regexp' udf was added to check that the query

  "SELECT 'seafood' REGEXP 'foo.*'"

works as expected.
2022-04-01 13:59:51 +00:00
302d71cedc Fix race condition if exec's context is canceled just after completion 2022-03-15 11:22:26 +00:00
8e27ffc817 Add _txlock DSN parameter to customize BEGIN 2022-02-03 14:14:24 +00:00
7b21af2c7f darwin/arm64: regenerate, update dependencies 2021-12-10 15:32:31 +01:00
12794c24e9 3.37.0: regenerate all but darwin/arm64, netbsd/amd64 and windows/386 2021-11-29 14:57:11 +01:00
5e04542b70 darwin/amd64: regenerate with updated dependencies, updates libc#13 2021-11-10 15:41:27 +01:00
064df839a4 driver: support _time_format DSN query param
Building on the _pragma query param support added in 508747c9, support
a new _time_format query param.

If _time_format is set to "sqlite", written times use the time package
format "2006-01-02 15:04:05.999999999-07:00". This is the format
mattn/go-sqlite3 uses and is format 4 at
https://sqlite.org/lang_datefunc.html#time_values.

By default, times are formatted with time.Time.String. This maintains
compatibility with existing users of the driver.

Fixes 
2021-10-23 15:36:02 -03:00
a530c91309 driver: return error strings for constraint errors
In conn.step, use conn.errstr which gets the error from sqlite instead
of looking up the result code in the ErrorCodeString map.

This changes the code 5 (SQLITE_BUSY) message slightly, including
"database is locked" as returned my errstr. "SQLITE_BUSY" is still
added to the message.

Fixes 
2021-10-23 09:42:14 -03:00
e3be4b029c fix retry logic around conn.step, updates 2021-09-14 16:20:20 +02:00
aa7d275125 windows: fix TestPersistPragma.2, updates 2021-09-01 14:24:15 +02:00
0c9a6edac0 Merge branch 'persistent_pragma_configs' into 'master'
Persist pragma configurations via url parameter

Closes 

See merge request 
2021-08-19 00:02:34 +00:00
508747c957 Persist pragma configurations via url parameter 2021-08-19 00:02:34 +00:00
3ef4b5e692 restart builders 2021-08-18 18:39:17 +02:00
80c708f2aa fix race on conn.{Close,interrupt}, updates 2021-07-22 12:47:08 +02:00
7de07c7a26 fix manual memory management error, updates 2021-05-06 12:04:30 +02:00
5a2af3f4dc Set up mutex on lib package initialization
Fixes 
2021-04-21 20:56:35 -07:00
4800b08a35 update dependencies 2021-04-08 12:18:25 +02:00
e2b915c98c driver: set libc environment in init
modernc.org/libc.Start does this when wrapping funcs main to seed data
for libc.Xgetenv and friends.

However, sqlite doesn't use libc.Start. It sets libc bits up in an
init func. This leaves the libc view of the enivorment empty/null.

When the sqlite "localtime" modifier used with datetime/strftime/etc,
sqlite eventually calls libc.Xlocaltime which wants to read TZ from
the environment. With an empty/null libc enivornment, this segfaults.

To fix that, call libc.SetEnviron in func init like libc.Start
does.

Fixes https://gitlab.com/cznic/sqlite/-/issues/49
2021-04-05 20:35:19 -03:00
fae63b194d linux/amd64: enable pthreads 2021-03-23 00:17:08 +01:00
798bbeb9bb driver: support scanning more formats into time.Time
Fixes https://gitlab.com/cznic/sqlite/-/issues/46
2021-03-14 16:07:07 -03:00
77ccaf71ff driver: return column info even when no rows
Fixes https://gitlab.com/cznic/sqlite/-/issues/32
2021-03-14 13:09:25 -03:00
f5bcea6543 split production and testing 2021-01-30 01:09:04 +01:00
3c751e6fc6 fix memory leak caused by returning noRows{}/II, updates 2021-01-25 13:30:37 +01:00
168943b08a fix memory leak caused by returning noRows{}, updates 2021-01-25 12:22:10 +01:00
2d062fa148 driver: support ?NNN and $NNN parameters, add tests
Fix a bug around ensuring each index matches a corresponding
argument.

Support ?NNN parameters by checking for a match between NNN and
Ordinal. Do the same for $NNN even though $NNN should technically
require sql.Named.

Updates https://gitlab.com/cznic/sqlite/-/issues/42.
2021-01-18 11:23:00 -04:00