mirror of
https://github.com/ncruces/go-sqlite3.git
synced 2026-01-11 21:49:13 +00:00
Fix.
This commit is contained in:
@@ -38,6 +38,9 @@ int sqlite3_columns_go(sqlite3_stmt *stmt, int nCol, char *aType,
|
|||||||
}
|
}
|
||||||
if (ptr == NULL && rc == SQLITE_OK) {
|
if (ptr == NULL && rc == SQLITE_OK) {
|
||||||
rc = sqlite3_errcode(sqlite3_db_handle(stmt));
|
rc = sqlite3_errcode(sqlite3_db_handle(stmt));
|
||||||
|
if (rc == SQLITE_ROW || rc == SQLITE_DONE) {
|
||||||
|
rc = SQLITE_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
aData[i].ptr = ptr;
|
aData[i].ptr = ptr;
|
||||||
aData[i].len = sqlite3_column_bytes(stmt, i);
|
aData[i].len = sqlite3_column_bytes(stmt, i);
|
||||||
|
|||||||
8
stmt.go
8
stmt.go
@@ -582,7 +582,9 @@ func (s *Stmt) ColumnRawBlob(col int) []byte {
|
|||||||
func (s *Stmt) columnRawBytes(col int, ptr uint32) []byte {
|
func (s *Stmt) columnRawBytes(col int, ptr uint32) []byte {
|
||||||
if ptr == 0 {
|
if ptr == 0 {
|
||||||
r := s.c.call("sqlite3_errcode", uint64(s.c.handle))
|
r := s.c.call("sqlite3_errcode", uint64(s.c.handle))
|
||||||
s.err = s.c.error(r)
|
if r != _ROW && r != _DONE {
|
||||||
|
s.err = s.c.error(r)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -666,6 +668,10 @@ func (s *Stmt) Columns(dest ...any) error {
|
|||||||
dest[i] = nil
|
dest[i] = nil
|
||||||
default:
|
default:
|
||||||
ptr := util.ReadUint32(s.c.mod, dataPtr+0)
|
ptr := util.ReadUint32(s.c.mod, dataPtr+0)
|
||||||
|
if ptr == 0 {
|
||||||
|
dest[i] = []byte{}
|
||||||
|
continue
|
||||||
|
}
|
||||||
len := util.ReadUint32(s.c.mod, dataPtr+4)
|
len := util.ReadUint32(s.c.mod, dataPtr+4)
|
||||||
buf := util.View(s.c.mod, ptr, uint64(len))
|
buf := util.View(s.c.mod, ptr, uint64(len))
|
||||||
if types[i] == byte(TEXT) {
|
if types[i] == byte(TEXT) {
|
||||||
|
|||||||
Reference in New Issue
Block a user