Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
jiawen li
tidb
Commits
7545e579
Unverified
Commit
7545e579
authored
4 years ago
by
ti-srebot
Committed by
GitHub
4 years ago
Browse files
Options
Download
Email Patches
Plain Diff
cherry pick #22100 to release-4.0 (#22103)
parent
1172badb
release-4.0-20220301
add-index
kv-only-4.0
release-4.0
release-4.0-20210427
release-4.0-20210720
release-4.0-20210727
release-4.0-2021072702
release-4.0-20210813
release-4.0-20211029
v4.0.16
v4.0.15
v4.0.15-20211101
v4.0.14
v4.0.14-20220303
v4.0.14-20210816
v4.0.13
v4.0.12
v4.0.12-20210727
v4.0.12-20210713
v4.0.12-20210708
v4.0.12-20210611
v4.0.12-20210427
v4.0.11
v4.0.11-20210727
v4.0.10
v4.0.10-20210720
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
executor/select_into.go
+7
-1
executor/select_into.go
executor/select_into_test.go
+20
-0
executor/select_into_test.go
with
27 additions
and
1 deletion
+27
-1
executor/select_into.go
+
7
-
1
View file @
7545e579
...
...
@@ -193,7 +193,13 @@ func (s *SelectIntoExec) dumpToOutfile() error {
case
mysql
.
TypeJSON
:
s
.
fieldBuf
=
append
(
s
.
fieldBuf
,
row
.
GetJSON
(
j
)
.
String
()
...
)
}
s
.
lineBuf
=
append
(
s
.
lineBuf
,
s
.
escapeField
(
s
.
fieldBuf
)
...
)
switch
col
.
GetType
()
.
EvalType
()
{
case
types
.
ETString
,
types
.
ETJson
:
s
.
lineBuf
=
append
(
s
.
lineBuf
,
s
.
escapeField
(
s
.
fieldBuf
)
...
)
default
:
s
.
lineBuf
=
append
(
s
.
lineBuf
,
s
.
fieldBuf
...
)
}
if
(
encloseFlag
&&
!
encloseOpt
)
||
(
encloseFlag
&&
encloseOpt
&&
s
.
considerEncloseOpt
(
et
))
{
s
.
lineBuf
=
append
(
s
.
lineBuf
,
encloseByte
)
...
...
This diff is collapsed.
Click to expand it.
executor/select_into_test.go
+
20
-
0
View file @
7545e579
...
...
@@ -246,3 +246,23 @@ func (s *testSuite1) TestDumpReal(c *C) {
c
.
Assert
(
string
(
buf
),
Equals
,
testCase
.
result
)
}
}
func
(
s
*
testSuite1
)
TestEscapeType
(
c
*
C
)
{
outfile
:=
randomSelectFilePath
(
"TestEscapeType"
)
tk
:=
testkit
.
NewTestKit
(
c
,
s
.
store
)
tk
.
MustExec
(
"use test"
)
tk
.
MustExec
(
"drop table if exists t"
)
tk
.
MustExec
(
`create table t (
a int,
b double,
c varchar(10),
d blob,
e json,
f set('1', '2', '3'),
g enum('1', '2', '3'))`
)
tk
.
MustExec
(
`insert into t values (1, 1, "1", "1", '{"key": 1}', "1", "1")`
)
tk
.
MustExec
(
fmt
.
Sprintf
(
"select * from t into outfile '%v' fields terminated by ',' escaped by '1'"
,
outfile
))
cmpAndRm
(
`1,1,11,11,{"key": 11},11,11
`
,
outfile
,
c
)
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help