From a620c1a086489bbd9423f17928b84c319dfac2b3 Mon Sep 17 00:00:00 2001 From: lye Date: Tue, 7 Feb 2012 06:59:24 +0800 Subject: [PATCH] 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 --- sqlite3.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite3.go b/sqlite3.go index 088b110..d8f7756 100644 --- a/sqlite3.go +++ b/sqlite3.go @@ -169,7 +169,7 @@ func (s *SQLiteStmt) bind(args []interface{}) error { rv = C.sqlite3_bind_int(s.s, n, C.int(v)) case bool: if bool(v) { - rv = C.sqlite3_bind_int(s.s, n, -1) + rv = C.sqlite3_bind_int(s.s, n, 1) } else { rv = C.sqlite3_bind_int(s.s, n, 0) }