Commit Graph

452 Commits

Author SHA1 Message Date
Christian Brauner 420dc664ed
upgrade: add ifdefines
This makes it possible to correctly link against the system sqlite. Also, don't
use defers with log.Fatal() since they won't be run on exit.

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
2016-10-28 10:28:19 +02:00
Christian Brauner f6e7921d24
actually link to <sqlite3.h> when -tags libsqlite3
Building with -tags libsqlite3 used the sqlite3.h from the system but the go
compiler will compile all *.{c,h} files in the same direcory:

	"When the Go tool sees that one or more Go files use the special import
	"C", it will look for other non-Go files in the directory and compile
	them as part of the Go package. Any .c, .s, or .S files will be compiled
	with the C compiler." (https://golang.org/cmd/cgo/)

So if users actually want to link against the system sqlite3 we should make
sqlite3-binding.* a noop.

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
2016-10-28 10:28:17 +02:00
mattn 955dae4ebd Merge pull request #345 from joeshaw/backup-finalizer-fix
fix double free in SQLiteBackup.Close() on error
2016-10-28 08:55:17 +09:00
Joe Shaw bdab31cc98 fix double free in SQLiteBackup.Close() on error
The sqlite3_backup_finish() function never fails, it just returns the
error code from previous operations.  Previously if it returned an
error, the finalizer wouldn't be unset and sqlite3_backup_finish() would
be run again on an already-finished backup.  This results in a
double-free and often segfaults.

The error handling is described in more detail in the "Error handling"
section of https://www.sqlite.org/backup.html.
2016-10-27 16:44:56 -07:00
mattn e5a3c16c5c Merge pull request #333 from nyarly/master
Added CFLAG config to ignore deprecations
2016-10-05 01:01:36 +09:00
Judson 61c9552d18
Added CFLAG config to ignore deprecations 2016-10-04 16:51:54 +01:00
mattn 4b0af852c1 Merge pull request #331 from a-p-/test-backup-error
Test the error reporting when preparing to perform a backup.
2016-09-27 11:28:46 +09:00
a-p- 0e686cadf6 Test the error reporting when preparing to perform a backup. 2016-09-23 08:41:32 -04:00
Yasuhiro Matsumoto 3fb7a0e792 TestAggregatorRegistration may fail if trace feature is not implemented 2016-09-08 01:20:43 +09:00
Yasuhiro Matsumoto 0cc5236296 add tracecallback_noimpl.go 2016-09-08 01:13:15 +09:00
Yasuhiro Matsumoto e63ddcaa1a wrapper is not needress when not use libsqlite3 2016-09-08 01:00:36 +09: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
Yasuhiro Matsumoto 2bc6ac72c0 fix build 2016-09-08 00:30:54 +09:00
Yasuhiro Matsumoto a8bf79c7d7 Merge branch 'master' into trace 2016-09-08 00:15:31 +09:00
Yasuhiro Matsumoto 6f7ceed867 test of backup is too long 2016-09-08 00:15:10 +09:00
A.N 17a684694a Example program for the new SetTrace()
Does INSERT, then SELECT on the inserted rows (in-memory database).
The purpose of all these is to cause activity so there will be trace
messages to display. Trace message formatting is included
(a useful format, with explanations).
2016-09-07 23:48:36 +09:00
A.N 2b0a8971e3 Remove obsolete comment
The implementation which caused it was abandoned before first commit.
2016-09-07 23:48:27 +09:00
A.N 911ebeea74 TraceInfo: fix RunTimeNanosec retrieval, add AutoCommit
Also change type of EventCode to uint32 so adding AutoCommit
is "free" = does not enlarge the TraceInfo struct.
32 bits are more than enough, since only 4 (four) are used now.
2016-09-07 23:48:17 +09:00
A.N 0a2fcd29b6 Provide access to sqlite3_trace_v2(). 2016-09-07 23:48:06 +09:00
mattn e87c35082b Merge pull request #323 from FiloSottile/master
Make Go 1.7 fail compilation without cgo
2016-09-04 09:19:41 +09:00
Filippo Valsorda 98981b4a3b Make Go 1.7 fail compilation
The package is useless without cgo, but Go 1.7 will happily build it
since doc.go is a pure-Go file, even if CGO_ENABLED=0, like when
cross-compiling.

This is particularly problematic since the package is usually imported
for its side effects, and users would successfully build a broken binary.

Workaround golang/go#16981
2016-09-03 20:02:56 +01:00
mattn b5c99a7203 Merge pull request #322 from a-p-/backup-tests
Add some testing of the backup functionality.
2016-08-21 16:55:01 +09:00
a-p- 3a5d0a7e5b Add some testing of the backup functionality. 2016-08-20 18:57:12 -04:00
Yasuhiro Matsumoto c3e9588849 Close file 2016-08-11 18:51:38 +09:00
Yasuhiro Matsumoto 5a7763c649 add upgrade.go 2016-08-11 18:43:56 +09:00
Yasuhiro Matsumoto 5176d6e6cb add *.o 2016-08-11 18:43:49 +09:00
Yasuhiro Matsumoto ee996d6946 use amalgamation 3.14.0 2016-08-11 01:47:31 +09:00
Yasuhiro Matsumoto 297d6f8d2d update amalgamation code 2016-08-11 01:15:52 +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
mattn 38ee283dab Merge pull request #304 from steffengy/master
upgrade sqlite amalgamation to 3.12.2
2016-05-14 21:23:48 +09:00
Steffen 5505c7c92e upgrade sqlite amalgamation to 3.12.2 2016-05-14 11:53:28 +02:00
mattn 7204887cf3 Merge pull request #302 from shaxbee/master
Build with libsqlite3 on Ubuntu 14.04 LTS
2016-05-03 09:00:58 +09:00
Zbigniew Mandziejewicz 42d411769d Bump Travis to Ubuntu 14.04 2016-04-23 00:00:50 +08:00
Zbigniew Mandziejewicz 9f06636f8c FTS4 is not available on Trusty 2016-04-23 00:00:49 +08:00
Zbigniew Mandziejewicz c8316feaa3 Test with libsqlite3 2016-04-23 00:00:49 +08:00
Zbigniew Mandziejewicz 3ebb821e65 Set SQLITE_DETERMINISTIC if undefined 2016-04-23 00:00:49 +08:00
mattn 467f50b0c0 Merge pull request #299 from shaxbee/master
Build and docs for libsqlite3 on OS X
2016-04-19 10:33:13 +09: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
Zbigniew Mandziejewicz e8363dc691 Instructions for libsqlite3 on OS X 2016-04-18 20:21:32 +08:00
Zbigniew Mandziejewicz bce6ca7501 Disable LoadExtension when omit_load_extension is specified 2016-04-18 20:21:32 +08:00
Zbigniew Mandziejewicz 4bc448f79b Disable LoadExtension when omit_load_extension is specified 2016-04-18 19:58:56 +08:00
mattn 22d73514b2 Merge pull request #298 from shaxbee/master
Expose LoadExtension with entry point
2016-04-18 19:38:27 +09:00
Zbigniew Mandziejewicz da9decb965 Expose LoadExtension with entry point 2016-04-18 17:05:50 +08:00
Yasuhiro Matsumoto 0d708316a6 delete needless files 2016-04-18 01:11:20 +09:00
mattn f8a41b9e6e Merge pull request #294 from dgsb/master
Move sqlite3 amalgation files a directory up.
2016-04-18 01:10:19 +09:00
mattn aeb3180df5 Merge pull request #296 from stanim/errs
add missing error checks in simple example
2016-04-15 17:44:20 +09:00
Stani ed21175288 add missing error checking to simple example 2016-04-14 20:56:02 +02: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
mattn 37aa7c6f5b Merge pull request #291 from diocles/patch-1
Fix sqlite "regexp" function name in documentation
2016-03-25 01:18:33 +09:00