Closed
Description
sqlite3_column_decltype() returns NULL when it's an expression.
I'm not sure it's a bug.
I was thinking that maybe go-sqlite3 could guess that the string is a datetime but that could cause problem when someone want a text timestamp on purpose.
It could be easier to do the work on the user side since we know if we expect a string or a datetime/date/timestamp.
func TestDateTimeNow(t *testing.T) {
tempFilename := TempFilename()
db, err := sql.Open("sqlite3", tempFilename)
if err != nil {
t.Fatal("Failed to open database:", err)
}
defer db.Close()
var d time.Time
err = db.QueryRow("select datetime('now')").Scan(&d)
if err != nil {
t.Fatal("Failed to scan datetime:", err)
}
}
--- FAIL: TestDateTimeNow (0.02s)
sqlite3_test.go:917: Failed to scan datetime: sql: Scan error on column index 0: unsupported driver -> Scan pair: []uint8 -> *time.Time
FAIL
Metadata
Metadata
Assignees
Labels
No labels