Skip to content

Commit a7df893

Browse files
committed
add (previously failing) testcase for multiStatement + strict + insertId
1 parent acdaa0b commit a7df893

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

driver_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ func runTestsWithMultiStatement(t *testing.T, dsn string, tests ...func(dbt *DBT
9595
for _, test := range tests {
9696
test(dbt)
9797
dbt.db.Exec("DROP TABLE IF EXISTS test")
98+
dbt.db.Exec("DROP TABLE IF EXISTS test2")
9899
}
99100
}
100101

@@ -110,6 +111,7 @@ func runTests(t *testing.T, dsn string, tests ...func(dbt *DBTest)) {
110111
defer db.Close()
111112

112113
db.Exec("DROP TABLE IF EXISTS test")
114+
db.Exec("DROP TABLE IF EXISTS test2")
113115

114116
dsn2 := dsn + "&interpolateParams=true"
115117
var db2 *sql.DB
@@ -137,13 +139,16 @@ func runTests(t *testing.T, dsn string, tests ...func(dbt *DBTest)) {
137139
for _, test := range tests {
138140
test(dbt)
139141
dbt.db.Exec("DROP TABLE IF EXISTS test")
142+
dbt.db.Exec("DROP TABLE IF EXISTS test2")
140143
if db2 != nil {
141144
test(dbt2)
142145
dbt2.db.Exec("DROP TABLE IF EXISTS test")
146+
dbt2.db.Exec("DROP TABLE IF EXISTS test2")
143147
}
144148
if db3 != nil {
145149
test(dbt3)
146150
dbt3.db.Exec("DROP TABLE IF EXISTS test")
151+
dbt3.db.Exec("DROP TABLE IF EXISTS test2")
147152
}
148153
}
149154
}
@@ -445,6 +450,14 @@ func TestFloat64Placeholder(t *testing.T) {
445450
})
446451
}
447452

453+
func TestMultiStatementStrict(t *testing.T) {
454+
runTestsWithMultiStatement(t, dsn, func(dbt *DBTest) {
455+
dbt.mustExec("CREATE TABLE test (id INT(11) UNSIGNED NOT NULL, PRIMARY KEY (id))")
456+
dbt.mustExec("CREATE TABLE test2 (id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, PRIMARY KEY (id))")
457+
dbt.mustExec("INSERT INTO test VALUES (256); INSERT INTO test2 VALUES (256)")
458+
})
459+
}
460+
448461
func TestString(t *testing.T) {
449462
runTests(t, dsn, func(dbt *DBTest) {
450463
types := [6]string{"CHAR(255)", "VARCHAR(255)", "TINYTEXT", "TEXT", "MEDIUMTEXT", "LONGTEXT"}

0 commit comments

Comments
 (0)