forked from mirror/go-sqlite3
For boolean values, marshal true to SQLite 1, not -1
SQLite stores boolean values as an integer, serializing true as 1 and false as 0 [1], but it does not actually enforce this range. To match the documentation (and fix the broken test case), this patch makes a Go boolean true serialize properly to 1. [1] http://www.sqlite.org/datatype3.html
This commit is contained in:
parent
275bdb282a
commit
3524ead0a5
|
@ -169,7 +169,7 @@ func (s *SQLiteStmt) bind(args []interface{}) error {
|
||||||
rv = C.sqlite3_bind_int(s.s, n, C.int(v))
|
rv = C.sqlite3_bind_int(s.s, n, C.int(v))
|
||||||
case bool:
|
case bool:
|
||||||
if bool(v) {
|
if bool(v) {
|
||||||
rv = C.sqlite3_bind_int(s.s, n, -1)
|
rv = C.sqlite3_bind_int(s.s, n, 1)
|
||||||
} else {
|
} else {
|
||||||
rv = C.sqlite3_bind_int(s.s, n, 0)
|
rv = C.sqlite3_bind_int(s.s, n, 0)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue