mirror of
https://github.com/ncruces/go-sqlite3.git
synced 2026-01-11 21:49:13 +00:00
Refactor.
This commit is contained in:
@@ -801,18 +801,7 @@ func (r *rows) Next(dest []driver.Value) error {
|
|||||||
}
|
}
|
||||||
for i := range dest {
|
for i := range dest {
|
||||||
scan := r.scanType(i)
|
scan := r.scanType(i)
|
||||||
switch v := dest[i].(type) {
|
if v, ok := dest[i].([]byte); ok {
|
||||||
case int64:
|
|
||||||
if scan == _BOOL {
|
|
||||||
switch v {
|
|
||||||
case 1:
|
|
||||||
dest[i] = true
|
|
||||||
case 0:
|
|
||||||
dest[i] = false
|
|
||||||
}
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
case []byte:
|
|
||||||
if len(v) == cap(v) { // a BLOB
|
if len(v) == cap(v) { // a BLOB
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -827,16 +816,19 @@ func (r *rows) Next(dest []driver.Value) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dest[i] = string(v)
|
dest[i] = string(v)
|
||||||
case float64:
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
if scan == _TIME {
|
switch scan {
|
||||||
|
case _TIME:
|
||||||
t, err := r.tmRead.Decode(dest[i])
|
t, err := r.tmRead.Decode(dest[i])
|
||||||
if err == nil {
|
if err == nil {
|
||||||
dest[i] = t
|
dest[i] = t
|
||||||
continue
|
}
|
||||||
|
case _BOOL:
|
||||||
|
switch dest[i] {
|
||||||
|
case int64(0):
|
||||||
|
dest[i] = false
|
||||||
|
case int64(1):
|
||||||
|
dest[i] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user