Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions callback.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,12 @@ func callbackArgFloat64(v *C.sqlite3_value) (reflect.Value, error) {
func callbackArgBytes(v *C.sqlite3_value) (reflect.Value, error) {
switch C.sqlite3_value_type(v) {
case C.SQLITE_BLOB:
l := C.sqlite3_value_bytes(v)
p := C.sqlite3_value_blob(v)
l := C.sqlite3_value_bytes(v)
return reflect.ValueOf(C.GoBytes(p, l)), nil
case C.SQLITE_TEXT:
l := C.sqlite3_value_bytes(v)
c := unsafe.Pointer(C.sqlite3_value_text(v))
l := C.sqlite3_value_bytes(v)
return reflect.ValueOf(C.GoBytes(c, l)), nil
default:
return reflect.Value{}, fmt.Errorf("argument must be BLOB or TEXT")
Expand Down
4 changes: 2 additions & 2 deletions sqlite3_opt_preupdate_hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ func (d *SQLitePreUpdateData) row(dest []any, new bool) error {
case C.SQLITE_FLOAT:
src = float64(C.sqlite3_value_double(val))
case C.SQLITE_BLOB:
len := C.sqlite3_value_bytes(val)
blobptr := C.sqlite3_value_blob(val)
len := C.sqlite3_value_bytes(val)
src = C.GoBytes(blobptr, len)
case C.SQLITE_TEXT:
len := C.sqlite3_value_bytes(val)
cstrptr := unsafe.Pointer(C.sqlite3_value_text(val))
len := C.sqlite3_value_bytes(val)
src = C.GoBytes(cstrptr, len)
case C.SQLITE_NULL:
src = nil
Expand Down
Loading