Commit Graph

30 Commits

Author SHA1 Message Date
mattn d4673cd31c Implements Execer 2013-09-09 10:44:44 +09:00
mattn 77c9648f4a Fixes test 2013-09-03 19:40:18 +09:00
mattn 6176b90b70 Add tests 2013-09-03 19:36:33 +09:00
Jochen Voss ff8e6729ce Start work on introducing machine-readable error codes.
This commit introduces a new type 'ErrNo', implementing the error
interface.  Constants for all sqlite3 error codes are provided
in the new source file "error.go".
2013-08-13 21:45:05 +09:00
Graeme Connell 9c24784fe1 Use file in os.TempDir() for tests.
Sometimes it's best to not create files in the directories where code lives...
for example, that directory might be read-only, or folks might be using
source-control or build systems that disallow that behavior.  To fix this, we
create a file in the temp directory and use it instead.

We don't use ioutil.TempFile(), since that actually creates the file, and we'd
like the tests to run as if the file had never existed.  We use 16 bytes from
crypto/rand to avoid people doing bad things with symlinks in the temp
directory.
2013-05-09 11:37:39 -06:00
Micah Stetson 44496728c2 Support more of the timestamp formats undestood by SQLite 2012-12-29 16:51:15 -08:00
Micah Stetson ce139f706b Support time values with nanosecond precision 2012-12-29 16:36:29 -08:00
Micah Stetson f65db67ea3 Refactor timestamp tests 2012-12-29 16:24:53 -08:00
Micah Stetson f6d10a2a58 Convert times to UTC before storage 2012-12-29 14:47:17 -08:00
Micah Stetson 58c4612c1e Fix #33 and #34 2012-12-29 14:20:27 -08: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
mattn b9ff6f3fd3 'is' does not work in some older sqlite3. 2012-09-12 11:43:54 +09: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
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
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 8cbe65c9c3 merged bradfitz's patch. thanks. 2012-02-20 16:14:49 +09:00
lye 275bdb282a Added additional testcase for boolean roundtrips
This test creates a simple table, inserts some dummy boolean values,
then pulls them back out to ensure they are marshalled correctly.
2012-02-06 22:56:36 +00:00
mattn 7c18f62cf1 fixed package name. 2012-01-25 09:23:44 +09:00
mattn f4359f417e gofix. 2011-12-07 20:40:45 +09:00
mattn fdbb364aba fix LastInsertId()/RowsAffected(). 2011-11-15 11:03:31 +09:00
mattn e36e29f33e fix test. 2011-11-15 10:41:43 +09:00
mattn 8c1b840c44 simple test. 2011-11-13 03:52:02 +09:00