forked from mirror/go-sqlite3
Handle bool values with "BOOLEAN" columns.
This commit is contained in:
parent
d9c069459a
commit
6865865265
|
@ -284,9 +284,12 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
|
||||||
switch C.sqlite3_column_type(rc.s.s, C.int(i)) {
|
switch C.sqlite3_column_type(rc.s.s, C.int(i)) {
|
||||||
case C.SQLITE_INTEGER:
|
case C.SQLITE_INTEGER:
|
||||||
val := int64(C.sqlite3_column_int64(rc.s.s, C.int(i)))
|
val := int64(C.sqlite3_column_int64(rc.s.s, C.int(i)))
|
||||||
if rc.decltype[i] == "timestamp" {
|
switch rc.decltype[i]{
|
||||||
|
case "timestamp":
|
||||||
dest[i] = time.Unix(val, 0)
|
dest[i] = time.Unix(val, 0)
|
||||||
} else {
|
case "boolean":
|
||||||
|
dest[i] = val>0
|
||||||
|
default:
|
||||||
dest[i] = val
|
dest[i] = val
|
||||||
}
|
}
|
||||||
case C.SQLITE_FLOAT:
|
case C.SQLITE_FLOAT:
|
||||||
|
|
Loading…
Reference in New Issue