What steps will reproduce the problem?
1. Create prepared statement
2. Try to bind nil to one of the "?" parameters
What is the expected output? What do you see instead?
Stores "" or "<nil>", instead of null column value.
Please provide any additional information below.
Seems like a pretty easy fix:
diff -r a88eb4732139 sqlite/sqlite.go
--- a/sqlite/sqlite.go Wed Nov 02 13:57:15 2011 -0400
+++ b/sqlite/sqlite.go Mon Jan 09 15:57:50 2012 -0500
@@ -275,6 +275,10 @@
for i, v := range args {
var str string
+ var rv C.int
+ if v == nil {
+ rv = C.sqlite3_bind_null(s.stmt, C.int(i+1))
+ } else {
switch v := v.(type) {
case []byte:
var p *byte
@@ -298,8 +302,9 @@
}
cstr := C.CString(str)
- rv := C.my_bind_text(s.stmt, C.int(i+1), cstr, C.int(len(str)))
+ rv = C.my_bind_text(s.stmt, C.int(i+1), cstr, C.int(len(str)))
C.free(unsafe.Pointer(cstr))
+ }
if rv != 0 {
return s.c.error(rv)
}
Original issue reported on code.google.com by graham.m...@gmail.com on 9 Jan 2012 at 9:00
Original issue reported on code.google.com by
graham.m...@gmail.com
on 9 Jan 2012 at 9:00