mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 02:30:06 +01:00
Merge deer.(none):/home/hf/work/mysql-4.1.clean
into deer.(none):/home/hf/work/mysql-4.1.1676
This commit is contained in:
commit
5b32ce5b0d
26 changed files with 184 additions and 7 deletions
|
@ -206,8 +206,9 @@ typedef struct charset_info_st
|
|||
uchar state_map[256];
|
||||
uchar ident_map[256];
|
||||
uint strxfrm_multiply;
|
||||
uint mbminlen;
|
||||
uint mbmaxlen;
|
||||
char max_sort_char; /* For LIKE optimization */
|
||||
char max_sort_char; /* For LIKE optimization */
|
||||
|
||||
MY_CHARSET_HANDLER *cset;
|
||||
MY_COLLATION_HANDLER *coll;
|
||||
|
|
|
@ -2903,8 +2903,6 @@ row_search_for_mysql(
|
|||
|
||||
mtr_start(&mtr);
|
||||
|
||||
mtr_start(&mtr);
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/* PHASE 2: Try fast adaptive hash index search if possible */
|
||||
|
||||
|
|
|
@ -276,3 +276,51 @@ aardvara
|
|||
aardvark
|
||||
aardvarz
|
||||
DROP TABLE t1;
|
||||
SELECT HEX(_ucs2 0x0);
|
||||
HEX(_ucs2 0x0)
|
||||
0000
|
||||
SELECT HEX(_ucs2 0x01);
|
||||
HEX(_ucs2 0x01)
|
||||
0001
|
||||
SELECT HEX(_ucs2 0x012);
|
||||
HEX(_ucs2 0x012)
|
||||
0012
|
||||
SELECT HEX(_ucs2 0x0123);
|
||||
HEX(_ucs2 0x0123)
|
||||
0123
|
||||
SELECT HEX(_ucs2 0x01234);
|
||||
HEX(_ucs2 0x01234)
|
||||
00001234
|
||||
SELECT HEX(_ucs2 0x012345);
|
||||
HEX(_ucs2 0x012345)
|
||||
00012345
|
||||
SELECT HEX(_ucs2 0x0123456);
|
||||
HEX(_ucs2 0x0123456)
|
||||
00123456
|
||||
SELECT HEX(_ucs2 0x01234567);
|
||||
HEX(_ucs2 0x01234567)
|
||||
01234567
|
||||
SELECT HEX(_ucs2 0x012345678);
|
||||
HEX(_ucs2 0x012345678)
|
||||
000012345678
|
||||
SELECT HEX(_ucs2 0x0123456789);
|
||||
HEX(_ucs2 0x0123456789)
|
||||
000123456789
|
||||
SELECT HEX(_ucs2 0x0123456789A);
|
||||
HEX(_ucs2 0x0123456789A)
|
||||
00123456789A
|
||||
SELECT HEX(_ucs2 0x0123456789AB);
|
||||
HEX(_ucs2 0x0123456789AB)
|
||||
0123456789AB
|
||||
SELECT HEX(_ucs2 0x0123456789ABC);
|
||||
HEX(_ucs2 0x0123456789ABC)
|
||||
0000123456789ABC
|
||||
SELECT HEX(_ucs2 0x0123456789ABCD);
|
||||
HEX(_ucs2 0x0123456789ABCD)
|
||||
000123456789ABCD
|
||||
SELECT HEX(_ucs2 0x0123456789ABCDE);
|
||||
HEX(_ucs2 0x0123456789ABCDE)
|
||||
00123456789ABCDE
|
||||
SELECT HEX(_ucs2 0x0123456789ABCDEF);
|
||||
HEX(_ucs2 0x0123456789ABCDEF)
|
||||
0123456789ABCDEF
|
||||
|
|
|
@ -6,10 +6,19 @@ inet_ntoa(inet_aton("255.255.255.255.255.255.255.255"))
|
|||
NULL
|
||||
select inet_aton("255.255.255.255.255"),inet_aton("255.255.1.255"),inet_aton("0.1.255");
|
||||
inet_aton("255.255.255.255.255") inet_aton("255.255.1.255") inet_aton("0.1.255")
|
||||
1099511627775 4294902271 511
|
||||
1099511627775 4294902271 65791
|
||||
select inet_ntoa(1099511627775),inet_ntoa(4294902271),inet_ntoa(511);
|
||||
inet_ntoa(1099511627775) inet_ntoa(4294902271) inet_ntoa(511)
|
||||
NULL 255.255.1.255 0.0.1.255
|
||||
select hex(inet_aton('127'));
|
||||
hex(inet_aton('127'))
|
||||
7F
|
||||
select hex(inet_aton('127.1'));
|
||||
hex(inet_aton('127.1'))
|
||||
7F000001
|
||||
select hex(inet_aton('127.1.1'));
|
||||
hex(inet_aton('127.1.1'))
|
||||
7F010001
|
||||
select length(format('nan', 2)) > 0;
|
||||
length(format('nan', 2)) > 0
|
||||
1
|
||||
|
|
|
@ -197,3 +197,24 @@ DROP TABLE t1;
|
|||
# END OF Bug 1264 test
|
||||
#
|
||||
########################################################
|
||||
|
||||
|
||||
# Bug #2390
|
||||
# Check alignment
|
||||
#
|
||||
SELECT HEX(_ucs2 0x0);
|
||||
SELECT HEX(_ucs2 0x01);
|
||||
SELECT HEX(_ucs2 0x012);
|
||||
SELECT HEX(_ucs2 0x0123);
|
||||
SELECT HEX(_ucs2 0x01234);
|
||||
SELECT HEX(_ucs2 0x012345);
|
||||
SELECT HEX(_ucs2 0x0123456);
|
||||
SELECT HEX(_ucs2 0x01234567);
|
||||
SELECT HEX(_ucs2 0x012345678);
|
||||
SELECT HEX(_ucs2 0x0123456789);
|
||||
SELECT HEX(_ucs2 0x0123456789A);
|
||||
SELECT HEX(_ucs2 0x0123456789AB);
|
||||
SELECT HEX(_ucs2 0x0123456789ABC);
|
||||
SELECT HEX(_ucs2 0x0123456789ABCD);
|
||||
SELECT HEX(_ucs2 0x0123456789ABCDE);
|
||||
SELECT HEX(_ucs2 0x0123456789ABCDEF);
|
||||
|
|
|
@ -8,6 +8,10 @@ select inet_ntoa(inet_aton("255.255.255.255.255.255.255.255"));
|
|||
select inet_aton("255.255.255.255.255"),inet_aton("255.255.1.255"),inet_aton("0.1.255");
|
||||
select inet_ntoa(1099511627775),inet_ntoa(4294902271),inet_ntoa(511);
|
||||
|
||||
select hex(inet_aton('127'));
|
||||
select hex(inet_aton('127.1'));
|
||||
select hex(inet_aton('127.1.1'));
|
||||
|
||||
#
|
||||
# Test for core dump with nan
|
||||
#
|
||||
|
|
|
@ -131,7 +131,8 @@ static void simple_cs_init_functions(CHARSET_INFO *cs)
|
|||
cs->coll= &my_collation_8bit_simple_ci_handler;
|
||||
|
||||
cs->cset= &my_charset_8bit_handler;
|
||||
cs->mbmaxlen = 1;
|
||||
cs->mbminlen= 1;
|
||||
cs->mbmaxlen= 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -273,6 +274,7 @@ static int simple_cs_copy_data(CHARSET_INFO *to, CHARSET_INFO *from)
|
|||
if (create_fromuni(to))
|
||||
goto err;
|
||||
}
|
||||
to->mbminlen= 1;
|
||||
to->mbmaxlen= 1;
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -483,7 +483,7 @@ public:
|
|||
CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE)
|
||||
{
|
||||
collation.set(cs, dv);
|
||||
str_value.set(str,length,cs);
|
||||
str_value.set_or_copy_aligned(str,length,cs);
|
||||
/*
|
||||
We have to have a different max_length than 'length' here to
|
||||
ensure that we get the right length if we do use the item
|
||||
|
@ -499,7 +499,7 @@ public:
|
|||
CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE)
|
||||
{
|
||||
collation.set(cs, dv);
|
||||
str_value.set(str,length,cs);
|
||||
str_value.set_or_copy_aligned(str,length,cs);
|
||||
max_length= str_value.numchars()*cs->mbmaxlen;
|
||||
set_name(name_par,0,cs);
|
||||
decimals=NOT_FIXED_DEC;
|
||||
|
|
|
@ -2618,6 +2618,7 @@ longlong Item_func_inet_aton::val_int()
|
|||
const char *p,* end;
|
||||
char c = '.'; // we mark c to indicate invalid IP in case length is 0
|
||||
char buff[36];
|
||||
int dot_count= 0;
|
||||
|
||||
String *s,tmp(buff,sizeof(buff),&my_charset_bin);
|
||||
if (!(s = args[0]->val_str(&tmp))) // If null value
|
||||
|
@ -2636,6 +2637,7 @@ longlong Item_func_inet_aton::val_int()
|
|||
}
|
||||
else if (c == '.')
|
||||
{
|
||||
dot_count++;
|
||||
result= (result << 8) + (ulonglong) byte_result;
|
||||
byte_result = 0;
|
||||
}
|
||||
|
@ -2643,7 +2645,14 @@ longlong Item_func_inet_aton::val_int()
|
|||
goto err; // Invalid character
|
||||
}
|
||||
if (c != '.') // IP number can't end on '.'
|
||||
{
|
||||
switch (dot_count)
|
||||
{
|
||||
case 1: result<<= 8;
|
||||
case 2: result<<= 8;
|
||||
}
|
||||
return (result << 8) + (ulonglong) byte_result;
|
||||
}
|
||||
|
||||
err:
|
||||
null_value=1;
|
||||
|
|
|
@ -624,6 +624,19 @@ public:
|
|||
and are still in use by this thread
|
||||
*/
|
||||
TABLE *open_tables,*temporary_tables, *handler_tables, *derived_tables;
|
||||
/*
|
||||
During a MySQL session, one can lock tables in two modes: automatic
|
||||
or manual. In automatic mode all necessary tables are locked just before
|
||||
statement execution, and all acquired locks are stored in 'lock'
|
||||
member. Unlocking takes place automatically as well, when the
|
||||
statement ends.
|
||||
Manual mode comes into play when a user issues a 'LOCK TABLES'
|
||||
statement. In this mode the user can only use the locked tables.
|
||||
Trying to use any other tables will give an error. The locked tables are
|
||||
stored in 'locked_tables' member. Manual locking is described in
|
||||
the 'LOCK_TABLES' chapter of the MySQL manual.
|
||||
See also lock_tables() for details.
|
||||
*/
|
||||
MYSQL_LOCK *lock; /* Current locks */
|
||||
MYSQL_LOCK *locked_tables; /* Tables locked with LOCK */
|
||||
/*
|
||||
|
|
|
@ -228,6 +228,52 @@ bool String::copy(const char *str,uint32 arg_length, CHARSET_INFO *cs)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
** For real multi-byte, ascii incompatible charactser sets,
|
||||
** like UCS-2, add leading zeros if we have an incomplete character.
|
||||
** Thus,
|
||||
** SELECT _ucs2 0xAA
|
||||
** will automatically be converted into
|
||||
** SELECT _ucs2 0x00AA
|
||||
*/
|
||||
|
||||
bool String::set_or_copy_aligned(const char *str,uint32 arg_length,
|
||||
CHARSET_INFO *cs)
|
||||
{
|
||||
/* How many bytes are in incomplete character */
|
||||
uint32 offs= (arg_length % cs->mbminlen);
|
||||
|
||||
if (!offs) /* All characters are complete, just copy */
|
||||
{
|
||||
set(str, arg_length, cs);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
offs= cs->mbmaxlen - offs; /* How many zeros we should prepend */
|
||||
uint32 aligned_length= arg_length + offs;
|
||||
if (alloc(aligned_length))
|
||||
return TRUE;
|
||||
|
||||
/*
|
||||
Probably this condition is not really necessary
|
||||
because if aligned_length is 0 then offs is 0 too
|
||||
and we'll return after calling set().
|
||||
*/
|
||||
if ((str_length= aligned_length))
|
||||
{
|
||||
/*
|
||||
Note, this is only safe for little-endian UCS-2.
|
||||
If we add big-endian UCS-2 sometimes, this code
|
||||
will be more complicated. But it's OK for now.
|
||||
*/
|
||||
bzero((char*)Ptr, offs);
|
||||
memcpy(Ptr + offs, str, arg_length);
|
||||
}
|
||||
Ptr[aligned_length]=0;
|
||||
str_charset=cs;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Copy with charset convertion */
|
||||
|
||||
bool String::copy(const char *str, uint32 arg_length,
|
||||
|
|
|
@ -183,6 +183,7 @@ public:
|
|||
bool copy(); // Alloc string if not alloced
|
||||
bool copy(const String &s); // Allocate new string
|
||||
bool copy(const char *s,uint32 arg_length, CHARSET_INFO *cs); // Allocate new string
|
||||
bool set_or_copy_aligned(const char *s, uint32 arg_length, CHARSET_INFO *cs);
|
||||
bool copy(const char*s,uint32 arg_length, CHARSET_INFO *csfrom,
|
||||
CHARSET_INFO *csto);
|
||||
bool append(const String &s);
|
||||
|
|
|
@ -6281,6 +6281,7 @@ CHARSET_INFO my_charset_big5_chinese_ci=
|
|||
"",
|
||||
"",
|
||||
1, /* strxfrm_multiply */
|
||||
1, /* mbminlen */
|
||||
2, /* mbmaxlen */
|
||||
0,
|
||||
&my_charset_big5_handler,
|
||||
|
@ -6304,6 +6305,7 @@ CHARSET_INFO my_charset_big5_bin=
|
|||
"",
|
||||
"",
|
||||
1, /* strxfrm_multiply */
|
||||
1, /* mbminlen */
|
||||
2, /* mbmaxlen */
|
||||
0,
|
||||
&my_charset_big5_handler,
|
||||
|
|
|
@ -381,6 +381,7 @@ CHARSET_INFO my_charset_bin =
|
|||
NULL, /* tab_from_uni */
|
||||
"","",
|
||||
1, /* strxfrm_multiply */
|
||||
1, /* mbminlen */
|
||||
1, /* mbmaxlen */
|
||||
(char) 255, /* max_sort_char */
|
||||
&my_charset_handler,
|
||||
|
|
|
@ -631,6 +631,7 @@ CHARSET_INFO my_charset_latin2_czech_ci =
|
|||
idx_uni_8859_2, /* tab_from_uni */
|
||||
"","",
|
||||
4, /* strxfrm_multiply */
|
||||
1, /* mbminlen */
|
||||
1, /* mbmaxlen */
|
||||
0,
|
||||
&my_charset_8bit_handler,
|
||||
|
|
|
@ -8689,6 +8689,7 @@ CHARSET_INFO my_charset_euckr_korean_ci=
|
|||
"",
|
||||
"",
|
||||
1, /* strxfrm_multiply */
|
||||
1, /* mbminlen */
|
||||
2, /* mbmaxlen */
|
||||
0,
|
||||
&my_charset_handler,
|
||||
|
@ -8712,6 +8713,7 @@ CHARSET_INFO my_charset_euckr_bin=
|
|||
"",
|
||||
"",
|
||||
1, /* strxfrm_multiply */
|
||||
1, /* mbminlen */
|
||||
2, /* mbmaxlen */
|
||||
0,
|
||||
&my_charset_handler,
|
||||
|
|
|
@ -34,6 +34,7 @@ CHARSET_INFO compiled_charsets[] = {
|
|||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
|
|
|
@ -5740,6 +5740,7 @@ CHARSET_INFO my_charset_gb2312_chinese_ci=
|
|||
"",
|
||||
"",
|
||||
1, /* strxfrm_multiply */
|
||||
1, /* mbminlen */
|
||||
2, /* mbmaxlen */
|
||||
0,
|
||||
&my_charset_handler,
|
||||
|
@ -5762,6 +5763,7 @@ CHARSET_INFO my_charset_gb2312_bin=
|
|||
"",
|
||||
"",
|
||||
1, /* strxfrm_multiply */
|
||||
1, /* mbminlen */
|
||||
2, /* mbmaxlen */
|
||||
0,
|
||||
&my_charset_handler,
|
||||
|
|
|
@ -9936,6 +9936,7 @@ CHARSET_INFO my_charset_gbk_chinese_ci=
|
|||
"",
|
||||
"",
|
||||
1, /* strxfrm_multiply */
|
||||
1, /* mbminlen */
|
||||
2, /* mbmaxlen */
|
||||
0,
|
||||
&my_charset_handler,
|
||||
|
@ -9958,6 +9959,7 @@ CHARSET_INFO my_charset_gbk_bin=
|
|||
"",
|
||||
"",
|
||||
1, /* strxfrm_multiply */
|
||||
1, /* mbminlen */
|
||||
2, /* mbmaxlen */
|
||||
0,
|
||||
&my_charset_handler,
|
||||
|
|
|
@ -215,6 +215,7 @@ CHARSET_INFO my_charset_latin1=
|
|||
NULL, /* tab_from_uni */
|
||||
"","",
|
||||
1, /* strxfrm_multiply */
|
||||
1, /* mbminlen */
|
||||
1, /* mbmaxlen */
|
||||
0,
|
||||
&my_charset_handler,
|
||||
|
@ -410,6 +411,7 @@ CHARSET_INFO my_charset_latin1_german2_ci=
|
|||
NULL, /* tab_from_uni */
|
||||
"","",
|
||||
2, /* strxfrm_multiply */
|
||||
1, /* mbminlen */
|
||||
1, /* mbmaxlen */
|
||||
0,
|
||||
&my_charset_handler,
|
||||
|
@ -433,6 +435,7 @@ CHARSET_INFO my_charset_latin1_bin=
|
|||
"",
|
||||
"",
|
||||
1, /* strxfrm_multiply */
|
||||
1, /* mbminlen */
|
||||
1, /* mbmaxlen */
|
||||
0,
|
||||
&my_charset_handler,
|
||||
|
|
|
@ -4525,6 +4525,7 @@ CHARSET_INFO my_charset_sjis_japanese_ci=
|
|||
"",
|
||||
"",
|
||||
1, /* strxfrm_multiply */
|
||||
1, /* mbminlen */
|
||||
2, /* mbmaxlen */
|
||||
0,
|
||||
&my_charset_handler,
|
||||
|
@ -4547,6 +4548,7 @@ CHARSET_INFO my_charset_sjis_bin=
|
|||
"",
|
||||
"",
|
||||
1, /* strxfrm_multiply */
|
||||
1, /* mbminlen */
|
||||
2, /* mbmaxlen */
|
||||
0,
|
||||
&my_charset_handler,
|
||||
|
|
|
@ -956,6 +956,7 @@ CHARSET_INFO my_charset_tis620_thai_ci=
|
|||
"",
|
||||
"",
|
||||
4, /* strxfrm_multiply */
|
||||
1, /* mbminlen */
|
||||
1, /* mbmaxlen */
|
||||
0,
|
||||
&my_charset_handler,
|
||||
|
@ -978,6 +979,7 @@ CHARSET_INFO my_charset_tis620_bin=
|
|||
"",
|
||||
"",
|
||||
1, /* strxfrm_multiply */
|
||||
1, /* mbminlen */
|
||||
1, /* mbmaxlen */
|
||||
0,
|
||||
&my_charset_handler,
|
||||
|
|
|
@ -1322,6 +1322,7 @@ CHARSET_INFO my_charset_ucs2_general_ci=
|
|||
"",
|
||||
"",
|
||||
1, /* strxfrm_multiply */
|
||||
2, /* mbminlen */
|
||||
2, /* mbmaxlen */
|
||||
0,
|
||||
&my_charset_ucs2_handler,
|
||||
|
@ -1345,6 +1346,7 @@ CHARSET_INFO my_charset_ucs2_bin=
|
|||
"",
|
||||
"",
|
||||
1, /* strxfrm_multiply */
|
||||
2, /* mbminlen */
|
||||
2, /* mbmaxlen */
|
||||
0,
|
||||
&my_charset_ucs2_handler,
|
||||
|
|
|
@ -8480,6 +8480,7 @@ CHARSET_INFO my_charset_ujis_japanese_ci=
|
|||
NULL, /* tab_from_uni */
|
||||
"","",
|
||||
1, /* strxfrm_multiply */
|
||||
1, /* mbminlen */
|
||||
3, /* mbmaxlen */
|
||||
0,
|
||||
&my_charset_handler,
|
||||
|
@ -8502,6 +8503,7 @@ CHARSET_INFO my_charset_ujis_bin=
|
|||
NULL, /* tab_from_uni */
|
||||
"","",
|
||||
1, /* strxfrm_multiply */
|
||||
1, /* mbminlen */
|
||||
3, /* mbmaxlen */
|
||||
0,
|
||||
&my_charset_handler,
|
||||
|
|
|
@ -2006,6 +2006,7 @@ CHARSET_INFO my_charset_utf8_general_ci=
|
|||
"",
|
||||
"",
|
||||
1, /* strxfrm_multiply */
|
||||
1, /* mbminlen */
|
||||
3, /* mbmaxlen */
|
||||
0,
|
||||
&my_charset_handler,
|
||||
|
@ -2029,6 +2030,7 @@ CHARSET_INFO my_charset_utf8_bin=
|
|||
"",
|
||||
"",
|
||||
1, /* strxfrm_multiply */
|
||||
1, /* mbminlen */
|
||||
3, /* mbmaxlen */
|
||||
0,
|
||||
&my_charset_handler,
|
||||
|
|
|
@ -671,6 +671,7 @@ CHARSET_INFO my_charset_cp1250_czech_ci =
|
|||
idx_uni_cp1250, /* tab_from_uni */
|
||||
"","",
|
||||
2, /* strxfrm_multiply */
|
||||
1, /* mbminlen */
|
||||
1, /* mbmaxlen */
|
||||
0,
|
||||
&my_charset_8bit_handler,
|
||||
|
|
Loading…
Add table
Reference in a new issue