handle binding zero length blobs, updates #40

This commit is contained in:
Jan Mercl
2021-01-12 17:50:29 +01:00
parent 663f19b57d
commit d12d3a4d8c

View File

@@ -993,7 +993,9 @@ func (c *conn) bindBlob(pstmt uintptr, idx1 int, value []byte) (uintptr, error)
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 {
c.free(p)
return 0, c.errstr(rc)