mirror of
https://gitlab.com/cznic/sqlite.git
synced 2024-11-09 02:09:23 +00:00
27 lines
478 B
Go
27 lines
478 B
Go
package sqlite
|
|
|
|
import (
|
|
"database/sql"
|
|
"testing"
|
|
)
|
|
|
|
func TestNullBinding(t *testing.T) {
|
|
db, err := sql.Open("sqlite", "file::memory:")
|
|
if err != nil {
|
|
t.Errorf("cannot open: %v", err)
|
|
return
|
|
}
|
|
_, err = db.Exec(`
|
|
CREATE TABLE table1 (field1 varchar NULL);
|
|
INSERT INTO table1 (field1) VALUES (?);
|
|
`, sql.NullString{})
|
|
if err != nil {
|
|
t.Errorf("Error binding null: %v", err)
|
|
}
|
|
err = db.Close()
|
|
if err != nil {
|
|
t.Errorf("cannot close: %v", err)
|
|
return
|
|
}
|
|
}
|