feat: establish Orbit models, migrations and development baseline
This commit is contained in:
19
internal/storage/mysql/sqlsplit_test.go
Normal file
19
internal/storage/mysql/sqlsplit_test.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package mysql
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestSQLSplitterPreservesQuotedSemicolons(t *testing.T) {
|
||||
sql := "-- comment;\nCREATE TABLE `x;y` (v VARCHAR(10)); INSERT INTO `x;y` VALUES ('a;''b'); /* ignore ; */"
|
||||
s, err := splitSQL(sql)
|
||||
if err != nil || len(s) != 2 {
|
||||
t.Fatalf("split=%v err=%v", s, err)
|
||||
}
|
||||
if s[1] != "INSERT INTO `x;y` VALUES ('a;''b')" {
|
||||
t.Fatal(s[1])
|
||||
}
|
||||
for _, bad := range []string{"SELECT 'broken;", "/*broken", "/*! DROP TABLE x */", "DELIMITER $$", "-- empty"} {
|
||||
if _, err := splitSQL(bad); err == nil {
|
||||
t.Fatalf("accepted %q", bad)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user