Commit Graph

343 Commits

Author SHA1 Message Date
Philip O'Toole 960d6a342a Alphabetical imports 2016-02-28 11:51:49 -08:00
mattn 09d5c45171 Merge pull request #275 from otoolep/fix_typos
Fix minor typos in comments
2016-02-23 16:32:46 +09: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
mattn 57d9aeb35a Merge pull request #268 from ianlancetaylor/handle
callback: use handles rather than passing Go pointers
2016-01-31 23:50:31 +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
mattn 0cc1174c16 Merge pull request #266 from tcyrus/patch-1
Update README.md
2016-01-29 10:38:29 +09:00
Timothy Cyrus 298ea4316b Update README.md
Changed PNG Badges to SVG and Added GoDoc Badge
2016-01-28 20:28:43 -05:00
Vladimir Timofeev f33c9767fb Upgrade sqlite amalgamation to latest 3.10.2 2016-01-22 13:15:37 +03:00
Vladimir Timofeev 5f58255164 Upgrade sqlite amalgamation to latest 3.10.1 2016-01-22 13:15:26 +03:00
mattn 5510da3995 Merge pull request #262 from keybase/master
Fix compile for old mingw32
2015-12-30 23:39:53 +09:00
Yasuhiro Matsumoto e969434e25 avoid cgoCheckPointer. ref https://github.com/golang/go/issues/12416 2015-12-30 23:29:15 +09:00
Taru Karttunen 61be132244 Fix compile for old mingw32 2015-12-30 00:19:24 +02:00
mattn 5651a9d9d4 Merge pull request #252 from marcelolima/master
Fix README project address
2015-11-06 23:54:04 +09:00
Marcelo Lima 0ad9f0ce2f Fix README project address 2015-11-06 11:23:34 -03:00
mattn 2513631704 Merge pull request #251 from larsmans/fixes
Clean up tempfiles in tests
2015-11-03 22:05:16 +09:00
Lars Buitinck 21637a6531 Clean up tempfiles in tests
"go test" leaves no more clutter in /tmp.
2015-11-03 13:52:28 +01:00
Yasuhiro Matsumoto a755cdc361 Merge branch 'master' of https://github.com/mattn/go-sqlite3 2015-11-02 11:56:57 +09:00
Yasuhiro Matsumoto 59f20de728 fix tests 2015-11-02 11:56:49 +09:00
Yasuhiro Matsumoto 167173a31f Merge branch 'pr/207' 2015-11-02 11:53:42 +09:00
mattn 80ee1ba77c Merge pull request #243 from augustoroman/master
Store/retrieve timezones for time.Time values.
2015-11-02 11:43:53 +09:00
mattn 008acb738c Merge pull request #250 from DavidGamba/install-in-readme
Update README. Install go-sqlite3 to avoid builds with gcc
2015-11-02 11:38:41 +09:00
David Gamba 90af0d5722 Update README. Install go-sqlite3 to avoid builds with gcc 2015-10-31 00:59:28 -06:00
Augusto Roman 7b0d180ce9 Store/retrieve timezones for time.Time values.
Previously, the timezone information for a provided value was discarded
and the value always stored as in UTC.  However, sqlite allows specifying
the timezone offsets and handles those values appropriately.  This change
stores the timezone information and parses it out if present, otherwise
it defaults to UTC as before.

One additional bugfix:  Previously, a unix timestamp in seconds was
parsed in the local timezone (rather than UTC), in contrast to a unix
timestamp in milliseconds that was parsed in UTC.

While fixing that extra bug, I cleaned up the parsing code -- no need to
convert to a string and then parse it back again and risk a parse error,
just to check the number of digits.

The tests were extended to cover non-UTC timezones storage & retrieval,
meaningful unix timestamps, and correct handling of a trailing Z.
2015-10-09 22:59:25 -07:00
looi b808f01f66 Add FTS4 unicode61 tokenizer support 2015-09-21 19:53:44 +09:00
Yasuhiro Matsumoto 0d2359b64f fix #238 2015-09-16 15:58:07 +09:00
Yasuhiro Matsumoto fdc70a0fab use math.MaxInt32. related issue #238 2015-09-16 15:22:36 +09:00
Yasuhiro Matsumoto 09259a5557 fix build on 32bit OSs. Close #238 2015-09-16 15:18:46 +09:00
Yasuhiro Matsumoto 64bb935391 remove binary file 2015-09-16 10:47:42 +09:00
mattn 0bb7f1c676 Merge pull request #229 from danderson/master
Implement support for calling Go functions from SQLite
2015-09-16 10:46:17 +09:00
David Anderson 26917df7a6 Implement support for aggregation functions implemented in Go. 2015-09-15 18:05:49 -07:00
mattn 3b3f1d01b2 Merge pull request #235 from jfrazelle/static_remove_dlopen
remove dlopen if static_build flag
2015-09-05 23:49:54 +09:00
Jessica Frazelle e37121d4ea introduce ability to pass sqlite_omit_load_extension
sqlite_omit_load_extension is a go build tag which behaves much like its
C counterpart SQLITE_OMIT_LOAD_EXTENSION

Signed-off-by: Jessica Frazelle <acidburn@docker.com>
2015-09-04 14:46:16 -07:00
mattn 897b8800a7 Merge pull request #231 from marccampbell/master
Fix example to check the correct error value
2015-08-26 01:33:44 +09:00
mattn 296ddf7cd7 Fix test. Close #216
When one goroutine close db that opended as :memory:, session
will be lost. So another goroutine can't refer the last session.
goroutine .
2015-08-25 23:40:01 +09:00
Marc Campbell 5532d1d5ac Fix example to check the correct error value 2015-08-24 17:19:04 -07:00
David Anderson b037a61690 Add support for interface{} arguments in Go SQLite functions.
This enabled support for functions like Foo(a interface{}) and
Bar(a ...interface{}).
2015-08-21 17:12:18 -07:00
David Anderson 566f63a43a Implement support for variadic functions.
Currently, the variadic part must all be the same type, because there's
no "generic" arg converter.
2015-08-21 16:38:23 -07:00
David Anderson 122ddb16de Move argument converters to callback.go, and optimize return value handling.
A call now doesn't have to do any reflection, it just blindly invokes
a bunch of argument and return value handlers to execute the translation,
and the safety of the translation is determined at registration time.
2015-08-21 16:37:45 -07:00
David Anderson cf8fa0af80 Implement support for passing Go functions as custom functions to SQLite.
Fixes #226.
2015-08-21 13:39:50 -07:00
mattn 8897bf1452 Merge pull request #228 from whiter4bbit/added_icu_support
added icu extension support
2015-08-20 09:54:08 +09:00
Pavel Zalunin 715f5e5de0 added icu extension support 2015-08-20 03:02:59 +03:00
mattn 3dc190a017 Merge pull request #227 from gmarik/patch-1
remove duplicated Close
2015-08-17 08:47:45 +09:00
gmarik 94efba9292 remove duplicated Close
since there's one already at line 51
2015-08-16 16:39:53 -04:00
mattn 0fa27b5cb0 Merge pull request #225 from kiwih/master
Fix for go-sqlite3 truncating 64-bit lastInsertIDs on 32-bit systems
2015-08-07 12:25:09 +09:00
kiwih 6b4ee3cb4f Add fix for go-sqlite3 truncating 64-bit integers when compiled by 32-bit mingw-gcc on windows by converting 'long' variable types to 'long long' in sqlite3.go 2015-08-07 15:13:52 +12:00
Yasuhiro Matsumoto b4142c444a update README.md 2015-06-30 08:57:28 +09:00
Yasuhiro Matsumoto ee9da4840d hack to use libsqlite3
$ go build -tags "libsqlite3 windows"
2015-06-12 13:26:42 +09:00
Lars Buitinck 1ae6ca764d Cosmetics: use WaitGroup instead of channel in test 2015-06-05 16:38:51 +02:00