b76c61051f
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. |
||
---|---|---|
_example | ||
code | ||
sqlite3_test | ||
.gitignore | ||
.travis.yml | ||
LICENSE | ||
README.md | ||
backup.go | ||
callback.go | ||
callback_test.go | ||
doc.go | ||
error.go | ||
error_test.go | ||
sqlite3-binding.c | ||
sqlite3-binding.h | ||
sqlite3.go | ||
sqlite3_fts3_test.go | ||
sqlite3_icu.go | ||
sqlite3_libsqlite3.go | ||
sqlite3_load_extension.go | ||
sqlite3_omit_load_extension.go | ||
sqlite3_other.go | ||
sqlite3_test.go | ||
sqlite3_windows.go |
README.md
go-sqlite3
Description
sqlite3 driver conforming to the built-in database/sql interface
Installation
This package can be installed with the go get command:
go get github.com/mattn/go-sqlite3
go-sqlite3 is cgo package.
If you want to build your app using go-sqlite3, you need gcc.
However, if you install go-sqlite3 with go install github.com/mattn/go-sqlite3
, you don't need gcc to build your app anymore.
Documentation
API documentation can be found here: http://godoc.org/github.com/mattn/go-sqlite3
Examples can be found under the ./_example
directory
FAQ
-
Want to build go-sqlite3 with libsqlite3 on my linux.
Use
go build --tags "libsqlite3 linux"
-
Want to build go-sqlite3 with icu extension.
Use
go build --tags "icu"
-
Can't build go-sqlite3 on windows 64bit.
Probably, you are using go 1.0, go1.0 has a problem when it comes to compiling/linking on windows 64bit. See: https://github.com/mattn/go-sqlite3/issues/27
-
Getting insert error while query is opened.
You can pass some arguments into the connection string, for example, a URI. See: https://github.com/mattn/go-sqlite3/issues/39
-
Do you want cross compiling? mingw on Linux or Mac?
See: https://github.com/mattn/go-sqlite3/issues/106 See also: http://www.limitlessfx.com/cross-compile-golang-app-for-windows-from-linux.html
-
Want to get time.Time with current locale
Use
loc=auto
in SQLite3 filename schema likefile:foo.db?loc=auto
.
License
MIT: http://mattn.mit-license.org/2012
sqlite3-binding.c, sqlite3-binding.h, sqlite3ext.h
The -binding suffix was added to avoid build failures under gccgo.
In this repository, those files are amalgamation code that copied from SQLite3. The license of those codes are depend on the license of SQLite3.
Author
Yasuhiro Matsumoto (a.k.a mattn)