aboutsummaryrefslogtreecommitdiff
path: root/sqlite3.go
diff options
context:
space:
mode:
Diffstat (limited to 'sqlite3.go')
-rw-r--r--sqlite3.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/sqlite3.go b/sqlite3.go
index 90a1241..91c5760 100644
--- a/sqlite3.go
+++ b/sqlite3.go
@@ -28,6 +28,7 @@ import (
const SQLiteTimestampFormat = "2006-01-02 15:04:05"
const SQLiteDateFormat = "2006-01-02"
+const SQLiteDatetimeFormat = "2006-01-02 15:04:05.000"
func init() {
sql.Register("sqlite3", &SQLiteDriver{})
@@ -311,12 +312,15 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
case C.SQLITE_TEXT:
var err error
s := C.GoString((*C.char)(unsafe.Pointer(C.sqlite3_column_text(rc.s.s, C.int(i)))))
- if rc.decltype[i] == "timestamp" {
+ if rc.decltype[i] == "timestamp" || rc.decltype[i] == "datetime" {
dest[i], err = time.Parse(SQLiteTimestampFormat, s)
if err != nil {
dest[i], err = time.Parse(SQLiteDateFormat, s)
if err != nil {
- return err
+ dest[i], err = time.Parse(SQLiteDatetimeFormat, s)
+ if err != nil {
+ return err
+ }
}
}
} else {