Commit Graph

177 Commits

Author SHA1 Message Date
Micah Stetson 58c4612c1e Fix #33 and #34 2012-12-29 14:20:27 -08:00
mattn f86c8f208d check destination type whether it's *time.Time or not. 2012-12-26 10:01:39 +09:00
mattn acf6044aaf No return error when invalid datetime. 2012-12-26 09:52:55 +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
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
Carlos Castillo 58cfe6309d Modified for windows support. 2012-10-27 19:58:40 -07:00
John Gallagher a76fd8f336 Fix read of invalid (already freed) memory. 2012-10-15 20:57:32 -04:00
mattn d05555a677 workaround on windows. currently, int64 does not work correctly. 2012-09-12 11:43:37 +09: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
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
jander 6865865265 Handle bool values with "BOOLEAN" columns. 2012-05-25 17:01:03 +08: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
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 8cbe65c9c3 merged bradfitz's patch. thanks. 2012-02-20 16:14:49 +09: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
Scott Lawrence f082596746 Fixing build at tip 2012-01-20 11:44:24 -05:00
Alien Science 5d9fdcab93 Fixed double free when closing SQLiteStmt
Rows should not close the statement because Stmt has its own close
function. This caused a double free error/crash on Fedora 16 x86_64.
2012-01-19 20:26:09 +01:00
lye 6a23a746e1 Use pkg-config instead of a hardcoded LDFLAGS 2012-01-10 00:16:34 +00:00
Sven Engelhardt 01566134d1 allow to insert zero-length strings into database
&b[0] fails with an index out-of-bounds error for a slice with len()==0
2011-12-02 23:32:38 +01:00
mattn fdbb364aba fix LastInsertId()/RowsAffected(). 2011-11-15 11:03:31 +09:00
mattn 7211b7212b last inserted row ID, affected rows. 2011-11-14 22:10:13 +09:00
mattn 650166a9cf clean 2011-11-14 10:09:46 +09:00
mattn 0b35f58e9d gofmt. 2011-11-11 21:38:53 +09:00
mattn 6c2d2c4b6b first import. 2011-11-11 21:36:22 +09:00