chore: ⬆️ updated deps
This commit is contained in:
+18
-9
@@ -27,8 +27,13 @@ type rows struct {
|
||||
reuseStmt bool // If true, Close() resets instead of finalizing
|
||||
}
|
||||
|
||||
func newRows(c *conn, pstmt uintptr, allocs []uintptr, empty bool) (r *rows, err error) {
|
||||
r = &rows{c: c, pstmt: pstmt, allocs: allocs, empty: empty}
|
||||
func newRows(c *conn, pstmt uintptr, allocs *[]uintptr, empty bool) (r *rows, err error) {
|
||||
var a []uintptr
|
||||
if allocs != nil {
|
||||
a = *allocs
|
||||
*allocs = nil
|
||||
}
|
||||
r = &rows{c: c, pstmt: pstmt, allocs: a, empty: empty}
|
||||
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@@ -54,9 +59,7 @@ func newRows(c *conn, pstmt uintptr, allocs []uintptr, empty bool) (r *rows, err
|
||||
|
||||
// Close closes the rows iterator.
|
||||
func (r *rows) Close() (err error) {
|
||||
for _, v := range r.allocs {
|
||||
r.c.free(v)
|
||||
}
|
||||
r.c.freeAllocs(r.allocs)
|
||||
r.allocs = nil
|
||||
|
||||
if r.reuseStmt {
|
||||
@@ -128,10 +131,10 @@ func (r *rows) Next(dest []driver.Value) (err error) {
|
||||
// without breaking the legacy heuristic for existing users.
|
||||
switch r.c.integerTimeFormat {
|
||||
case "unix_micro":
|
||||
dest[i] = time.UnixMicro(v).UTC()
|
||||
dest[i] = r.c.applyTimezone(time.UnixMicro(v).UTC())
|
||||
continue
|
||||
case "unix_nano":
|
||||
dest[i] = time.Unix(0, v).UTC()
|
||||
dest[i] = r.c.applyTimezone(time.Unix(0, v).UTC())
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -143,10 +146,10 @@ func (r *rows) Next(dest []driver.Value) (err error) {
|
||||
// timestamp?
|
||||
if v > 1e12 || v < -1e12 {
|
||||
// Milliseconds
|
||||
dest[i] = time.UnixMilli(v).UTC()
|
||||
dest[i] = r.c.applyTimezone(time.UnixMilli(v).UTC())
|
||||
} else {
|
||||
// Seconds
|
||||
dest[i] = time.Unix(v, 0).UTC()
|
||||
dest[i] = r.c.applyTimezone(time.Unix(v, 0).UTC())
|
||||
}
|
||||
default:
|
||||
dest[i] = v
|
||||
@@ -276,6 +279,12 @@ func (r *rows) ColumnTypeScanType(index int) reflect.Type {
|
||||
case sqlite3.SQLITE_FLOAT:
|
||||
return reflect.TypeOf(float64(0))
|
||||
case sqlite3.SQLITE_TEXT:
|
||||
if r.c.textToTime {
|
||||
switch strings.ToLower(r.c.columnDeclType(r.pstmt, index)) {
|
||||
case "date", "datetime", "time", "timestamp":
|
||||
return reflect.TypeOf(time.Time{})
|
||||
}
|
||||
}
|
||||
return reflect.TypeOf("")
|
||||
case sqlite3.SQLITE_BLOB:
|
||||
return reflect.TypeOf([]byte(nil))
|
||||
|
||||
Reference in New Issue
Block a user