Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
215307a4
Commit
215307a4
authored
Oct 28, 2007
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge gshchepa@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into gleb.loc:/home/uchum/work/bk/5.0-opt
parents
2ae8b12b
3f3e5bac
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
251 additions
and
31 deletions
+251
-31
mysql-test/r/outfile_loaddata.result
mysql-test/r/outfile_loaddata.result
+85
-0
mysql-test/r/select.result
mysql-test/r/select.result
+12
-14
mysql-test/t/outfile_loaddata.test
mysql-test/t/outfile_loaddata.test
+89
-0
mysql-test/t/select.test
mysql-test/t/select.test
+15
-8
sql/share/errmsg.txt
sql/share/errmsg.txt
+2
-0
sql/sql_class.cc
sql/sql_class.cc
+35
-9
sql/sql_class.h
sql/sql_class.h
+7
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+6
-0
No files found.
mysql-test/r/outfile_loaddata.result
0 → 100644
View file @
215307a4
DROP TABLE IF EXISTS t1, t2;
#
# Bug#31663 FIELDS TERMINATED BY special character
#
CREATE TABLE t1 (i1 int, i2 int, c1 VARCHAR(256), c2 VARCHAR(256));
INSERT INTO t1 VALUES (101, 202, '-r-', '=raker=');
# FIELDS TERMINATED BY 'raker', warning:
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' FIELDS TERMINATED BY 'raker' FROM t1;
Warnings:
Warning 1475 First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS ENCLOSED BY
SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt');
LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt')
101raker202raker-r-raker=raker=
CREATE TABLE t2 SELECT * FROM t1;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 FIELDS TERMINATED BY 'raker';
Warnings:
Warning 1262 Row 1 was truncated; it contained more data than there were input columns
SELECT * FROM t2;
i1 i2 c1 c2
101 202 -r- =raker=
101 202 -r- =
DROP TABLE t2;
# Only numeric fields, FIELDS TERMINATED BY 'r', no warnings:
SELECT i1, i2 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' FIELDS TERMINATED BY 'r' FROM t1;
SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt');
LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt')
101r202
CREATE TABLE t2 SELECT i1, i2 FROM t1;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 FIELDS TERMINATED BY 'r';
SELECT i1, i2 FROM t2;
i1 i2
101 202
101 202
DROP TABLE t2;
# FIELDS TERMINATED BY '0', warning:
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' FIELDS TERMINATED BY '0' FROM t1;
Warnings:
Warning 1475 First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS ENCLOSED BY
SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt');
LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt')
10102020-r-0=raker=
CREATE TABLE t2 SELECT * FROM t1;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 FIELDS TERMINATED BY '0';
Warnings:
Warning 1262 Row 1 was truncated; it contained more data than there were input columns
SELECT * FROM t2;
i1 i2 c1 c2
101 202 -r- =raker=
1 1 2 2
DROP TABLE t2;
# FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0', warning:
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0' FROM t1;
Warnings:
Warning 1475 First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS ENCLOSED BY
SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt');
LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt')
10102020"-r-"0"=raker="
CREATE TABLE t2 SELECT * FROM t1;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0';
Warnings:
Warning 1262 Row 1 was truncated; it contained more data than there were input columns
SELECT * FROM t2;
i1 i2 c1 c2
101 202 -r- =raker=
1 1 2 2
DROP TABLE t2;
# Only string fields, FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0', no warnings:
SELECT c1, c2 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0' FROM t1;
SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt');
LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt')
"-r-"0"=raker="
CREATE TABLE t2 SELECT c1, c2 FROM t1;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0';
SELECT c1, c2 FROM t2;
c1 c2
-r- =raker=
-r- =raker=
DROP TABLE t2;
DROP TABLE t1;
# End of 5.0 tests.
mysql-test/r/select.result
View file @
215307a4
...
@@ -4077,23 +4077,21 @@ x
...
@@ -4077,23 +4077,21 @@ x
1
1
Warnings:
Warnings:
Warning 1466 Leading spaces are removed from name ' x'
Warning 1466 Leading spaces are removed from name ' x'
CREATE VIEW v1 AS SELECT 1 AS ``;
ERROR 42000: Incorrect column name ''
CREATE VIEW v1 AS SELECT 1 AS ` `;
CREATE VIEW v1 AS SELECT 1 AS ` `;
Warnings:
ERROR 42000: Incorrect column name ' '
Warning 1474 Name ' ' has become ''
CREATE VIEW v1 AS SELECT 1 AS ` `;
SELECT `` FROM v1;
ERROR 42000: Incorrect column name ' '
CREATE VIEW v1 AS SELECT (SELECT 1 AS ` `);
1
ERROR 42000: Incorrect column name ' '
CREATE VIEW v2 AS SELECT 1 AS ` `;
CREATE VIEW v1 AS SELECT 1 AS ` x`;
Warnings:
Warning 1474 Name ' ' has become ''
SELECT `` FROM v2;
1
CREATE VIEW v3 AS SELECT 1 AS ` x`;
Warnings:
Warnings:
Warning 1466 Leading spaces are removed from name ' x'
Warning 1466 Leading spaces are removed from name ' x'
SELECT `x` FROM v
3
;
SELECT `x` FROM v
1
;
x
x
1
1
DROP VIEW v1, v2, v3;
ALTER VIEW v1 AS SELECT 1 AS ` `;
ERROR 42000: Incorrect column name ' '
DROP VIEW v1;
End of 5.0 tests
End of 5.0 tests
mysql-test/t/outfile_loaddata.test
0 → 100644
View file @
215307a4
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
,
t2
;
--
enable_warnings
--
echo
#
--
echo
# Bug#31663 FIELDS TERMINATED BY special character
--
echo
#
CREATE
TABLE
t1
(
i1
int
,
i2
int
,
c1
VARCHAR
(
256
),
c2
VARCHAR
(
256
));
INSERT
INTO
t1
VALUES
(
101
,
202
,
'-r-'
,
'=raker='
);
--
let
$fields
=*
--
let
$clauses
=
FIELDS
TERMINATED
BY
'raker'
--
echo
# $clauses, warning:
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
eval
SELECT
$fields
INTO
OUTFILE
'$MYSQLTEST_VARDIR/tmp/bug31663.txt'
$clauses
FROM
t1
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
eval
SELECT
LOAD_FILE
(
'$MYSQLTEST_VARDIR/tmp/bug31663.txt'
)
--
eval
CREATE
TABLE
t2
SELECT
$fields
FROM
t1
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
eval
LOAD
DATA
INFILE
'$MYSQLTEST_VARDIR/tmp/bug31663.txt'
INTO
TABLE
t2
$clauses
--
eval
SELECT
$fields
FROM
t2
--
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
bug31663
.
txt
DROP
TABLE
t2
;
--
let
$fields
=
i1
,
i2
--
let
$clauses
=
FIELDS
TERMINATED
BY
'r'
--
echo
# Only numeric fields, $clauses, no warnings:
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
eval
SELECT
$fields
INTO
OUTFILE
'$MYSQLTEST_VARDIR/tmp/bug31663.txt'
$clauses
FROM
t1
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
eval
SELECT
LOAD_FILE
(
'$MYSQLTEST_VARDIR/tmp/bug31663.txt'
)
--
eval
CREATE
TABLE
t2
SELECT
$fields
FROM
t1
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
eval
LOAD
DATA
INFILE
'$MYSQLTEST_VARDIR/tmp/bug31663.txt'
INTO
TABLE
t2
$clauses
--
eval
SELECT
$fields
FROM
t2
--
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
bug31663
.
txt
DROP
TABLE
t2
;
--
let
$fields
=*
--
let
$clauses
=
FIELDS
TERMINATED
BY
'0'
--
echo
# $clauses, warning:
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
eval
SELECT
$fields
INTO
OUTFILE
'$MYSQLTEST_VARDIR/tmp/bug31663.txt'
$clauses
FROM
t1
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
eval
SELECT
LOAD_FILE
(
'$MYSQLTEST_VARDIR/tmp/bug31663.txt'
)
--
eval
CREATE
TABLE
t2
SELECT
$fields
FROM
t1
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
eval
LOAD
DATA
INFILE
'$MYSQLTEST_VARDIR/tmp/bug31663.txt'
INTO
TABLE
t2
$clauses
--
eval
SELECT
$fields
FROM
t2
--
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
bug31663
.
txt
DROP
TABLE
t2
;
--
let
$fields
=*
--
let
$clauses
=
FIELDS
OPTIONALLY
ENCLOSED
BY
'"'
TERMINATED
BY
'0'
--
echo
# $clauses, warning:
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
eval
SELECT
$fields
INTO
OUTFILE
'$MYSQLTEST_VARDIR/tmp/bug31663.txt'
$clauses
FROM
t1
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
eval
SELECT
LOAD_FILE
(
'$MYSQLTEST_VARDIR/tmp/bug31663.txt'
)
--
eval
CREATE
TABLE
t2
SELECT
$fields
FROM
t1
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
eval
LOAD
DATA
INFILE
'$MYSQLTEST_VARDIR/tmp/bug31663.txt'
INTO
TABLE
t2
$clauses
--
eval
SELECT
$fields
FROM
t2
--
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
bug31663
.
txt
DROP
TABLE
t2
;
--
let
$fields
=
c1
,
c2
--
let
$clauses
=
FIELDS
OPTIONALLY
ENCLOSED
BY
'"'
TERMINATED
BY
'0'
--
echo
# Only string fields, $clauses, no warnings:
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
eval
SELECT
$fields
INTO
OUTFILE
'$MYSQLTEST_VARDIR/tmp/bug31663.txt'
$clauses
FROM
t1
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
eval
SELECT
LOAD_FILE
(
'$MYSQLTEST_VARDIR/tmp/bug31663.txt'
)
--
eval
CREATE
TABLE
t2
SELECT
$fields
FROM
t1
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
eval
LOAD
DATA
INFILE
'$MYSQLTEST_VARDIR/tmp/bug31663.txt'
INTO
TABLE
t2
$clauses
--
eval
SELECT
$fields
FROM
t2
--
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
bug31663
.
txt
DROP
TABLE
t2
;
DROP
TABLE
t1
;
--
echo
# End of 5.0 tests.
mysql-test/t/select.test
View file @
215307a4
...
@@ -3466,22 +3466,29 @@ DROP TABLE t1;
...
@@ -3466,22 +3466,29 @@ DROP TABLE t1;
#
#
--
disable_ps_protocol
--
disable_ps_protocol
SELECT
1
AS
` `
;
SELECT
1
AS
` `
;
SELECT
1
AS
` `
;
SELECT
1
AS
` `
;
SELECT
1
AS
` x`
;
SELECT
1
AS
` x`
;
--
enable_ps_protocol
--
error
1166
CREATE
VIEW
v1
AS
SELECT
1
AS
``
;
--
error
1166
CREATE
VIEW
v1
AS
SELECT
1
AS
` `
;
CREATE
VIEW
v1
AS
SELECT
1
AS
` `
;
SELECT
``
FROM
v1
;
CREATE
VIEW
v2
AS
SELECT
1
AS
` `
;
--
error
1166
SELECT
``
FROM
v2
;
CREATE
VIEW
v1
AS
SELECT
1
AS
` `
;
CREATE
VIEW
v3
AS
SELECT
1
AS
` x`
;
--
error
1166
SELECT
`x`
FROM
v3
;
CREATE
VIEW
v1
AS
SELECT
(
SELECT
1
AS
` `
)
;
DROP
VIEW
v1
,
v2
,
v3
;
CREATE
VIEW
v1
AS
SELECT
1
AS
` x`
;
SELECT
`x`
FROM
v1
;
--
enable_ps_protocol
--
error
1166
ALTER
VIEW
v1
AS
SELECT
1
AS
` `
;
DROP
VIEW
v1
;
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
sql/share/errmsg.txt
View file @
215307a4
...
@@ -5639,3 +5639,5 @@ ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT
...
@@ -5639,3 +5639,5 @@ ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT
eng "Too high level of nesting for select"
eng "Too high level of nesting for select"
ER_NAME_BECOMES_EMPTY
ER_NAME_BECOMES_EMPTY
eng "Name '%-.64s' has become ''"
eng "Name '%-.64s' has become ''"
ER_AMBIGUOUS_FIELD_TERM
eng "First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS ENCLOSED BY"
sql/sql_class.cc
View file @
215307a4
...
@@ -1194,6 +1194,7 @@ int
...
@@ -1194,6 +1194,7 @@ int
select_export
::
prepare
(
List
<
Item
>
&
list
,
SELECT_LEX_UNIT
*
u
)
select_export
::
prepare
(
List
<
Item
>
&
list
,
SELECT_LEX_UNIT
*
u
)
{
{
bool
blob_flag
=
0
;
bool
blob_flag
=
0
;
bool
string_results
=
FALSE
,
non_string_results
=
FALSE
;
unit
=
u
;
unit
=
u
;
if
((
uint
)
strlen
(
exchange
->
file_name
)
+
NAME_LEN
>=
FN_REFLEN
)
if
((
uint
)
strlen
(
exchange
->
file_name
)
+
NAME_LEN
>=
FN_REFLEN
)
strmake
(
path
,
exchange
->
file_name
,
FN_REFLEN
-
1
);
strmake
(
path
,
exchange
->
file_name
,
FN_REFLEN
-
1
);
...
@@ -1211,13 +1212,18 @@ select_export::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
...
@@ -1211,13 +1212,18 @@ select_export::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
blob_flag
=
1
;
blob_flag
=
1
;
break
;
break
;
}
}
if
(
item
->
result_type
()
==
STRING_RESULT
)
string_results
=
TRUE
;
else
non_string_results
=
TRUE
;
}
}
}
}
field_term_length
=
exchange
->
field_term
->
length
();
field_term_length
=
exchange
->
field_term
->
length
();
field_term_char
=
field_term_length
?
(
*
exchange
->
field_term
)[
0
]
:
INT_MAX
;
if
(
!
exchange
->
line_term
->
length
())
if
(
!
exchange
->
line_term
->
length
())
exchange
->
line_term
=
exchange
->
field_term
;
// Use this if it exists
exchange
->
line_term
=
exchange
->
field_term
;
// Use this if it exists
field_sep_char
=
(
exchange
->
enclosed
->
length
()
?
(
*
exchange
->
enclosed
)[
0
]
:
field_sep_char
=
(
exchange
->
enclosed
->
length
()
?
(
*
exchange
->
enclosed
)[
0
]
:
field_term_length
?
(
*
exchange
->
field_term
)[
0
]
:
INT_MAX
);
field_term_char
);
escape_char
=
(
exchange
->
escaped
->
length
()
?
(
*
exchange
->
escaped
)[
0
]
:
-
1
);
escape_char
=
(
exchange
->
escaped
->
length
()
?
(
*
exchange
->
escaped
)[
0
]
:
-
1
);
is_ambiguous_field_sep
=
test
(
strchr
(
ESCAPE_CHARS
,
field_sep_char
));
is_ambiguous_field_sep
=
test
(
strchr
(
ESCAPE_CHARS
,
field_sep_char
));
is_unsafe_field_sep
=
test
(
strchr
(
NUMERIC_CHARS
,
field_sep_char
));
is_unsafe_field_sep
=
test
(
strchr
(
NUMERIC_CHARS
,
field_sep_char
));
...
@@ -1229,12 +1235,25 @@ select_export::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
...
@@ -1229,12 +1235,25 @@ select_export::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
exchange
->
opt_enclosed
=
1
;
// A little quicker loop
exchange
->
opt_enclosed
=
1
;
// A little quicker loop
fixed_row_size
=
(
!
field_term_length
&&
!
exchange
->
enclosed
->
length
()
&&
fixed_row_size
=
(
!
field_term_length
&&
!
exchange
->
enclosed
->
length
()
&&
!
blob_flag
);
!
blob_flag
);
if
((
is_ambiguous_field_sep
&&
exchange
->
enclosed
->
is_empty
()
&&
(
string_results
||
is_unsafe_field_sep
))
||
(
exchange
->
opt_enclosed
&&
non_string_results
&&
field_term_length
&&
strchr
(
NUMERIC_CHARS
,
field_term_char
)))
{
push_warning
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_AMBIGUOUS_FIELD_TERM
,
ER
(
ER_AMBIGUOUS_FIELD_TERM
));
is_ambiguous_field_term
=
TRUE
;
}
else
is_ambiguous_field_term
=
FALSE
;
return
0
;
return
0
;
}
}
#define NEED_ESCAPING(x) ((int) (uchar) (x) == escape_char || \
#define NEED_ESCAPING(x) ((int) (uchar) (x) == escape_char || \
(int) (uchar) (x) == field_sep_char || \
(enclosed ? (int) (uchar) (x) == field_sep_char \
: (int) (uchar) (x) == field_term_char) || \
(int) (uchar) (x) == line_sep_char || \
(int) (uchar) (x) == line_sep_char || \
!(x))
!(x))
...
@@ -1263,8 +1282,10 @@ bool select_export::send_data(List<Item> &items)
...
@@ -1263,8 +1282,10 @@ bool select_export::send_data(List<Item> &items)
while
((
item
=
li
++
))
while
((
item
=
li
++
))
{
{
Item_result
result_type
=
item
->
result_type
();
Item_result
result_type
=
item
->
result_type
();
bool
enclosed
=
(
exchange
->
enclosed
->
length
()
&&
(
!
exchange
->
opt_enclosed
||
result_type
==
STRING_RESULT
));
res
=
item
->
str_result
(
&
tmp
);
res
=
item
->
str_result
(
&
tmp
);
if
(
res
&&
(
!
exchange
->
opt_enclosed
||
result_type
==
STRING_RESULT
)
)
if
(
res
&&
enclosed
)
{
{
if
(
my_b_write
(
&
cache
,(
byte
*
)
exchange
->
enclosed
->
ptr
(),
if
(
my_b_write
(
&
cache
,(
byte
*
)
exchange
->
enclosed
->
ptr
(),
exchange
->
enclosed
->
length
()))
exchange
->
enclosed
->
length
()))
...
@@ -1355,11 +1376,16 @@ bool select_export::send_data(List<Item> &items)
...
@@ -1355,11 +1376,16 @@ bool select_export::send_data(List<Item> &items)
DBUG_ASSERT before the loop makes that sure.
DBUG_ASSERT before the loop makes that sure.
*/
*/
if
(
NEED_ESCAPING
(
*
pos
)
||
if
(
(
NEED_ESCAPING
(
*
pos
)
||
(
check_second_byte
&&
(
check_second_byte
&&
my_mbcharlen
(
character_set_client
,
(
uchar
)
*
pos
)
==
2
&&
my_mbcharlen
(
character_set_client
,
(
uchar
)
*
pos
)
==
2
&&
pos
+
1
<
end
&&
pos
+
1
<
end
&&
NEED_ESCAPING
(
pos
[
1
])))
NEED_ESCAPING
(
pos
[
1
])))
&&
/*
Don't escape field_term_char by doubling - doubling is only
valid for ENCLOSED BY characters:
*/
(
enclosed
||
!
is_ambiguous_field_term
||
*
pos
!=
field_term_char
))
{
{
char
tmp_buff
[
2
];
char
tmp_buff
[
2
];
tmp_buff
[
0
]
=
((
int
)
*
pos
==
field_sep_char
&&
tmp_buff
[
0
]
=
((
int
)
*
pos
==
field_sep_char
&&
...
@@ -1398,7 +1424,7 @@ bool select_export::send_data(List<Item> &items)
...
@@ -1398,7 +1424,7 @@ bool select_export::send_data(List<Item> &items)
goto
err
;
goto
err
;
}
}
}
}
if
(
res
&&
(
!
exchange
->
opt_enclosed
||
result_type
==
STRING_RESULT
)
)
if
(
res
&&
enclosed
)
{
{
if
(
my_b_write
(
&
cache
,
(
byte
*
)
exchange
->
enclosed
->
ptr
(),
if
(
my_b_write
(
&
cache
,
(
byte
*
)
exchange
->
enclosed
->
ptr
(),
exchange
->
enclosed
->
length
()))
exchange
->
enclosed
->
length
()))
...
...
sql/sql_class.h
View file @
215307a4
...
@@ -1992,12 +1992,19 @@ class select_to_file :public select_result_interceptor {
...
@@ -1992,12 +1992,19 @@ class select_to_file :public select_result_interceptor {
class
select_export
:
public
select_to_file
{
class
select_export
:
public
select_to_file
{
uint
field_term_length
;
uint
field_term_length
;
int
field_sep_char
,
escape_char
,
line_sep_char
;
int
field_sep_char
,
escape_char
,
line_sep_char
;
int
field_term_char
;
// first char of FIELDS TERMINATED BY or MAX_INT
/*
/*
The is_ambiguous_field_sep field is true if a value of the field_sep_char
The is_ambiguous_field_sep field is true if a value of the field_sep_char
field is one of the 'n', 't', 'r' etc characters
field is one of the 'n', 't', 'r' etc characters
(see the READ_INFO::unescape method and the ESCAPE_CHARS constant value).
(see the READ_INFO::unescape method and the ESCAPE_CHARS constant value).
*/
*/
bool
is_ambiguous_field_sep
;
bool
is_ambiguous_field_sep
;
/*
The is_ambiguous_field_term is true if field_sep_char contains the first
char of the FIELDS TERMINATED BY (ENCLOSED BY is empty), and items can
contain this character.
*/
bool
is_ambiguous_field_term
;
/*
/*
The is_unsafe_field_sep field is true if a value of the field_sep_char
The is_unsafe_field_sep field is true if a value of the field_sep_char
field is one of the '0'..'9', '+', '-', '.' and 'e' characters
field is one of the '0'..'9', '+', '-', '.' and 'e' characters
...
...
sql/sql_yacc.yy
View file @
215307a4
...
@@ -4305,6 +4305,12 @@ select_item:
...
@@ -4305,6 +4305,12 @@ select_item:
MYSQL_YYABORT;
MYSQL_YYABORT;
if ($4.str)
if ($4.str)
{
{
if (Lex->sql_command == SQLCOM_CREATE_VIEW &&
check_column_name($4.str))
{
my_error(ER_WRONG_COLUMN_NAME, MYF(0), $4.str);
MYSQL_YYABORT;
}
$2->is_autogenerated_name= FALSE;
$2->is_autogenerated_name= FALSE;
$2->set_name($4.str, $4.length, system_charset_info);
$2->set_name($4.str, $4.length, system_charset_info);
}
}
...
...
Write
Preview
Markdown
is supported
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