Commit Graph

187 Commits

Author SHA1 Message Date
Xu Xinran 308f5f1b2f Treat []byte{} as empty bytes instead of NULL. 2017-06-14 19:55:09 +08:00
mattn 46e826d22a Merge pull request #407 from zombiezen/foreignkeys
Add _foreign_keys connection parameter
2017-04-02 23:13:39 +09:00
Ross Light c6d43c40e6 Add _foreign_keys connection parameter
Fixes #377
Updates #255
2017-04-01 11:06:59 -07:00
Ross Light 4c2dc8806a Avoid leaking db if setting busy timeout fails 2017-04-01 08:53:17 -07:00
Marko Kungla a1253acb6b
Removed ambitious conn.Close() 2017-03-24 01:06:55 +01:00
Yasuhiro Matsumoto fc03fa9989 close connection when got errors in Open 2017-03-24 08:48:29 +09:00
Yasuhiro Matsumoto 866c3293d9 fix breaking compatibility.
revert cf4bd560f1

close #394
2017-03-21 09:14:48 +09:00
Yasuhiro Matsumoto 0acd8f7aec fix build 2017-03-20 23:34:57 +09:00
Yasuhiro Matsumoto 997cab8094 fix build 2017-03-20 23:31:22 +09:00
Yasuhiro Matsumoto cf4bd560f1 fix build 2017-03-20 23:26:15 +09:00
Yasuhiro Matsumoto 53900fb4f0 return nil when last error is SQLITE_OK 2017-03-20 23:23:24 +09:00
Yasuhiro Matsumoto 32ab0d8730 refactoring 2017-03-05 22:16:51 +09:00
Conor Branagan bba480975b Add Go API for virtual tables
See https://www.sqlite.org/vtab.html for more details.

This work was started from
https://github.com/gwenn/gosqlite/blob/master/vtab.{c,go} and adds:

- Porting the API to go-sqlite3 APIs.
- Support for >= Go 1.6 without requiring the `cgocheck` flag to be changed.
- Filling out the unfinished callback functions for the `Vtable` struct.
- A simple `Context` API layer for ease of use when adding modules.

Tests are included.
2017-03-04 18:10:02 -05:00
Yasuhiro Matsumoto 253bbf431d rename function 2017-03-05 00:45:41 +09:00
Yasuhiro Matsumoto a7b54c9ddb workaround for a compiler
Apple LLVM version 7.0.2 (clang-700.1.81)

Close #386
2017-03-01 16:44:54 +09:00
Yasuhiro Matsumoto 2acfafad58 use variable db 2017-02-16 15:57:29 +09:00
Yasuhiro Matsumoto 588cd3292b fixes race 2017-02-11 21:48:33 +09:00
Yasuhiro Matsumoto a554cf198f close statement 2017-01-07 22:22:02 +09:00
Yasuhiro Matsumoto 6f2749a3ca fix race condition 2017-01-03 22:25:02 +09:00
Yasuhiro Matsumoto 056f235aa6 fix named args 2016-12-09 13:12:14 +09:00
Yasuhiro Matsumoto f043f8092b use prepare instead of Prepare 2016-11-09 01:13:34 +09:00
Yasuhiro Matsumoto d1009b4fa6 fix build 2016-11-08 17:12:03 +09:00
Yasuhiro Matsumoto bfeda3f4f6 fix build 2016-11-08 17:07:52 +09:00
Yasuhiro Matsumoto ea2afbe9e8 revert Multiple Result Set 2016-11-08 13:22:46 +09:00
Yasuhiro Matsumoto dc448a0cb6 fix trace callback. 2016-11-08 12:27:31 +09:00
Yasuhiro Matsumoto dd2c82226b fix trace callback.
Close #352
2016-11-08 12:19:51 +09:00
andrefsp 6c0a6bb9cd Fix data race introduced on 605d9d08
This commit will fix a data race introduced on 605d9d08 and also
make sure travis CI will now check for data races.
2016-11-07 11:57:52 +00:00
Yasuhiro Matsumoto deed33aec7 cancel 2016-11-06 20:46:27 +09:00
Yasuhiro Matsumoto 605d9d0851 cancel 2016-11-06 20:43:53 +09:00
Yasuhiro Matsumoto 0d1d1a644e go vet && golint 2016-11-05 00:40:06 +09:00
Yasuhiro Matsumoto 755d5be32c add BeginContext 2016-11-04 15:15:16 +09:00
Yasuhiro Matsumoto 025b917610 add PrepareContext 2016-11-04 15:11:24 +09:00
Yasuhiro Matsumoto b23526fb3c support named params 2016-11-04 15:00:29 +09:00
Yasuhiro Matsumoto c95a77965c context features 2016-11-04 14:24:22 +09:00
Yasuhiro Matsumoto 86681de00a remove -Wno-c99-extension
Close #343
2016-10-28 23:22:18 +09:00
Judson 61c9552d18
Added CFLAG config to ignore deprecations 2016-10-04 16:51:54 +01:00
Yasuhiro Matsumoto bf2cfc371a fix build 2016-09-08 00:59:25 +09:00
Yasuhiro Matsumoto 467e3720d8 fix build 2016-09-08 00:39:47 +09:00
A.N 0a2fcd29b6 Provide access to sqlite3_trace_v2(). 2016-09-07 23:48:06 +09:00
mattn e118d44513 Merge pull request #300 from sqweek/issue184
Fix inconsistent tx state with database/sql.
2016-07-15 22:38:49 +09:00
Zbigniew Mandziejewicz 3ebb821e65 Set SQLITE_DETERMINISTIC if undefined 2016-04-23 00:00:49 +08:00
sqweek 727ad200a2 Fix inconsistent tx state with database/sql.
The semantics of sql.Tx.Commit impose that the transaction is
finished and cleaned up by the time the driver's Commit function
returns. However sqlite3 leaves the transaction open if COMMIT
fails due to an SQLITE_BUSY error, so *we* must clean it up.

Closes #184.
2016-04-18 21:47:24 +08:00
David Bariod 3a5555302e Move sqlite3 amalgation files a directory up.
The purpose is to ease the use of vendoring files like godep.
The C sqlite3 files have been added a go compilation conditional flag
Fix #293
2016-04-02 12:48:26 +02:00
Zac Medico f544db98cc Add SQLiteRows.DeclTypes() method 2016-03-06 12:27:17 -08:00
Philip O Toole 1e280555b7 Fix minor typos in comments 2016-02-23 01:26:13 -05:00
mattn c5aee96497 Merge pull request #267 from ianlancetaylor/go16
bind: pass &v[0] in direct call to C
2016-02-01 14:34:37 +09:00
Ian Lance Taylor 8c66b9cf5e callback: use handles rather than passing Go pointers
The cgo pointer passing rules forbid passing a Go pointer to C if that
pointer points to memory containing other Go pointers.  This is true
even if the Go pointer is converted to uintptr.

This change fixes the code to use a handle instead, and to look up the
handle in the callback function.
2016-01-29 13:18:39 -08:00
Ian Lance Taylor b76c61051f bind: pass &v[0] in direct call to C
In Go 1.6, the cgo checking rules are more precise when they see an
address operation as an argument to the C function.  When you pass &v[0]
to a C function, the cgo check just verifies that v itself does not
contain any pointers.  When you write `p := &v[0]` and then pass p to
the C function, the cgo check is conservative: it verifies that the
entire memory block to which p points does not contain any pointers.
When the bind function is called by code that passes a slice that is
part of a larger struct, this means that the cgo check will look at the
entire larger struct, not just the slice.  This can cause a surprising
run time failure.

Avoid this problem by rewriting the code slightly to pass &v[0] in the
call to the C function itself.

In particular this fixes the tests of github.com/jmoiron/sqlx when using
Go 1.6.
2016-01-29 12:39:47 -08:00
Yasuhiro Matsumoto e969434e25 avoid cgoCheckPointer. ref https://github.com/golang/go/issues/12416 2015-12-30 23:29:15 +09:00
Yasuhiro Matsumoto a755cdc361 Merge branch 'master' of https://github.com/mattn/go-sqlite3 2015-11-02 11:56:57 +09:00