Skip to content

Commit 3323b7b

Browse files
committed
amend query tests regarding escape chars
1 parent a22a9f4 commit 3323b7b

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

enginetest/queries/alter_table_queries.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,16 +1033,17 @@ var AlterTableScripts = []ScriptTest{
10331033
Name: "alter table comments are escaped",
10341034
SetUpScript: []string{
10351035
"create table t (i int);",
1036-
`alter table t modify column i int comment "newline \n | return \r | backslash \\ | NUL \0 \x00"`,
1037-
`alter table t add column j int comment "newline \n | return \r | backslash \\ | NUL \0 \x00"`,
1036+
`alter table t modify column i int comment "newline \n | return \r | backslash \\ | NUL \0 \x00 | ctrlz \Z \x1A"`,
1037+
`alter table t add column j int comment "newline \n | return \r | backslash \\ | NUL \0 \x00 | ctrlz \Z \x1A"`,
10381038
},
10391039
Assertions: []ScriptTestAssertion{
10401040
{
10411041
Query: "show create table t",
10421042
Expected: []sql.Row{{
10431043
"t",
1044-
"CREATE TABLE `t` (\n `i` int COMMENT 'newline \\n | return \\r | backslash \\\\ | NUL \\0 x00'," +
1045-
"\n `j` int COMMENT 'newline \\n | return \\r | backslash \\\\ | NUL \\0 x00'\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
1044+
"CREATE TABLE `t` (\n `i` int COMMENT 'newl ine \\n | return \\r | backslash \\\\ | NUL \\0 x00 | ctrlz \x1A x1A'," +
1045+
"\n `j` int COMMENT 'newline \\n | return \\r | backslash \\\\ | NUL \\0 x00 | ctrlz \x1A x1A'\n" +
1046+
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
10461047
},
10471048
},
10481049
},

enginetest/queries/create_table_queries.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ var CreateTableQueries = []WriteQueryTest{
5353
ExpectedSelect: []sql.Row{{"tableWithComment", "CREATE TABLE `tableWithComment` (\n `pk` int\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin COMMENT=''''"}},
5454
},
5555
{
56-
WriteQuery: `create table tableWithComment (pk int) COMMENT "newline \n | return \r | backslash \\ | NUL \0 \x00"`,
56+
WriteQuery: `create table tableWithComment (pk int) COMMENT "newline \n | return \r | backslash \\ | NUL \0 \x00 | ctrlz \Z \x1A"`,
5757
ExpectedWriteResult: []sql.Row{{types.NewOkResult(0)}},
5858
SelectQuery: "SHOW CREATE TABLE tableWithComment",
59-
ExpectedSelect: []sql.Row{{"tableWithComment", "CREATE TABLE `tableWithComment` (\n `pk` int\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin COMMENT='newline \\n | return \\r | backslash \\\\ | NUL \\0 x00'"}},
59+
ExpectedSelect: []sql.Row{{"tableWithComment", "CREATE TABLE `tableWithComment` (\n `pk` int\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin COMMENT='newline \\n | return \\r | backslash \\\\ | NUL \\0 x00 | ctrlz \x1A x1A'"}},
6060
},
6161
{
6262
WriteQuery: `create table tableWithColumnComment (pk int COMMENT "'")`,
@@ -71,10 +71,10 @@ var CreateTableQueries = []WriteQueryTest{
7171
ExpectedSelect: []sql.Row{{"tableWithColumnComment", "CREATE TABLE `tableWithColumnComment` (\n `pk` int COMMENT ''''\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
7272
},
7373
{
74-
WriteQuery: `create table tableWithColumnComment (pk int COMMENT "newline \n | return \r | backslash \\ | NUL \0 \x00")`,
74+
WriteQuery: `create table tableWithColumnComment (pk int COMMENT "newline \n | return \r | backslash \\ | NUL \0 \x00 | ctrlz \Z \x1A")`,
7575
ExpectedWriteResult: []sql.Row{{types.NewOkResult(0)}},
7676
SelectQuery: "SHOW CREATE TABLE tableWithColumnComment",
77-
ExpectedSelect: []sql.Row{{"tableWithColumnComment", "CREATE TABLE `tableWithColumnComment` (\n `pk` int COMMENT 'newline \\n | return \\r | backslash \\\\ | NUL \\0 x00'\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
77+
ExpectedSelect: []sql.Row{{"tableWithColumnComment", "CREATE TABLE `tableWithColumnComment` (\n `pk` int COMMENT 'newline \\n | return \\r | backslash \\\\ | NUL \\0 x00 | ctrlz \x1A x1A'\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"}},
7878
},
7979
{
8080
WriteQuery: `create table floattypedefs (a float(10), b float(10, 2), c double(10, 2))`,

0 commit comments

Comments
 (0)