提交 35c5c678 编写于 作者: martianzhang's avatar martianzhang
上级 ceaf5881
...@@ -39,6 +39,7 @@ tb; ...@@ -39,6 +39,7 @@ tb;
19 INSERT /*+ SET_VAR(foreign_key_checks=OFF) */ INTO t2 VALUES(2); 19 INSERT /*+ SET_VAR(foreign_key_checks=OFF) */ INTO t2 VALUES(2);
20 select /*!50000 1,*/ 1; 20 select /*!50000 1,*/ 1;
21 UPDATE xxx SET c1=' LOGGER.error(""); }' WHERE id = 2 ; 21 UPDATE xxx SET c1=' LOGGER.error(""); }' WHERE id = 2 ;
22 UPDATE `xxx` SET aaa='a;' WHERE `id` = 15;
0 select * from test\G 0 select * from test\G
1 select 'hello\Gworld', col from test\G 1 select 'hello\Gworld', col from test\G
2 -- select * from test\Ghello 2 -- select * from test\Ghello
......
...@@ -933,7 +933,7 @@ func SplitStatement(buf []byte, delimiter []byte) (string, string, []byte) { ...@@ -933,7 +933,7 @@ func SplitStatement(buf []byte, delimiter []byte) (string, string, []byte) {
if i > 1 && buf[i-1] != '\\' { if i > 1 && buf[i-1] != '\\' {
if quoted && b == quoteRune { if quoted && b == quoteRune {
quoted = false quoted = false
quoteRune = '0' quoteRune = 0
} else { } else {
// check if first time found quote // check if first time found quote
if quoteRune == 0 { if quoteRune == 0 {
......
...@@ -171,6 +171,7 @@ select col from tb; ...@@ -171,6 +171,7 @@ select col from tb;
[]byte(`INSERT /*+ SET_VAR(foreign_key_checks=OFF) */ INTO t2 VALUES(2);`), // 19 []byte(`INSERT /*+ SET_VAR(foreign_key_checks=OFF) */ INTO t2 VALUES(2);`), // 19
[]byte(`select /*!50000 1,*/ 1;`), // 20 []byte(`select /*!50000 1,*/ 1;`), // 20
[]byte(`UPDATE xxx SET c1=' LOGGER.error(""); }' WHERE id = 2 ;`), // 21 []byte(`UPDATE xxx SET c1=' LOGGER.error(""); }' WHERE id = 2 ;`), // 21
[]byte("UPDATE `xxx` SET aaa='a;' WHERE `id` = 15;"), // 22
} }
// \G 分隔符 // \G 分隔符
buf2s := [][]byte{ buf2s := [][]byte{
...@@ -184,6 +185,9 @@ select col from tb; ...@@ -184,6 +185,9 @@ select col from tb;
\\G*/ \\G*/
from test\\Ghello`), // 6 from test\\Ghello`), // 6
} }
// single sql test
// SplitStatement(bufs[22], []byte(";"))
// return
err := common.GoldenDiff(func() { err := common.GoldenDiff(func() {
for i, buf := range bufs { for i, buf := range bufs {
sql, _, _ := SplitStatement(buf, []byte(";")) sql, _, _ := SplitStatement(buf, []byte(";"))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册