Commit Graph

67 Commits

Author SHA1 Message Date
glebarez
a9435364ee use ParseInLocation with UTC zone 2022-10-01 00:53:46 +07:00
Artyom Pervukhin
8e88a000fe Fix handling of nil []byte as NULL values
This fixes a regression introduced in 87412bbfa9b5b979ca4d4e8ba69c347819b9c4da,
which changed nil []byte values by storing them as zero-sized blobs, instead of
NULLs.

Closes #100
2022-05-27 13:25:12 +03:00
glebarez
ff85e5a8ca minor syntax changes for better aligning with upstream 2022-04-05 18:15:59 +03:00
glebarez
2097e63911 merge upstream 2022-04-05 18:04:19 +03:00
glebarez
19d521f4e5 ColumnTypeScanType: return time.Time for date/time types 2022-03-21 21:33:39 +03:00
Matthew Gabeler-Lee
327c7779d4 Fix race condition if exec's context is canceled just after completion 2022-03-21 21:33:39 +03:00
Matthew Gabeler-Lee
870db7651a Add _txlock DSN parameter to customize BEGIN 2022-03-21 21:33:39 +03:00
glebarez
5c08f3f9f5 change default time format / add 2 more parseable formats 2021-12-22 21:20:53 +01:00
glebarez
70caf07bd7 leave parameter count error for latter stage 2021-12-11 14:04:09 +01:00
glebarez
3e826851d9 re-implement rows{}: support for multi-statement SQL; deferred execution until Next() called 2021-12-11 14:04:09 +01:00
Сахнов Глеб Андреевич
fbd12bd006 optional logging of SQL statments 2021-12-11 14:04:09 +01:00
Jan Mercl
7b21af2c7f darwin/arm64: regenerate, update dependencies 2021-12-10 15:32:31 +01:00
Jan Mercl
12794c24e9 3.37.0: regenerate all but darwin/arm64, netbsd/amd64 and windows/386 2021-11-29 14:57:11 +01:00
Jan Mercl
5e04542b70 darwin/amd64: regenerate with updated dependencies, updates libc#13 2021-11-10 15:41:27 +01:00
Dan Peterson
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 #47
2021-10-23 15:36:02 -03:00
Dan Peterson
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 #73
2021-10-23 09:42:14 -03:00
Jan Mercl
e3be4b029c fix retry logic around conn.step, updates #66 2021-09-14 16:20:20 +02:00
Jan Mercl
aa7d275125 windows: fix TestPersistPragma.2, updates #67 2021-09-01 14:24:15 +02:00
Logan
0c9a6edac0 Merge branch 'persistent_pragma_configs' into 'master'
Persist pragma configurations via url parameter

Closes #37

See merge request cznic/sqlite!27
2021-08-19 00:02:34 +00:00
Logan
508747c957 Persist pragma configurations via url parameter 2021-08-19 00:02:34 +00:00
Jan Mercl
3ef4b5e692 restart builders 2021-08-18 18:39:17 +02:00
Jan Mercl
80c708f2aa fix race on conn.{Close,interrupt}, updates #57 2021-07-22 12:47:08 +02:00
Jan Mercl
7de07c7a26 fix manual memory management error, updates #53 2021-05-06 12:04:30 +02:00
Ross Light
5a2af3f4dc Set up mutex on lib package initialization
Fixes #52
2021-04-21 20:56:35 -07:00
Jan Mercl
4800b08a35 update dependencies 2021-04-08 12:18:25 +02:00
Dan Peterson
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
Jan Mercl
fae63b194d linux/amd64: enable pthreads 2021-03-23 00:17:08 +01:00
Dan Peterson
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
Dan Peterson
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
Jan Mercl
f5bcea6543 split production and testing 2021-01-30 01:09:04 +01:00
Jan Mercl
3c751e6fc6 fix memory leak caused by returning noRows{}/II, updates #43 2021-01-25 13:30:37 +01:00
Jan Mercl
168943b08a fix memory leak caused by returning noRows{}, updates #43 2021-01-25 12:22:10 +01:00
Dan Peterson
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
Jan Mercl
0a7471a043 Makefile: add regression_check target 2021-01-17 21:34:54 +01:00
cznic
295d48b2e8 Merge branch 'un-goroutine-ctx' into 'master'
un-go-routine the ctx cancelations

See merge request cznic/sqlite!20
2021-01-12 20:39:48 +00:00
Jaap Aarts
bfc1503df5 un-go-routine the ctx cancelations 2021-01-12 20:39:48 +00:00
Jan Mercl
56d82b45dc noRows: return proper io.EOF 2021-01-12 18:19:04 +01:00
Jan Mercl
d12d3a4d8c handle binding zero length blobs, updates #40 2021-01-12 17:50:29 +01:00
Jan Mercl
663f19b57d handle zero sized allocs 2021-01-12 17:40:04 +01:00
Jan Mercl
9383707da0 conn.Close: fix memory leak 2021-01-11 13:21:44 +01:00
Jan Mercl
90dac3ac7b rows.Next: support scanning of time values, fixes #35 2021-01-10 15:26:54 +01:00
Yaacov Akiba Slama
b69b933c94 Add support for NULL values 2020-10-12 22:09:42 +03:00
Jan Mercl
736c530ac7 implement sql.{RowsColumnTypeScanType,RowsColumnTypeDatabaseTypeName,RowsColumnTypeLength,RowsColumnTypeNullable,RowsColumnTypePrecisionScale}, fixes #30 2020-09-25 15:12:39 +02:00
Jan Mercl
a4318db8c7 handle properly 0 rows query results, fixes #28 2020-09-21 18:36:03 +02:00
Jan Mercl
e662a135d1 release 1.4.0 2020-08-26 23:31:54 +02:00
Jan Mercl
43c865ce5d regenerate and update dependencies 2020-08-04 17:15:32 +02:00
Jan Mercl
1349149922 use crt v3.24.9 2020-07-31 14:18:38 +02:00
Jan Mercl
3337c85b5e 103 errors out of 202628 tests on Linux 64-bit little-endian 2020-07-30 17:13:42 +02:00
Jan Mercl
b406626c64 release v1.4.0-beta1 2020-07-26 22:36:18 +02:00
Jan Mercl
141c3f22b7 fix forgotten TODO 2020-01-01 12:05:39 +01:00