mirror of
https://github.com/glebarez/go-sqlite.git
synced 2025-10-06 00:06:56 +08:00
handle binding zero length blobs, updates #40
This commit is contained in:
@@ -993,7 +993,9 @@ func (c *conn) bindBlob(pstmt uintptr, idx1 int, value []byte) (uintptr, error)
|
|||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
copy((*libc.RawMem)(unsafe.Pointer(p))[:len(value):len(value)], value)
|
if len(value) != 0 {
|
||||||
|
copy((*libc.RawMem)(unsafe.Pointer(p))[:len(value):len(value)], value)
|
||||||
|
}
|
||||||
if rc := sqlite3.Xsqlite3_bind_blob(c.tls, pstmt, int32(idx1), p, int32(len(value)), 0); rc != sqlite3.SQLITE_OK {
|
if rc := sqlite3.Xsqlite3_bind_blob(c.tls, pstmt, int32(idx1), p, int32(len(value)), 0); rc != sqlite3.SQLITE_OK {
|
||||||
c.free(p)
|
c.free(p)
|
||||||
return 0, c.errstr(rc)
|
return 0, c.errstr(rc)
|
||||||
|
Reference in New Issue
Block a user