diff options
author | mattn <mattn.jp@gmail.com> | 2012-05-27 18:14:31 -0700 |
---|---|---|
committer | mattn <mattn.jp@gmail.com> | 2012-05-27 18:14:31 -0700 |
commit | a407c70cfd983289954c1dae430d35a550567983 (patch) | |
tree | c41aac7d460ae2a21691b04be950f2975fe28f9c /sqlite3.go | |
parent | remove Makefile. (diff) | |
parent | Update sqlite3_test.go (diff) | |
download | golite-a407c70cfd983289954c1dae430d35a550567983.tar.gz golite-a407c70cfd983289954c1dae430d35a550567983.tar.xz |
Merge pull request #15 from jander/master
Handle bool values with "BOOLEAN" columns.
Diffstat (limited to 'sqlite3.go')
-rw-r--r-- | sqlite3.go | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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: |