stmt.BindBytes(col, make([]byte, 0)) should store an empty blob. It's storing a NULL instead. This is breaking code that needs to differentiate between an empty value and a nonexistent value.
This is probably because we're passing a NULL pointer to C.transient_bind_blob:
func (stmt *Stmt) BindBytes(param int, value []byte) {
if stmt.stmt == nil {
return
}
var v *C.uchar
if len(value) != 0 {
v = (*C.uchar)(unsafe.Pointer(&value[0]))
}
res := C.transient_bind_blob(stmt.stmt, C.int(param), v, C.int(len(value)))
runtime.KeepAlive(value)
stmt.handleBindErr("BindBytes", res)
}
I suggest doing the same thing that was done in BindText i.e. have an empty array which gets passed when len(value) == 0, and is not freed.
stmt.BindBytes(col, make([]byte, 0))
should store an empty blob. It's storing a NULL instead. This is breaking code that needs to differentiate between an empty value and a nonexistent value.This is probably because we're passing a NULL pointer to
C.transient_bind_blob
:I suggest doing the same thing that was done in
BindText
i.e. have an empty array which gets passed whenlen(value) == 0
, and is not freed.