mirror of
https://github.com/ncruces/go-sqlite3.git
synced 2026-01-12 05:59:14 +00:00
Optimize.
This commit is contained in:
14
stmt.go
14
stmt.go
@@ -663,18 +663,22 @@ func (s *Stmt) Columns(dest ...any) error {
|
||||
case byte(NULL):
|
||||
dest[i] = nil
|
||||
default:
|
||||
ptr := util.Read32[ptr_t](s.c.mod, dataPtr+0)
|
||||
if ptr == 0 {
|
||||
dest[i] = []byte{}
|
||||
continue
|
||||
}
|
||||
len := util.Read32[int32](s.c.mod, dataPtr+4)
|
||||
if len != 0 {
|
||||
ptr := util.Read32[ptr_t](s.c.mod, dataPtr)
|
||||
buf := util.View(s.c.mod, ptr, int64(len))
|
||||
if types[i] == byte(TEXT) {
|
||||
dest[i] = string(buf)
|
||||
} else {
|
||||
dest[i] = buf
|
||||
}
|
||||
} else {
|
||||
if types[i] == byte(TEXT) {
|
||||
dest[i] = ""
|
||||
} else {
|
||||
dest[i] = []byte{}
|
||||
}
|
||||
}
|
||||
}
|
||||
dataPtr += 8
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user