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.
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.
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