Commit 7b752429 authored by Alexander Barkov's avatar Alexander Barkov

Merge remote-tracking branch 'origin/10.3' into 10.4

parents d74d9596 e97b785d
......@@ -219,6 +219,157 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
connection default;
disconnect c1;
#
# MDEV-25399 Assertion `name.length == strlen(name.str)' failed in Item_func_sp::make_send_field
#
SET sql_mode='';
CREATE FUNCTION f(i INT) RETURNS INT RETURN 1;
PREPARE s FROM "SELECT f('\0')";
EXECUTE s;
f('\x00')
1
DROP FUNCTION f;
SET sql_mode=DEFAULT;
#
# MDEV-22380: Assertion `name.length == strlen(name.str)' failed
# in Item::print_item_w_name on SELECT w/ optimizer_trace enabled
#
SELECT '' LIMIT 0;
CREATE TABLE t1 AS SELECT '';
ERROR 42000: Incorrect column name ''
CREATE PROCEDURE test_inject(arg TEXT CHARACTER SET latin1)
BEGIN
SET @stmt=CONCAT('SELECT ''', arg, ''', CONCAT(''', arg, ''') LIMIT 0');
PREPARE stmt FROM @stmt;
EXECUTE stmt;
SET @stmt=CONCAT('CREATE TABLE t1 AS ', @stmt);
PREPARE stmt FROM @stmt;
EXECUTE stmt;
SHOW CREATE TABLE t1;
DROP TABLE t1;
END;
$$
SELECT x'FF32', CONCAT(x'FF32') LIMIT 0;
x'FF32' CONCAT(x'FF32')
CREATE TABLE t1 AS SELECT x'FF32', CONCAT(x'FF32');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`x'FF32'` varbinary(2) NOT NULL,
`CONCAT(x'FF32')` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CALL test_inject(x'FF32');
2 CONCAT('2')
Table Create Table
t1 CREATE TABLE `t1` (
`2` varchar(2) NOT NULL,
`CONCAT('2')` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT x'32FF', CONCAT(x'32FF') LIMIT 0;
x'32FF' CONCAT(x'32FF')
CREATE TABLE t1 AS SELECT x'32FF', CONCAT(x'32FF');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`x'32FF'` varbinary(2) NOT NULL,
`CONCAT(x'32FF')` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CALL test_inject(x'32FF');
2 CONCAT('2')
Table Create Table
t1 CREATE TABLE `t1` (
`2` varchar(2) NOT NULL,
`CONCAT('2')` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT x'0032', CONCAT(x'0032') LIMIT 0;
x'0032' CONCAT(x'0032')
CREATE TABLE t1 AS SELECT x'0032', CONCAT(x'0032');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`x'0032'` varbinary(2) NOT NULL,
`CONCAT(x'0032')` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CALL test_inject(x'0032');
2 CONCAT('\x002')
Table Create Table
t1 CREATE TABLE `t1` (
`2` varchar(2) NOT NULL,
`CONCAT('\x002')` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT x'3200', CONCAT(x'3200') LIMIT 0;
x'3200' CONCAT(x'3200')
CREATE TABLE t1 AS SELECT x'3200', CONCAT(x'3200');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`x'3200'` varbinary(2) NOT NULL,
`CONCAT(x'3200')` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CALL test_inject(x'3200');
2\x00 CONCAT('2\x00')
Table Create Table
t1 CREATE TABLE `t1` (
`2\x00` varchar(2) NOT NULL,
`CONCAT('2\x00')` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT '0\a', CONCAT('0\a') LIMIT 0;
0a CONCAT('0\a')
CREATE TABLE t1 AS SELECT '0\a', CONCAT('0\a');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`0a` varchar(2) NOT NULL,
`CONCAT('0\a')` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CALL test_inject('0\a');
0a CONCAT('0a')
Table Create Table
t1 CREATE TABLE `t1` (
`0a` varchar(2) NOT NULL,
`CONCAT('0a')` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT 'a\0', CONCAT('a\0') LIMIT 0;
a\x00 CONCAT('a\0')
CREATE TABLE t1 AS SELECT 'a\0', CONCAT('a\0');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a\x00` varchar(2) NOT NULL,
`CONCAT('a\0')` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CALL test_inject('a\0');
a\x00 CONCAT('a\x00')
Table Create Table
t1 CREATE TABLE `t1` (
`a\x00` varchar(2) NOT NULL,
`CONCAT('a\x00')` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT 'a\0b', CONCAT('a\0b') LIMIT 0;
a\x00b CONCAT('a\0b')
CREATE TABLE t1 AS SELECT 'a\0b', CONCAT('a\0b');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a\x00b` varchar(3) NOT NULL,
`CONCAT('a\0b')` varchar(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CALL test_inject('a\0b');
a\x00b CONCAT('a\x00b')
Table Create Table
t1 CREATE TABLE `t1` (
`a\x00b` varchar(3) NOT NULL,
`CONCAT('a\x00b')` varchar(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP PROCEDURE test_inject;
#
# MDEV-23519
#
create or replace table t1 (a int);
......
This diff is collapsed.
......@@ -4710,7 +4710,7 @@ SELECT @@character_set_client, @@character_set_connection, @@character_set_resul
@@character_set_client @@character_set_connection @@character_set_results
binary big5 binary
SELECT HEX('\['), HEX('\\[');
HEX('\[') HEX('\\[')
HEX('\xE0\[') HEX('\\xE0\[')
E05B E05B
CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
......
......@@ -20418,7 +20418,7 @@ SELECT @@character_set_client, @@character_set_connection, @@character_set_resul
@@character_set_client @@character_set_connection @@character_set_results
binary cp932 binary
SELECT HEX('à\['), HEX('\à\[');
HEX('à\[') HEX('\à\[')
HEX('\xE0\[') HEX('\\xE0\[')
E05B E05B
CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
......
......@@ -5058,7 +5058,7 @@ SELECT @@character_set_client, @@character_set_connection, @@character_set_resul
@@character_set_client @@character_set_connection @@character_set_results
binary gbk binary
SELECT HEX('\['), HEX('\\[');
HEX('\[') HEX('\\[')
HEX('\xE0\[') HEX('\\xE0\[')
E05B E05B
CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
......
......@@ -7965,37 +7965,37 @@ SELECT '
?
?
SELECT HEX('');
HEX('')
HEX('\xC2')
3F
SELECT HEX(CAST('' AS CHAR CHARACTER SET utf8));
HEX(CAST('' AS CHAR CHARACTER SET utf8))
HEX(CAST('\xC2' AS CHAR CHARACTER SET utf8))
3F
SELECT HEX(CAST('' AS CHAR CHARACTER SET latin1));
HEX(CAST('' AS CHAR CHARACTER SET latin1))
HEX(CAST('\xC2' AS CHAR CHARACTER SET latin1))
3F
SELECT HEX(CONVERT('' USING utf8));
HEX(CONVERT('' USING utf8))
HEX(CONVERT('\xC2' USING utf8))
3F
SELECT HEX(CONVERT('' USING latin1));
HEX(CONVERT('' USING latin1))
HEX(CONVERT('\xC2' USING latin1))
3F
SELECT 'x';
?x
?x
SELECT HEX('x');
HEX('x')
HEX('\xC2x')
3F78
SELECT HEX(CAST('x' AS CHAR CHARACTER SET utf8));
HEX(CAST('x' AS CHAR CHARACTER SET utf8))
HEX(CAST('\xC2x' AS CHAR CHARACTER SET utf8))
3F78
SELECT HEX(CAST('x' AS CHAR CHARACTER SET latin1));
HEX(CAST('x' AS CHAR CHARACTER SET latin1))
HEX(CAST('\xC2x' AS CHAR CHARACTER SET latin1))
3F78
SELECT HEX(CONVERT('x' USING utf8));
HEX(CONVERT('x' USING utf8))
HEX(CONVERT('\xC2x' USING utf8))
3F78
SELECT HEX(CONVERT('x' USING latin1));
HEX(CONVERT('x' USING latin1))
HEX(CONVERT('\xC2x' USING latin1))
3F78
SET NAMES utf8;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
......
......@@ -18682,7 +18682,7 @@ SELECT @@character_set_client, @@character_set_connection, @@character_set_resul
@@character_set_client @@character_set_connection @@character_set_results
binary sjis binary
SELECT HEX('\['), HEX('\\[');
HEX('\[') HEX('\\[')
HEX('\xE0\[') HEX('\\xE0\[')
E05B E05B
CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
......
......@@ -67,13 +67,13 @@ select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%');
_utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%')
1
select convert(_latin1'Gnter Andr' using utf8) like CONVERT(_latin1'GNTER%' USING utf8);
convert(_latin1'Gnter Andr' using utf8) like CONVERT(_latin1'GNTER%' USING utf8)
convert(_latin1'G\xFCnter Andr\xE9' using utf8) like CONVERT(_latin1'G\xDCNTER%' USING utf8)
1
select CONVERT(_koi8r'' USING utf8) LIKE CONVERT(_koi8r'' USING utf8);
CONVERT(_koi8r'' USING utf8) LIKE CONVERT(_koi8r'' USING utf8)
CONVERT(_koi8r'\xD7\xC1\xD3\xD1' USING utf8) LIKE CONVERT(_koi8r'\xF7\xE1\xF3\xF1' USING utf8)
1
select CONVERT(_koi8r'' USING utf8) LIKE CONVERT(_koi8r'' USING utf8);
CONVERT(_koi8r'' USING utf8) LIKE CONVERT(_koi8r'' USING utf8)
CONVERT(_koi8r'\xF7\xE1\xF3\xF1' USING utf8) LIKE CONVERT(_koi8r'\xD7\xC1\xD3\xD1' USING utf8)
1
SELECT 'a' = 'a ';
'a' = 'a '
......@@ -1295,7 +1295,7 @@ concat(concat(_latin1'->',f1),_latin1'<-')
-><-
drop table t1;
select convert(_koi8r'' using utf8) < convert(_koi8r'' using utf8);
convert(_koi8r'' using utf8) < convert(_koi8r'' using utf8)
convert(_koi8r'\xC9' using utf8) < convert(_koi8r'\xCA' using utf8)
1
set names latin1;
create table t1 (a varchar(10)) character set utf8;
......
......@@ -67,13 +67,13 @@ select _utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4
_utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4 '%')
1
select convert(_latin1'Gnter Andr' using utf8mb4) like CONVERT(_latin1'GNTER%' USING utf8mb4);
convert(_latin1'G?nter Andr?' using utf8mb4) like CONVERT(_latin1'G?NTER%' USING utf8mb4)
convert(_latin1'G\xFCnter Andr\xE9' using utf8mb4) like CONVERT(_latin1'G\xDCNTER%' USING utf8mb4)
1
select CONVERT(_koi8r'' USING utf8mb4) LIKE CONVERT(_koi8r'' USING utf8mb4);
CONVERT(_koi8r'????' USING utf8mb4) LIKE CONVERT(_koi8r'????' USING utf8mb4)
CONVERT(_koi8r'\xD7\xC1\xD3\xD1' USING utf8mb4) LIKE CONVERT(_koi8r'\xF7\xE1\xF3\xF1' USING utf8mb4)
1
select CONVERT(_koi8r'' USING utf8mb4) LIKE CONVERT(_koi8r'' USING utf8mb4);
CONVERT(_koi8r'????' USING utf8mb4) LIKE CONVERT(_koi8r'????' USING utf8mb4)
CONVERT(_koi8r'\xF7\xE1\xF3\xF1' USING utf8mb4) LIKE CONVERT(_koi8r'\xD7\xC1\xD3\xD1' USING utf8mb4)
1
SELECT 'a' = 'a ';
'a' = 'a '
......@@ -1316,7 +1316,7 @@ concat(concat(_latin1'->',f1),_latin1'<-')
-><-
drop table t1;
select convert(_koi8r'' using utf8mb4) < convert(_koi8r'' using utf8mb4);
convert(_koi8r'?' using utf8mb4) < convert(_koi8r'?' using utf8mb4)
convert(_koi8r'\xC9' using utf8mb4) < convert(_koi8r'\xCA' using utf8mb4)
1
set names latin1;
create table t1 (a varchar(10)) character set utf8mb4;
......
......@@ -67,13 +67,13 @@ select _utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4
_utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4 '%')
1
select convert(_latin1'Gnter Andr' using utf8mb4) like CONVERT(_latin1'GNTER%' USING utf8mb4);
convert(_latin1'G?nter Andr?' using utf8mb4) like CONVERT(_latin1'G?NTER%' USING utf8mb4)
convert(_latin1'G\xFCnter Andr\xE9' using utf8mb4) like CONVERT(_latin1'G\xDCNTER%' USING utf8mb4)
1
select CONVERT(_koi8r'' USING utf8mb4) LIKE CONVERT(_koi8r'' USING utf8mb4);
CONVERT(_koi8r'????' USING utf8mb4) LIKE CONVERT(_koi8r'????' USING utf8mb4)
CONVERT(_koi8r'\xD7\xC1\xD3\xD1' USING utf8mb4) LIKE CONVERT(_koi8r'\xF7\xE1\xF3\xF1' USING utf8mb4)
1
select CONVERT(_koi8r'' USING utf8mb4) LIKE CONVERT(_koi8r'' USING utf8mb4);
CONVERT(_koi8r'????' USING utf8mb4) LIKE CONVERT(_koi8r'????' USING utf8mb4)
CONVERT(_koi8r'\xF7\xE1\xF3\xF1' USING utf8mb4) LIKE CONVERT(_koi8r'\xD7\xC1\xD3\xD1' USING utf8mb4)
1
SELECT 'a' = 'a ';
'a' = 'a '
......@@ -1215,7 +1215,7 @@ concat(concat(_latin1'->',f1),_latin1'<-')
-><-
drop table t1;
select convert(_koi8r'' using utf8mb4) < convert(_koi8r'' using utf8mb4);
convert(_koi8r'?' using utf8mb4) < convert(_koi8r'?' using utf8mb4)
convert(_koi8r'\xC9' using utf8mb4) < convert(_koi8r'\xCA' using utf8mb4)
1
set names latin1;
create table t1 (a varchar(10)) character set utf8mb4 engine heap;
......
......@@ -67,13 +67,13 @@ select _utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4
_utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4 '%')
1
select convert(_latin1'Gnter Andr' using utf8mb4) like CONVERT(_latin1'GNTER%' USING utf8mb4);
convert(_latin1'G?nter Andr?' using utf8mb4) like CONVERT(_latin1'G?NTER%' USING utf8mb4)
convert(_latin1'G\xFCnter Andr\xE9' using utf8mb4) like CONVERT(_latin1'G\xDCNTER%' USING utf8mb4)
1
select CONVERT(_koi8r'' USING utf8mb4) LIKE CONVERT(_koi8r'' USING utf8mb4);
CONVERT(_koi8r'????' USING utf8mb4) LIKE CONVERT(_koi8r'????' USING utf8mb4)
CONVERT(_koi8r'\xD7\xC1\xD3\xD1' USING utf8mb4) LIKE CONVERT(_koi8r'\xF7\xE1\xF3\xF1' USING utf8mb4)
1
select CONVERT(_koi8r'' USING utf8mb4) LIKE CONVERT(_koi8r'' USING utf8mb4);
CONVERT(_koi8r'????' USING utf8mb4) LIKE CONVERT(_koi8r'????' USING utf8mb4)
CONVERT(_koi8r'\xF7\xE1\xF3\xF1' USING utf8mb4) LIKE CONVERT(_koi8r'\xD7\xC1\xD3\xD1' USING utf8mb4)
1
SELECT 'a' = 'a ';
'a' = 'a '
......@@ -1278,7 +1278,7 @@ concat(concat(_latin1'->',f1),_latin1'<-')
-><-
drop table t1;
select convert(_koi8r'' using utf8mb4) < convert(_koi8r'' using utf8mb4);
convert(_koi8r'?' using utf8mb4) < convert(_koi8r'?' using utf8mb4)
convert(_koi8r'\xC9' using utf8mb4) < convert(_koi8r'\xCA' using utf8mb4)
1
set names latin1;
create table t1 (a varchar(10)) character set utf8mb4 engine InnoDB;
......
......@@ -67,13 +67,13 @@ select _utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4
_utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4 '%')
1
select convert(_latin1'Gnter Andr' using utf8mb4) like CONVERT(_latin1'GNTER%' USING utf8mb4);
convert(_latin1'G?nter Andr?' using utf8mb4) like CONVERT(_latin1'G?NTER%' USING utf8mb4)
convert(_latin1'G\xFCnter Andr\xE9' using utf8mb4) like CONVERT(_latin1'G\xDCNTER%' USING utf8mb4)
1
select CONVERT(_koi8r'' USING utf8mb4) LIKE CONVERT(_koi8r'' USING utf8mb4);
CONVERT(_koi8r'????' USING utf8mb4) LIKE CONVERT(_koi8r'????' USING utf8mb4)
CONVERT(_koi8r'\xD7\xC1\xD3\xD1' USING utf8mb4) LIKE CONVERT(_koi8r'\xF7\xE1\xF3\xF1' USING utf8mb4)
1
select CONVERT(_koi8r'' USING utf8mb4) LIKE CONVERT(_koi8r'' USING utf8mb4);
CONVERT(_koi8r'????' USING utf8mb4) LIKE CONVERT(_koi8r'????' USING utf8mb4)
CONVERT(_koi8r'\xF7\xE1\xF3\xF1' USING utf8mb4) LIKE CONVERT(_koi8r'\xD7\xC1\xD3\xD1' USING utf8mb4)
1
SELECT 'a' = 'a ';
'a' = 'a '
......@@ -1281,7 +1281,7 @@ concat(concat(_latin1'->',f1),_latin1'<-')
-><-
drop table t1;
select convert(_koi8r'' using utf8mb4) < convert(_koi8r'' using utf8mb4);
convert(_koi8r'?' using utf8mb4) < convert(_koi8r'?' using utf8mb4)
convert(_koi8r'\xC9' using utf8mb4) < convert(_koi8r'\xCA' using utf8mb4)
1
set names latin1;
create table t1 (a varchar(10)) character set utf8mb4 engine MyISAM;
......
......@@ -320,7 +320,7 @@ select plugin_name from information_schema.plugins where plugin_library like 'ha
plugin_name
set names utf8;
select convert('admin𝌆' using utf8);
convert('admin𝌆' using utf8)
convert('admin\xF0\x9D\x8C\x86' using utf8)
admin????
Warnings:
Warning 1300 Invalid utf8 character string: '\xF0\x9D\x8C\x86'
......
......@@ -1096,6 +1096,80 @@ bool Item::check_type_scalar(const char *opname) const
}
extern "C" {
/*
All values greater than MY_NAME_BINARY_VALUE are
interpreted as binary bytes.
The exact constant value does not matter,
but it must be greater than 0x10FFFF,
which is the maximum possible character in Unicode.
*/
#define MY_NAME_BINARY_VALUE 0x200000
/*
Print all binary bytes as well as zero character U+0000 in hex notation.
Print other characters normally.
*/
static int
my_wc_mb_item_name(CHARSET_INFO *cs, my_wc_t wc, uchar *str, uchar *end)
{
if (wc == 0 || wc >= MY_NAME_BINARY_VALUE)
{
if (str + 4 >= end)
return MY_CS_TOOSMALL3;
str[0]= '\\';
str[1]= 'x';
str[2]= _dig_vec_upper[(uchar) (wc >> 4)];
str[3]= _dig_vec_upper[(uchar) wc & 0x0F];
return 4;
}
return my_charset_utf8_handler.wc_mb(cs, wc, str, end);
}
/*
Scan characters and mark all illegal sequences as binary byte values,
to have my_wc_mb_utf8_escape_name() print them using HEX notation.
*/
static int
my_mb_wc_item_name(CHARSET_INFO *cs, my_wc_t *pwc,
const uchar *str, const uchar *end)
{
int rc= cs->cset->mb_wc(cs, pwc, str, end);
if (rc == MY_CS_ILSEQ)
{
*pwc= MY_NAME_BINARY_VALUE + *str;
return 1;
}
return rc;
}
}
static LEX_CSTRING
make_name(THD *thd,
const char *str, size_t length, CHARSET_INFO *cs,
size_t max_octet_length)
{
uint errors;
size_t dst_nbytes= length * system_charset_info->mbmaxlen;
set_if_smaller(dst_nbytes, max_octet_length);
char *dst= (char*) thd->alloc(dst_nbytes + 1);
if (!dst)
return null_clex_str;
uint32 cnv_length= my_convert_using_func(dst, dst_nbytes, system_charset_info,
my_wc_mb_item_name,
str, length,
cs == &my_charset_bin ?
system_charset_info : cs,
my_mb_wc_item_name, &errors);
dst[cnv_length]= '\0';
return Lex_cstring(dst, cnv_length);
}
void Item::set_name(THD *thd, const char *str, size_t length, CHARSET_INFO *cs)
{
if (!length)
......@@ -1146,32 +1220,14 @@ void Item::set_name(THD *thd, const char *str, size_t length, CHARSET_INFO *cs)
ER_REMOVED_SPACES, ER_THD(thd, ER_REMOVED_SPACES),
buff);
}
if (!my_charset_same(cs, system_charset_info))
{
size_t res_length;
name.str= sql_strmake_with_convert(thd, str, length, cs,
MAX_ALIAS_NAME, system_charset_info,
&res_length);
name.length= res_length;
}
else
name.str= thd->strmake(str, (name.length= MY_MIN(length,MAX_ALIAS_NAME)));
name= make_name(thd, str, length, cs, MAX_ALIAS_NAME - 1);
}
void Item::set_name_no_truncate(THD *thd, const char *str, uint length,
CHARSET_INFO *cs)
{
if (!my_charset_same(cs, system_charset_info))
{
size_t res_length;
name.str= sql_strmake_with_convert(thd, str, length, cs,
UINT_MAX, system_charset_info,
&res_length);
name.length= res_length;
}
else
name.str= thd->strmake(str, (name.length= length));
name= make_name(thd, str, length, cs, UINT_MAX - 1);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment