mirror of
https://github.com/MariaDB/server.git
synced 2025-11-16 20:23:18 +03:00
Merge mysql.com:/usr/home/bar/mysql-5.0
into mysql.com:/usr/home/bar/mysql-5.0-kt
This commit is contained in:
@@ -33,6 +33,9 @@ instr('hello','HE') instr('hello',binary 'HE') instr(binary 'hello','HE')
|
||||
select position(binary 'll' in 'hello'),position('a' in binary 'hello');
|
||||
position(binary 'll' in 'hello') position('a' in binary 'hello')
|
||||
3 0
|
||||
select left('hello',null), right('hello',null);
|
||||
left('hello',null) right('hello',null)
|
||||
NULL NULL
|
||||
select left('hello',2),right('hello',2),substring('hello',2,2),mid('hello',1,5) ;
|
||||
left('hello',2) right('hello',2) substring('hello',2,2) mid('hello',1,5)
|
||||
he lo el hello
|
||||
|
||||
@@ -19,6 +19,11 @@ select hex(char(256));
|
||||
select locate('he','hello'),locate('he','hello',2),locate('lo','hello',2) ;
|
||||
select instr('hello','HE'), instr('hello',binary 'HE'), instr(binary 'hello','HE');
|
||||
select position(binary 'll' in 'hello'),position('a' in binary 'hello');
|
||||
#
|
||||
# Bug#11728 string function LEFT,
|
||||
# strange undocumented behaviour, strict mode
|
||||
#
|
||||
select left('hello',null), right('hello',null);
|
||||
select left('hello',2),right('hello',2),substring('hello',2,2),mid('hello',1,5) ;
|
||||
select concat('',left(right(concat('what ',concat('is ','happening')),9),4),'',substring('monty',5,1)) ;
|
||||
select substring_index('www.tcx.se','.',-2),substring_index('www.tcx.se','.',1);
|
||||
|
||||
@@ -1673,11 +1673,18 @@ C_MODE_START
|
||||
int mysql_init_character_set(MYSQL *mysql)
|
||||
{
|
||||
NET *net= &mysql->net;
|
||||
const char *default_collation_name;
|
||||
|
||||
/* Set character set */
|
||||
if (!mysql->options.charset_name &&
|
||||
!(mysql->options.charset_name=
|
||||
if (!mysql->options.charset_name)
|
||||
{
|
||||
default_collation_name= MYSQL_DEFAULT_COLLATION_NAME;
|
||||
if (!(mysql->options.charset_name=
|
||||
my_strdup(MYSQL_DEFAULT_CHARSET_NAME,MYF(MY_WME))))
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
default_collation_name= NULL;
|
||||
|
||||
{
|
||||
const char *save= charsets_dir;
|
||||
@@ -1685,6 +1692,28 @@ int mysql_init_character_set(MYSQL *mysql)
|
||||
charsets_dir=mysql->options.charset_dir;
|
||||
mysql->charset=get_charset_by_csname(mysql->options.charset_name,
|
||||
MY_CS_PRIMARY, MYF(MY_WME));
|
||||
if (mysql->charset && default_collation_name)
|
||||
{
|
||||
CHARSET_INFO *collation;
|
||||
if ((collation=
|
||||
get_charset_by_name(default_collation_name, MYF(MY_WME))))
|
||||
{
|
||||
if (!my_charset_same(mysql->charset, collation))
|
||||
{
|
||||
my_printf_error(ER_UNKNOWN_ERROR,
|
||||
"COLLATION %s is not valid for CHARACTER SET %s",
|
||||
MYF(0),
|
||||
default_collation_name, mysql->options.charset_name);
|
||||
mysql->charset= NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
mysql->charset= collation;
|
||||
}
|
||||
}
|
||||
else
|
||||
mysql->charset= NULL;
|
||||
}
|
||||
charsets_dir= save;
|
||||
}
|
||||
|
||||
|
||||
@@ -1038,7 +1038,7 @@ String *Item_func_left::val_str(String *str)
|
||||
long length =(long) args[1]->val_int();
|
||||
uint char_pos;
|
||||
|
||||
if ((null_value=args[0]->null_value))
|
||||
if ((null_value=(args[0]->null_value || args[1]->null_value)))
|
||||
return 0;
|
||||
if (length <= 0)
|
||||
return &my_empty_string;
|
||||
@@ -1078,7 +1078,7 @@ String *Item_func_right::val_str(String *str)
|
||||
String *res =args[0]->val_str(str);
|
||||
long length =(long) args[1]->val_int();
|
||||
|
||||
if ((null_value=args[0]->null_value))
|
||||
if ((null_value=(args[0]->null_value || args[1]->null_value)))
|
||||
return 0; /* purecov: inspected */
|
||||
if (length <= 0)
|
||||
return &my_empty_string; /* purecov: inspected */
|
||||
|
||||
Reference in New Issue
Block a user