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

76 Commits

Author SHA1 Message Date
0ea173f350 Added TestIssue118, updates 2022-11-23 10:26:21 +00:00
5c9c85057b openbsd/arm64: use modified mptest.c 2022-09-20 19:52:38 +02:00
fd7b2cc5b3 support freebsd/arm64 2022-09-15 11:30:54 +02:00
af5809db50 freebsd/arm: generate 2022-09-11 22:48:46 +02:00
8f692c983b migrate from deprecated ioutil package 2022-08-25 09:38:46 +00:00
520ebf401b vfs: New returns name
Instead of requiring a name arg that may clash with other state, have
New only take the fs.FS and return the value that should be used for
`vfs` in the sql.Open DSN.
2022-07-23 19:09:35 -03: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
8adabd5734 tests: add a test for issue 97 2022-04-05 22:58:58 +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
917fbf26bb support linux/riscv64, updates libc#16 2022-03-12 21:53:57 +00:00
8e27ffc817 Add _txlock DSN parameter to customize BEGIN 2022-02-03 14:14:24 +00:00
333ac00e6b linux/arm: regenerate 2021-11-01 22:34:01 +01:00
6f800703d3 TestConcurrentProcesses: enlarge timeout, enables slow builders to pass 2021-10-24 18:00:29 +02: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
da74fa6c39 remove --trace 2 from TestConcurrentProcesses 2021-09-25 10:53:13 +02:00
fa683c81c6 add test, updates 2021-09-17 12:38:44 +02:00
e3be4b029c fix retry logic around conn.step, updates 2021-09-14 16:20:20 +02:00
e1d8d213c1 Fix invalid test, resolves 2021-09-13 13:50:13 +02:00
7f27fe4762 add TestIssue70, updates 2021-09-13 12:00:13 +02:00
65c49f4def freebsd/amd64: initial port, GO111MODULE=off only, updates libc#10. 2021-09-04 21:39:54 +02:00
8efc1b0753 windows: fix TestPersistPragma.3, updates 2021-09-01 14:38:12 +02:00
aa7d275125 windows: fix TestPersistPragma.2, updates 2021-09-01 14:24:15 +02:00
7ecaceaa8f windows: fix TestPersistPragma, updates 2021-09-01 14:06:04 +02:00
508747c957 Persist pragma configurations via url parameter 2021-08-19 00:02:34 +00:00
ffc4be292a update all targets but darwin/arm64 to SQLite 3.36, updates 2021-06-21 12:21:04 +02:00
cc37e09f4c close db after test case 2021-06-10 21:25:36 -04:00
ff775b367c all_test.go - remove the temp db between scripts to prevent not quite closed/deleted/race.
malloc5.test - skip tests requiring memstats collection
pager1.test - skip 2 tests in non-functional sets.
snapshot_fault.test - skip test w/failing forcedelete
testdata/tcl/tester.tcl - fix get_pwd to return output of 'cd'
2021-06-09 18:44:35 -04:00
a740e9e176 add reproducer, updates 2021-05-05 12:05:52 +02:00
ca47b106c9 fix and enable TestIssue51, updates 2021-04-30 16:30:26 -03:00
4a946a98e9 update dependencies, disable TestIssue51 2021-04-18 14:36:48 +02:00
eb8fb3b86d add TestIssue51, updates 2021-04-16 10:40:07 +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
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
9132cd04c3 Translate line endings for test reference output (*nix -> windows), as git changes by default to windows 2021-02-27 18:57:14 -05:00
5ab7e771a8 enable memgrind 2021-02-17 18:42:44 +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
132978c738 bump libc,tcl version 2021-01-17 11:38:58 +01:00
bfeff02653 enable memory auditing in most tests/benchmarks using -tags=libc.memgrind 2021-01-16 16:46:44 +01:00
90dac3ac7b rows.Next: support scanning of time values, fixes 2021-01-10 15:26:54 +01:00
1c17040813 Make benchmarks try different table sizes
jnml@3900x:~/src/modernc.org/sqlite$ go test -tags cgobench -run @ -bench . -recs_per_sec_as_mbps |& tee log
test binary compiled for linux/amd64
goos: linux
goarch: amd64
pkg: modernc.org/sqlite
BenchmarkInsertMemory/1e1-24         	   17526	     69420 ns/op	144051.54 MB/s	    2242 B/op	      70 allocs/op
BenchmarkInsertMemory/1e2-24         	    1861	    713302 ns/op	140192.98 MB/s	   22427 B/op	     700 allocs/op
BenchmarkInsertMemory/1e3-24         	     168	   6949300 ns/op	143899.38 MB/s	  230079 B/op	    7744 allocs/op
BenchmarkInsertMemory/1e4-24         	      16	  66353146 ns/op	150708.76 MB/s	 2320327 B/op	   79748 allocs/op
BenchmarkInsertMemory/1e5-24         	       2	2125566987 ns/op	47046.27 MB/s	23211064 B/op	  799876 allocs/op
BenchmarkInsertMemory/1e6-24         	       1	32409599180 ns/op	30855.06 MB/s	232210448 B/op	 8001572 allocs/op
BenchmarkNextMemory/1e1-24           	  181816	      6783 ns/op	1474180.21 MB/s	      16 B/op	       1 allocs/op
BenchmarkNextMemory/1e2-24           	   22436	     52581 ns/op	1901822.13 MB/s	      16 B/op	       1 allocs/op
BenchmarkNextMemory/1e3-24           	    2810	    461729 ns/op	2165773.65 MB/s	   12432 B/op	    1645 allocs/op
BenchmarkNextMemory/1e4-24           	     264	   4671249 ns/op	2140755.03 MB/s	  156432 B/op	   19645 allocs/op
BenchmarkNextMemory/1e5-24           	       2	 552415982 ns/op	181023.00 MB/s	 1596432 B/op	  199645 allocs/op
BenchmarkNextMemory/1e6-24           	       1	5283792426 ns/op	189258.00 MB/s	15996480 B/op	 1999645 allocs/op
BenchmarkReading1/sqliteInMemory1e1-24         	  154976	      6895 ns/op	1450348.96 MB/s	      16 B/op	       1 allocs/op
BenchmarkReading1/sqliteInMemory1e2-24         	   22861	     52974 ns/op	1887724.10 MB/s	      16 B/op	       1 allocs/op
BenchmarkReading1/sqliteInMemory1e3-24         	    2499	    449004 ns/op	2227153.62 MB/s	   12432 B/op	    1645 allocs/op
BenchmarkReading1/sqliteInMemory1e4-24         	     264	   4504266 ns/op	2220117.55 MB/s	  156432 B/op	   19645 allocs/op
BenchmarkReading1/sqliteInMemory1e5-24         	       2	 543267468 ns/op	184071.39 MB/s	 1596432 B/op	  199645 allocs/op
BenchmarkReading1/sqliteInMemory1e6-24         	       1	5504469406 ns/op	181670.55 MB/s	15996464 B/op	 1999645 allocs/op
BenchmarkReading1/sqlite3InMemory1e1-24        	  165736	      7426 ns/op	1346699.36 MB/s	     320 B/op	      37 allocs/op
BenchmarkReading1/sqlite3InMemory1e2-24        	   20946	     55017 ns/op	1817631.77 MB/s	    2480 B/op	     307 allocs/op
BenchmarkReading1/sqlite3InMemory1e3-24        	    1741	    619309 ns/op	1614701.91 MB/s	   37232 B/op	    4651 allocs/op
BenchmarkReading1/sqlite3InMemory1e4-24        	     200	   5970890 ns/op	1674792.32 MB/s	  397235 B/op	   49651 allocs/op
BenchmarkReading1/sqlite3InMemory1e5-24        	      19	  61240730 ns/op	1632900.20 MB/s	 3997259 B/op	  499651 allocs/op
BenchmarkReading1/sqlite3InMemory1e6-24        	       2	 620411424 ns/op	1611833.63 MB/s	39997508 B/op	 4999652 allocs/op
BenchmarkReading1/sqliteOnDisk1e1-24           	  179678	      7028 ns/op	1422927.68 MB/s	      16 B/op	       1 allocs/op
BenchmarkReading1/sqliteOnDisk1e2-24           	   25140	     47970 ns/op	2084640.49 MB/s	      16 B/op	       1 allocs/op
BenchmarkReading1/sqliteOnDisk1e3-24           	    2340	    442164 ns/op	2261602.38 MB/s	   12432 B/op	    1645 allocs/op
BenchmarkReading1/sqliteOnDisk1e4-24           	     266	   4515133 ns/op	2214773.96 MB/s	  156432 B/op	   19645 allocs/op
BenchmarkReading1/sqliteOnDisk1e5-24           	       3	 446614930 ns/op	223906.53 MB/s	 1596437 B/op	  199645 allocs/op
BenchmarkReading1/sqliteOnDisk1e6-24           	       1	4326258166 ns/op	231146.63 MB/s	15996464 B/op	 1999645 allocs/op
BenchmarkReading1/sqlite3OnDisk1e1-24          	  119437	      9782 ns/op	1022315.11 MB/s	     320 B/op	      37 allocs/op
BenchmarkReading1/sqlite3OnDisk1e2-24          	   20011	     58941 ns/op	1696624.22 MB/s	    2480 B/op	     307 allocs/op
BenchmarkReading1/sqlite3OnDisk1e3-24          	    1981	    605212 ns/op	1652313.10 MB/s	   37232 B/op	    4651 allocs/op
BenchmarkReading1/sqlite3OnDisk1e4-24          	     195	   6269972 ns/op	1594903.42 MB/s	  397234 B/op	   49651 allocs/op
BenchmarkReading1/sqlite3OnDisk1e5-24          	      18	  62079585 ns/op	1610835.51 MB/s	 3997248 B/op	  499651 allocs/op
BenchmarkReading1/sqlite3OnDisk1e6-24          	       2	 612785354 ns/op	1631892.79 MB/s	39997520 B/op	 4999652 allocs/op
PASS
ok  	modernc.org/sqlite	280.633s
jnml@3900x:~/src/modernc.org/sqlite$ ok
2021-01-07 15:07:26 +01:00
b89c2c19aa enable windows/{amd64,386} build 2020-12-21 21:10:07 +01:00
736c530ac7 implement sql.{RowsColumnTypeScanType,RowsColumnTypeDatabaseTypeName,RowsColumnTypeLength,RowsColumnTypeNullable,RowsColumnTypePrecisionScale}, fixes 2020-09-25 15:12:39 +02:00
a4318db8c7 handle properly 0 rows query results, fixes 2020-09-21 18:36:03 +02:00