Merge pull request #564 from GJRTimmer/fix/213

Fix #213
tree: 0f8a0d339d9e0339299598287917cccd1427c060
  1. _example/
  2. tool/
  3. .gitignore
  4. .travis.yml
  5. backup.go
  6. backup_test.go
  7. callback.go
  8. callback_test.go
  9. doc.go
  10. error.go
  11. error_test.go
  12. LICENSE
  13. README.md
  14. sqlite3-binding.c
  15. sqlite3-binding.h
  16. sqlite3.go
  17. sqlite3_context.go
  18. sqlite3_fts3_test.go
  19. sqlite3_fts5.go
  20. sqlite3_go18.go
  21. sqlite3_go18_test.go
  22. sqlite3_icu.go
  23. sqlite3_json1.go
  24. sqlite3_libsqlite3.go
  25. sqlite3_load_extension.go
  26. sqlite3_omit_load_extension.go
  27. sqlite3_other.go
  28. sqlite3_solaris.go
  29. sqlite3_test.go
  30. sqlite3_trace.go
  31. sqlite3_type.go
  32. sqlite3_vtable.go
  33. sqlite3_vtable_test.go
  34. sqlite3_windows.go
  35. sqlite3ext.h
  36. static_mock.go
README.md

go-sqlite3

GoDoc Reference Build Status Coverage Status Go Report Card

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, after you have built and installed go-sqlite3 with go install github.com/mattn/go-sqlite3 (which requires gcc), you can build your app without relying on gcc in future.

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 libsqlite3 on OS X.

    Install sqlite3 from homebrew: brew install sqlite3

    Use go build --tags "libsqlite3 darwin"

  • Want to build go-sqlite3 with icu extension.

    Use go build --tags "icu"

    Available extensions: json1, fts5, 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: #27

  • Getting insert error while query is opened.

    You can pass some arguments into the connection string, for example, a URI. See: #39

  • Do you want to cross compile? mingw on Linux or Mac?

    See: #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 like file:foo.db?_loc=auto.

  • Can I use this in multiple routines concurrently?

    Yes for readonly. But, No for writable. See #50, #51, #209, #274.

  • Why is it racy if I use a sql.Open("sqlite3", ":memory:") database?

    Each connection to :memory: opens a brand new in-memory sql database, so if the stdlib‘s sql engine happens to open another connection and you’ve only specified “:memory:”, that connection will see a brand new database. A workaround is to use “file::memory:?mode=memory&cache=shared”. Every connection to this string will point to the same in-memory database. See #204 for more info.

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 an amalgamation of code that was copied from SQLite3. The license of that code is the same as the license of SQLite3.

Author

Yasuhiro Matsumoto (a.k.a mattn)