From ff0960b999eb967d04346ca98a0c3be37c0f51a4 Mon Sep 17 00:00:00 2001 From: Peter Waller Date: Mon, 11 Aug 2014 11:03:27 +0100 Subject: [PATCH 1/2] Add 'date' to rc.decltypes interpreted as a time --- sqlite3.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite3.go b/sqlite3.go index fc3e8ad..7280eb8 100644 --- a/sqlite3.go +++ b/sqlite3.go @@ -505,7 +505,7 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error { s := C.GoString((*C.char)(unsafe.Pointer(C.sqlite3_column_text(rc.s.s, C.int(i))))) switch rc.decltype[i] { - case "timestamp", "datetime": + case "timestamp", "datetime", "date": for _, format := range SQLiteTimestampFormats { if dest[i], err = time.Parse(format, s); err == nil { break From 764e046d89b47e49b58465b7fa57056f56ae5e17 Mon Sep 17 00:00:00 2001 From: Peter Waller Date: Tue, 2 Sep 2014 16:36:34 +0100 Subject: [PATCH 2/2] Add "date" to decltypes parsed as a unix time --- sqlite3.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite3.go b/sqlite3.go index 7280eb8..f133897 100644 --- a/sqlite3.go +++ b/sqlite3.go @@ -474,7 +474,7 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error { case C.SQLITE_INTEGER: val := int64(C.sqlite3_column_int64(rc.s.s, C.int(i))) switch rc.decltype[i] { - case "timestamp", "datetime": + case "timestamp", "datetime", "date": dest[i] = time.Unix(val, 0) case "boolean": dest[i] = val > 0