Commit Graph

772 Commits

Author SHA1 Message Date
mattn 65fd601635 add example code using bulk insert. 2012-12-26 09:53:22 +09:00
mattn acf6044aaf No return error when invalid datetime. 2012-12-26 09:52:55 +09:00
mattn 7ea7c83912 use fmt.Println() 2012-12-07 20:36:57 +09:00
mattn b758711b08 fixed last_id/changes. it seems long alignment values. 2012-12-07 12:58:08 +09:00
Dobrosław Żybort 430103cc9e Add support for extracting `2006-01-02 15:04:05.000` formatted datetime. 2012-11-29 13:26:24 +01:00
mattn 68952ca066 Merge pull request #28 from lye/master
Add support for extracting 2006-01-02 formatted timestamps.
2012-11-04 16:06:42 -08:00
lye dcd44f5118 Add support for extracting 2006-01-02 formatted timestamps.
SQLite3 stores timestamps very naively -- they're completely untyped,
and can contain any value. The previous implementation always inserts
values in the 'datetime' format, and returns an error when attempting to
extract a field with a different format.

Some legacy databases, unfortunately, were generated using the 'date'
SQLite3 function, which produces rows in the '2006-01-02' format. This
patch adds a special case so that these rows can be extracted without
error.
2012-11-03 19:45:58 -05:00
mattn 76996feb52 Merge pull request #26 from cookieo9/noexample
Travis-CI simplification
2012-10-28 23:18:26 -07:00
Carlos Castillo e50d79429a Switched example back to mattn's repo. 2012-10-28 22:28:49 -07:00
Carlos Castillo eed762d437 Updated to newer go support in travis-ci. It is both simpler and should test faster. 2012-10-28 22:24:18 -07:00
Carlos Castillo e3d45986c8 Merge branch 'master' of https://github.com/mattn/go-sqlite3 2012-10-28 22:19:43 -07:00
mattn 6134963aff Merge pull request #25 from cookieo9/noexample
Modified for Windows support.
2012-10-28 17:15:24 -07:00
Carlos Castillo df5b1dfca6 Modified example to use local version of package instead of mattn's. 2012-10-27 20:20:29 -07:00
Carlos Castillo 58cfe6309d Modified for windows support. 2012-10-27 19:58:40 -07:00
mattn 629fe17ada Merge pull request #24 from jgallagher/master
Fix invalid memory read in Close()
2012-10-15 19:49:08 -07:00
John Gallagher a76fd8f336 Fix read of invalid (already freed) memory. 2012-10-15 20:57:32 -04:00
mattn b9ff6f3fd3 'is' does not work in some older sqlite3. 2012-09-12 11:43:54 +09:00
mattn d05555a677 workaround on windows. currently, int64 does not work correctly. 2012-09-12 11:43:37 +09:00
mattn 8d4548d72c Merge pull request #22 from cdsks/master
Fix sql.DB leaks in unit tests so that tests pass on vmware hgfs
2012-09-11 17:13:11 -07:00
cds 2a36f8cd42 Replace t.Error(); return statement pairs with single t.Fatal() 2012-09-11 10:13:11 -05:00
cds 40b65367c5 Added missing db.Close() and rows.Close() calls; fixes tests on vmhgfs filesystems.
Individual tests were never successfully removing 'foo.db' (the error was ignored), which caused everything but the first test to fail on my vmhgfs filesystem.  Adding the relevant defer db.Close() and rows.Close() calls fixed the leaks, enabling os.Remove() to work.
2012-09-11 09:23:21 -05:00
cds 54826d9585 Fix erroneous error message for sql.Open() 2012-09-11 08:41:45 -05:00
cds 3456489fa1 gofmt + fix erroneous t.Errorf("foo:", err) statements to t.Error("foo:", err) .
Original:
--- FAIL: TestInsert (0.00 seconds)
	sqlite3_test.go:42: Failed to create table:%!(EXTRA *errors.errorString=unable to open database file)

With corrections:
--- FAIL: TestInsert (0.00 seconds)
	sqlite3_test.go:42: Failed to create table: unable to open database file
2012-09-11 08:35:53 -05:00
mattn 3ae2f4307c Merge pull request #19 from leskets/master
bug fix: Byte slice results belong to the caller and so must be copies.
2012-08-21 09:23:37 -07:00
Thomas Leske a4e5e7a617 bug fix: Byte slices belong to the caller and so must be copies.
With the exeption of slices in the result type sql.RawBytes,
new calls to Sqlite must not corrupt slices.
2012-08-20 17:20:58 +02:00
mattn 8f1b649756 Merge pull request #18 from coolaj86/patch-1
MacPorts -> Homebrew
2012-08-06 17:00:48 -07:00
AJ ONeal 080d45fdc2 MacPorts -> Homebrew
Nobody should be using MacPorts anymore.
2012-08-06 17:24:53 -06:00
mattn f7f964e7ea Merge pull request #17 from amattn/master
update to README file
2012-07-09 01:10:01 -07:00
amattn 28bd73b5c3 Readme update 2012-07-08 16:45:22 -07:00
mattn a407c70cfd Merge pull request #15 from jander/master
Handle bool values with "BOOLEAN" columns.
2012-05-27 18:14:31 -07:00
jander d869678d3c Update sqlite3_test.go 2012-05-27 00:13:36 +08:00
jander 2f4a8f3f2c Update sqlite3_test.go 2012-05-27 00:10:29 +08:00
jander ed17eae07a fix TestBoolean 2012-05-27 00:09:12 +08:00
jander 1bfaa5b7d2 add bool type test: TestBoolean 2012-05-25 23:16:03 +08:00
jander 6865865265 Handle bool values with "BOOLEAN" columns. 2012-05-25 17:01:03 +08:00
mattn d9c069459a remove Makefile. 2012-05-15 20:49:45 +09:00
mattn 78a8e6baac remove Makefile. 2012-05-15 20:49:11 +09:00
mattn ea2c1e7a8c Merge pull request #12 from jgallagher/master
Minor tweaks, plus add support for "timestamp" columns.
2012-05-15 04:43:57 -07:00
John Gallagher db2c00ccd8 Increase busy timeout to 5 seconds.
500ms is short enough that go-sql-test sometimes fails with "database
locked", and it's the value used by Python's sqlite3 driver.
2012-04-07 00:37:02 -04:00
John Gallagher 3abc337b8e Handle time.Time values with "timestamp" columns. 2012-04-07 00:29:24 -04:00
John Gallagher e85c34cf5c Fix typo (Tailed -> Failed). 2012-04-06 22:46:11 -04:00
mattn 5691b2a3f4 add travis recepi. 2012-03-30 00:39:03 +09:00
mattn 08b7452f81 update. 2012-03-29 12:48:11 +09:00
mattn bba2094288 updated doc. 2012-03-29 12:46:32 +09:00
mattn 224815d665 merged #11
close #11
2012-03-12 14:20:55 +09:00
Sven Engelhardt 81a88cec73 database/sql expects io.EOF after all rows have been Next'ed
Return io.EOF, so rows.Next() will automatically call rows.Close()
after all results have been returned.
2012-03-02 09:06:56 +09:00
mattn fdc20cdbcb add example of Prepare()/QueryRow(). add db.Close(). close #7 2012-02-23 14:30:50 +09:00
mattn 8cbe65c9c3 merged bradfitz's patch. thanks. 2012-02-20 16:14:49 +09:00
mattn 93ab2db408 Merge pull request #6 from lye/master
Fix marshaling error in Go->SQLite boolean values
2012-02-06 20:19:51 -08:00
lye 3524ead0a5 For boolean values, marshal true to SQLite 1, not -1
SQLite stores boolean values as an integer, serializing true as 1 and
false as 0 [1], but it does not actually enforce this range. To match
the documentation (and fix the broken test case), this patch makes a Go
boolean true serialize properly to 1.

[1] http://www.sqlite.org/datatype3.html
2012-02-06 22:59:24 +00:00