aboutsummaryrefslogtreecommitdiff
path: root/sqlite3.go
diff options
context:
space:
mode:
authorjander <jander.sy@163.com>2012-05-25 17:01:03 +0800
committerjander <jander.sy@163.com>2012-05-25 17:01:03 +0800
commit6865865265dab5ba96d6f64c2126d555e28bc386 (patch)
tree578925fa23ae7f6f5a3eaedb63efbd65656e99c3 /sqlite3.go
parentremove Makefile. (diff)
downloadgolite-6865865265dab5ba96d6f64c2126d555e28bc386.tar.gz
golite-6865865265dab5ba96d6f64c2126d555e28bc386.tar.xz
Handle bool values with "BOOLEAN" columns.
Diffstat (limited to 'sqlite3.go')
-rw-r--r--sqlite3.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/sqlite3.go b/sqlite3.go
index bff9aec..161da5e 100644
--- a/sqlite3.go
+++ b/sqlite3.go
@@ -284,9 +284,12 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
switch C.sqlite3_column_type(rc.s.s, C.int(i)) {
case C.SQLITE_INTEGER:
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)
- } else {
+ case "boolean":
+ dest[i] = val>0
+ default:
dest[i] = val
}
case C.SQLITE_FLOAT: