aboutsummaryrefslogtreecommitdiff
path: root/sqlite3.go (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Build with "go tool" and hackishly bundle code from same package into one ↵EuAndreh2024-08-121-2281/+0
| | | | file each
* fix: some typospomadev2024-02-221-1/+1
|
* close channelYasuhiro Matsumoto2024-02-031-7/+15
|
* go fmt ./...Yasuhiro Matsumoto2024-01-251-74/+75
|
* update go version to 1.19Yasuhiro Matsumoto2024-01-251-6/+5
|
* Fix musl build (#1164)leso-kn2023-12-151-1/+12
|
* Replace namedValue with driver.NamedValue to avoid copying exec/query args ↵Charlie Vieth2023-02-111-22/+16
| | | | (#1128)
* Rollback on constraint failure (#1071)Joshua Hull2022-09-011-2/+4
| | | Always rollback on a commit error
* Add sqlite3_file_control() supportBen Johnson2022-01-291-0/+70
| | | | | | | This commit adds the SQLiteConn.FileControlInt() method which calls the underlying sqlite3_file_control() function with an int argument. This can be used for low-level operations on SQLite databases such as persisting the WAL file after database close.
* Add driverName to be possible change driver nameYasuhiro Matsumoto2022-01-101-1/+8
|
* change angle bracket import to quotes (#868)Hanzhen Yi2021-10-261-1/+1
|
* sqlite3.go: use PRAGMA to set busy_timeout (#910)Dan Peterson2021-10-261-6/+6
| | | | | | | | | | The busy_timeout pragma was added in sqlite 3.7.15 as an alternative to calling sqlite3_busy_timeout directly: https://sqlite.org/pragma.html#pragma_busy_timeout While there's no functional change here, using the pragma does align setting busy_timeout with other settings and removes the special case for calling sqlite3_busy_timeout directly.
* Allow building on OpenBSD (#976)Denis Fondras2021-10-261-0/+2
|
* return non-nil result when calling exec with empty query (#973)Aviv Klasquin Komissar2021-10-191-0/+4
| | | fixes #963
* make column metadata functionality opt-inJesse Rittner2021-02-181-9/+0
|
* Export sqlite3_column_table_name (#900)Philip O'Toole2021-02-181-0/+9
|
* Adds a fuzz target (#908)Catena cyber2021-02-151-1/+1
| | | | | * Adds a fuzz target * Fixes memory leak
* Export sqlite3_stmt_readonly() via SQLiteStmt.Readonly() (#895)Martin Tournoij2020-12-281-0/+7
| | | | | | | | | | | | | | | This can be used like in the test; I wrote a little wrapper around sql.DB which uses this, and allows concurrent reads but just one single write. This is perhaps a better generic "table locked"-solution than setting the connections to 1 and/or cache=shared (although even better would be to design your app in such a way that this doesn't happpen in the first place, but even then a little seat belt isn't a bad thing). The parsing adds about 0.1ms to 0.2ms of overhead in the wrapper, which isn't too bad (and it caches the results, so only needs to do this once). At any rate, I can't really access functions from sqlite3-binding.c from my application, so expose it via SQLiteStmt.
* Add ?_cache_size=[..] to connection parameters (#894)Martin Tournoij2020-12-261-0/+21
| | | | | | | | | | | | | | | | | | Add a shortcut for PRAGMA cache_size; this is a pretty useful setting: the default of -2000 (2M) is not especially high, and a lot of people will probably want to increase this. For example, while running a bunch of fairy expensive queries in parallel: With SetMaxOpenConns(1): -2000: 5762ms -20000: 4714ms With SetMaxOpenConns(20): -2000: 3067ms -20000: 2532ms Which isn't a bad performance boost for changing a single number.
* sqlite3.go: Remove -DSQLITE_ENABLE_FTS4_UNICODE61: not supported (#872)Evan Jones2020-11-171-1/+0
| | | | | | | | | This option was enabled by default in sqlite3 on 2014-07-03. This setting does nothing. It can now be disabled with SQLITE_DISABLE_FTS3_UNICODE. See the upstream commit: https://sqlite.org/src/info/0cc0230ae9cfc976 I think this change was imported into this project with commit ee9da4840dd680d1fe2927692ea4ab5f8cd7c91c on 2015-06-12.
* sqlite3.go: remove -DSQLITE_DISABLE_INTRINSIC: better builds (#878)Evan Jones2020-11-171-1/+0
| | | | | | | | | | | | | | | | | | | | | | | This "disables the use of compiler-specific built-in functions such as __builtin_bswap32()" (from the SQLite docs) so this change might produce slightly better code. My primary motivation, however, is that the "default" configuration for SQLite, which is widely tested, does not set this preprocessor macro. From looking at Github issues, it appears this was added to avoid a build error on Mac OS X 10.11, in 2017: https://github.com/mattn/go-sqlite3/issues/386 There have been a number of changes to sqlite3 since we tried this last. I think it would be worth trying to remove this setting again. I found a machine running Mac OS X 10.11.6. It was able to build and run the tests in this package with this change. Mac OS X 10.11 is has not been supported by Apple since 2018 (currently Apple is releasing updates for Mac OS 10.13 and newer; 11 is the current release). However, Go 1.14 is supported, and it requires Mac OS X 10.11 or newer: https://golang.org/doc/go1.14 Go 1.15 only supports Mac OS 10.12 and newer: https://golang.org/doc/go1.15
* Support vfs for Open (#877)mattn2020-11-171-1/+11
| | | Closes #876
* Fix "cannot start a transaction within a transaction" issue (#764) (#765)Andrii Zavorotnii2020-08-291-5/+16
| | | | | | | | | | | | | | | | | | | | | * Fix "cannot start a transaction within a transaction" issue [why] If db.BeginTx(ctx, nil) context is cancelled too fast, "BEGIN" statement can be completed inside DB, but we still try to cancel it with sqlite3_interrupt. In such case we get context.Cancelled or context.DeadlineExceeded from exec(), but operation really completed. Connection returned into pool, and returns "cannot start a transaction within a transaction" error for next db.BeginTx() call. [how] Handle status code returned from cancelled operation. [testing] Added unit-test which reproduces issue. * Reduce TestQueryRowContextCancelParallel concurrency [why] Tests times out in travis-ci when run with -race option.
* Use go-pointer instead of uintptr hacks. (#814)mattn2020-08-261-10/+10
| | | | | | | | | | | | | * Use go-pointer instead of uintptr hacks. Fixes #791 * Do same of go-pointer * Drop older verion of Go * Fix build * Fix build
* Enable all prefixes for named parameters and allow for unused named ↵gber2020-05-141-55/+79
| | | | | | | | | | | | | parameters (#811) * Allow unused named parameters Try to bind all named parameters and ignore those not used. * Allow "@" and "$" for named parameters * Add tests for named parameters Co-authored-by: Guido Berhoerster <guido+go-sqlite3@berhoerster.name>
* fix typo in doc comment (#770)rittneje2019-12-171-3/+3
|
* add SystemErrno to Error (#740)rittneje2019-12-171-8/+27
| | | | | | | | * adding SystemErrno to Error, and fixing error logic when open fails * fix for old versions of libsqlite3 that do not have sqlite3_system_errno defined * fixing pre-processor logic
* Merge pull request #744 from azavorotnii/ctx_cancelmattn2019-11-191-37/+59
|\ | | | | Fix context cancellation racy handling
| * Fix context cancellation racy handlingAndrii Zavorotnii2019-09-061-37/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | [why] Context cancellation goroutine is not in sync with Next() method lifetime. It leads to sql.ErrNoRows instead of context.Canceled often (easy to reproduce). It leads to interruption of next query executed on same connection (harder to reproduce). [how] Do query in goroutine, wait when interruption done. [testing] Add unit test that reproduces error cases.
* | Add build constraints for non cgoYasuhiro Matsumoto2019-11-181-1/+1
| |
* | Fix typo in "_locking_mode" DSN handlingAndrii Zavorotnii2019-09-231-1/+1
| |
* | Fix Open() journal mode regressionAndrii Zavorotnii2019-09-231-5/+6
|/ | | | | | | | | | | | | | [why] see https://github.com/mattn/go-sqlite3/issues/607 SQLite default journal mode is DELETE, but forcing it on open causes "database is locked" if other connection exists with WAL mode, for example. [how] Don't set DELETE mode if not set in DSN explicitly. [testing] Run tests in my project where WAL mode is used.
* Fixed operatorG.J.R. Timmer2019-08-221-2/+2
|
* Fix _auth_* parameter checkG.J.R. Timmer2019-08-221-2/+2
| | | Fixes: #724
* Issue #651: Fix of typo=2019-08-191-1/+1
| | | | https://github.com/mattn/go-sqlite3/issues/651
* Fix type of variadicYasuhiro Matsumoto2019-05-101-1/+1
|
* column_type SQLITE_TEXT returned as string by defaultDimitri Roche2019-02-111-8/+1
|
* column types text, varchar, *char return as strings:Dimitri Roche2019-02-111-2/+8
| | | | | | | As opposed to []byte arrays. This brings sqlite closer in line with other dbs like postgres, allowing downstream consumers to assume the scanned value is string across underlying dbs.
* Revert "SQLITE_OPEN_CREATE should be specified for sqlite3_open_v2 if mode ↵Jesse Rittner2018-12-081-16/+6
| | | | | | is not rw" This reverts commit 03b96a53baf1987fe52b653ce0d1817e549259b8.
* SQLITE_OPEN_CREATE should be specified for sqlite3_open_v2 if mode is not rwYasuhiro Matsumoto2018-12-071-6/+16
| | | | | Fixes #667 Fixes #669
* Close db even if sqlite3_open_v2 return non-zero.Yasuhiro Matsumoto2018-12-071-0/+3
|
* Merge pull request #626 from otoolep/fix_data_racemattn2018-11-221-0/+2
|\ | | | | Fix data race in AutoCommit()
| * Fix data race in AutoCommit()Philip O'Toole2018-08-301-0/+2
| | | | | | | | Detected via https://circleci.com/gh/rqlite/rqlite/2223.
* | Merge pull request #643 from akalin/zero-length-blobmattn2018-11-221-1/+1
|\ \ | | | | | | Distinguish between NULL and zero-length blobs on query
| * | Fix bugFrederick Akalin2018-09-221-1/+1
| | |
* | | Merge pull request #644 from akalin/fix-pointer-conversionmattn2018-11-221-7/+2
|\ \ \ | | | | | | | | Clean up blob to byte slice conversion
| * | | Use GoBytesFrederick Akalin2018-09-221-7/+2
| |/ /
* | | Fix misspell issues.Mario Trangoni2018-11-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See, $ gometalinter --vendor --disable-all --enable=misspell ./... sqlite3.go:1379:45:warning: "succesfully" is a misspelling of "successfully" (misspell) sqlite3.go:1390:30:warning: "registerd" is a misspelling of "registered" (misspell) sqlite3_func_crypt.go:16:27:warning: "ceasar" is a misspelling of "caesar" (misspell) sqlite3_func_crypt.go:43:59:warning: "Ceasar" is a misspelling of "Caesar" (misspell) sqlite3_opt_userauth_test.go:450:27:warning: "succesful" is a misspelling of "successful" (misspell) sqlite3_opt_userauth_test.go:456:27:warning: "succesful" is a misspelling of "successful" (misspell)
* | | all: fix cgo compile failures on tipKevin Burke2018-11-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Apparently the cgo typechecks get better on tip, so use C.int instead of Go integers. Build tip as part of the Travis build, so we can ensure that any errors are resolved before they get released to a wider audience.
* | | Rename the wrapper functions to not pollute the sqlite3_* namespaceMura Li2018-10-201-15/+15
| | |