aboutsummaryrefslogtreecommitdiff
path: root/sqlite3_test.go
diff options
context:
space:
mode:
authorLucas Manuel Rodriguez <lucas@spideroak.com>2018-05-30 21:39:01 -0300
committerLucas Manuel Rodriguez <lucas@spideroak.com>2018-05-30 21:39:01 -0300
commit8d6d326be62813261950d3fe807f38a8977596b2 (patch)
tree45e0fec122e0e6d04f5c3d34cc9df8e2c71af803 /sqlite3_test.go
parentMerge pull request #577 from GJRTimmer/update/docs (diff)
downloadgolite-8d6d326be62813261950d3fe807f38a8977596b2.tar.gz
golite-8d6d326be62813261950d3fe807f38a8977596b2.tar.xz
Add nil check in bind and a test
Diffstat (limited to 'sqlite3_test.go')
-rw-r--r--sqlite3_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/sqlite3_test.go b/sqlite3_test.go
index 782f57c..1013d34 100644
--- a/sqlite3_test.go
+++ b/sqlite3_test.go
@@ -1580,6 +1580,21 @@ func TestNilAndEmptyBytes(t *testing.T) {
}
}
+func TestInsertNilByteSlice(t *testing.T) {
+ db, err := sql.Open("sqlite3", ":memory:")
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer db.Close()
+ if _, err := db.Exec("create table blob_not_null (b blob not null)"); err != nil {
+ t.Fatal(err)
+ }
+ var nilSlice []byte
+ if _, err := db.Exec("insert into blob_not_null (b) values (?)", nilSlice); err == nil {
+ t.Fatal("didn't expect INSERT to 'not null' column with a nil []byte slice to work")
+ }
+}
+
var customFunctionOnce sync.Once
func BenchmarkCustomFunctions(b *testing.B) {