forked from mirror/go-sqlcipher
Merge branch 'pr/135'
This commit is contained in:
commit
0a0c543dc0
|
@ -479,7 +479,7 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
|
||||||
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)))
|
||||||
switch rc.decltype[i] {
|
switch rc.decltype[i] {
|
||||||
case "timestamp", "datetime":
|
case "timestamp", "datetime", "date":
|
||||||
dest[i] = time.Unix(val, 0)
|
dest[i] = time.Unix(val, 0)
|
||||||
case "boolean":
|
case "boolean":
|
||||||
dest[i] = val > 0
|
dest[i] = val > 0
|
||||||
|
@ -510,7 +510,7 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
|
||||||
s := C.GoString((*C.char)(unsafe.Pointer(C.sqlite3_column_text(rc.s.s, C.int(i)))))
|
s := C.GoString((*C.char)(unsafe.Pointer(C.sqlite3_column_text(rc.s.s, C.int(i)))))
|
||||||
|
|
||||||
switch rc.decltype[i] {
|
switch rc.decltype[i] {
|
||||||
case "timestamp", "datetime":
|
case "timestamp", "datetime", "date":
|
||||||
for _, format := range SQLiteTimestampFormats {
|
for _, format := range SQLiteTimestampFormats {
|
||||||
if dest[i], err = time.Parse(format, s); err == nil {
|
if dest[i], err = time.Parse(format, s); err == nil {
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue