Merge mysql.com:/nfsdisk1/lars/bkroot/mysql-5.0-rpl
into mysql.com:/nfsdisk1/lars/MERGE/mysql-5.0-merge sql/mysqld.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_select.cc: Auto merged
This commit is contained in:
commit
f47c23288a
@ -6,6 +6,6 @@ path=`dirname $0`
|
|||||||
extra_flags="$pentium_cflags $debug_cflags $max_cflags"
|
extra_flags="$pentium_cflags $debug_cflags $max_cflags"
|
||||||
c_warnings="$c_warnings $debug_extra_warnings"
|
c_warnings="$c_warnings $debug_extra_warnings"
|
||||||
cxx_warnings="$cxx_warnings $debug_extra_warnings"
|
cxx_warnings="$cxx_warnings $debug_extra_warnings"
|
||||||
extra_configs="$pentium_configs $debug_configs $max_configs"
|
extra_configs="$pentium_configs $debug_configs $max_configs --with-experimental-collations"
|
||||||
|
|
||||||
. "$path/FINISH.sh"
|
. "$path/FINISH.sh"
|
||||||
|
@ -2529,7 +2529,8 @@ print_table_data_xml(MYSQL_RES *result)
|
|||||||
|
|
||||||
tee_fputs("<?xml version=\"1.0\"?>\n\n<resultset statement=\"", PAGER);
|
tee_fputs("<?xml version=\"1.0\"?>\n\n<resultset statement=\"", PAGER);
|
||||||
xmlencode_print(glob_buffer.ptr(), (int)strlen(glob_buffer.ptr()));
|
xmlencode_print(glob_buffer.ptr(), (int)strlen(glob_buffer.ptr()));
|
||||||
tee_fputs("\">", PAGER);
|
tee_fputs("\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">",
|
||||||
|
PAGER);
|
||||||
|
|
||||||
fields = mysql_fetch_fields(result);
|
fields = mysql_fetch_fields(result);
|
||||||
while ((cur = mysql_fetch_row(result)))
|
while ((cur = mysql_fetch_row(result)))
|
||||||
|
@ -429,3 +429,16 @@ then
|
|||||||
else
|
else
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Shall we build experimental collations
|
||||||
|
AC_ARG_WITH(experimental-collations,
|
||||||
|
[],
|
||||||
|
[with_exp_coll=$withval],
|
||||||
|
[with_exp_coll=no]
|
||||||
|
)
|
||||||
|
|
||||||
|
if test "$with_exp_coll" = "yes"
|
||||||
|
then
|
||||||
|
AC_DEFINE([HAVE_UTF8_GENERAL_CS], [1], [certain Japanese customer])
|
||||||
|
fi
|
||||||
|
@ -7,7 +7,7 @@ insert into t1 values (1, 2, 'a&b a<b a>b');
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
<resultset statement="select * from t1
|
<resultset statement="select * from t1
|
||||||
">
|
" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
<row>
|
<row>
|
||||||
<field name="a&b">1</field>
|
<field name="a&b">1</field>
|
||||||
<field name="a<b">2</field>
|
<field name="a<b">2</field>
|
||||||
@ -34,7 +34,7 @@ insert into t1 values (1, 2, 'a&b a<b a>b');
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
<resultset statement="select count(*) from t1
|
<resultset statement="select count(*) from t1
|
||||||
">
|
" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
<row>
|
<row>
|
||||||
<field name="count(*)">1</field>
|
<field name="count(*)">1</field>
|
||||||
</row>
|
</row>
|
||||||
@ -42,7 +42,7 @@ insert into t1 values (1, 2, 'a&b a<b a>b');
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
<resultset statement="select 1 < 2 from dual
|
<resultset statement="select 1 < 2 from dual
|
||||||
">
|
" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
<row>
|
<row>
|
||||||
<field name="1 < 2">1</field>
|
<field name="1 < 2">1</field>
|
||||||
</row>
|
</row>
|
||||||
@ -50,7 +50,7 @@ insert into t1 values (1, 2, 'a&b a<b a>b');
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
<resultset statement="select 1 > 2 from dual
|
<resultset statement="select 1 > 2 from dual
|
||||||
">
|
" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
<row>
|
<row>
|
||||||
<field name="1 > 2">0</field>
|
<field name="1 > 2">0</field>
|
||||||
</row>
|
</row>
|
||||||
@ -58,7 +58,7 @@ insert into t1 values (1, 2, 'a&b a<b a>b');
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
<resultset statement="select 1 & 3 from dual
|
<resultset statement="select 1 & 3 from dual
|
||||||
">
|
" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
<row>
|
<row>
|
||||||
<field name="1 & 3">1</field>
|
<field name="1 & 3">1</field>
|
||||||
</row>
|
</row>
|
||||||
@ -66,7 +66,7 @@ insert into t1 values (1, 2, 'a&b a<b a>b');
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
<resultset statement="select null from dual
|
<resultset statement="select null from dual
|
||||||
">
|
" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
<row>
|
<row>
|
||||||
<field name="NULL" xsi:nil="true" />
|
<field name="NULL" xsi:nil="true" />
|
||||||
</row>
|
</row>
|
||||||
|
@ -2654,3 +2654,12 @@ ii 2 ii 2 İİ 4
|
|||||||
İİ 4 ii 2 İİ 4
|
İİ 4 ii 2 İİ 4
|
||||||
II 2 ıı 4 II 2
|
II 2 ıı 4 II 2
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
c1 text character set ucs2 collate ucs2_polish_ci NOT NULL
|
||||||
|
) ENGINE=MyISAM;
|
||||||
|
insert into t1 values (''),('a');
|
||||||
|
SELECT COUNT(*), c1 FROM t1 GROUP BY c1;
|
||||||
|
COUNT(*) c1
|
||||||
|
1
|
||||||
|
1 a
|
||||||
|
DROP TABLE IF EXISTS t1;
|
||||||
|
@ -839,6 +839,24 @@ lily
|
|||||||
river
|
river
|
||||||
drop table t1;
|
drop table t1;
|
||||||
deallocate prepare stmt;
|
deallocate prepare stmt;
|
||||||
|
set names latin1;
|
||||||
|
set character_set_connection=ucs2;
|
||||||
|
select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb');
|
||||||
|
soundex('') soundex('he') soundex('hello all folks') soundex('#3556 in bugdb')
|
||||||
|
H000 H4142 I51231
|
||||||
|
select hex(soundex('')),hex(soundex('he')),hex(soundex('hello all folks')),hex(soundex('#3556 in bugdb'));
|
||||||
|
hex(soundex('')) hex(soundex('he')) hex(soundex('hello all folks')) hex(soundex('#3556 in bugdb'))
|
||||||
|
0048003000300030 00480034003100340032 004900350031003200330031
|
||||||
|
select 'mood' sounds like 'mud';
|
||||||
|
'mood' sounds like 'mud'
|
||||||
|
1
|
||||||
|
select hex(soundex(_ucs2 0x041004110412));
|
||||||
|
hex(soundex(_ucs2 0x041004110412))
|
||||||
|
0410003000300030
|
||||||
|
select hex(soundex(_ucs2 0x00BF00C0));
|
||||||
|
hex(soundex(_ucs2 0x00BF00C0))
|
||||||
|
00C0003000300030
|
||||||
|
set names latin1;
|
||||||
create table t1(a blob, b text charset utf8, c text charset ucs2);
|
create table t1(a blob, b text charset utf8, c text charset ucs2);
|
||||||
select data_type, character_octet_length, character_maximum_length
|
select data_type, character_octet_length, character_maximum_length
|
||||||
from information_schema.columns where table_name='t1';
|
from information_schema.columns where table_name='t1';
|
||||||
|
@ -854,6 +854,18 @@ select * from t1 where soundex(a) = soundex('test');
|
|||||||
id a
|
id a
|
||||||
1 Test
|
1 Test
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
select soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB);
|
||||||
|
soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)
|
||||||
|
阅000
|
||||||
|
select hex(soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB));
|
||||||
|
hex(soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB))
|
||||||
|
E99885303030
|
||||||
|
select soundex(_utf8 0xD091D092D093);
|
||||||
|
soundex(_utf8 0xD091D092D093)
|
||||||
|
Б000
|
||||||
|
select hex(soundex(_utf8 0xD091D092D093));
|
||||||
|
hex(soundex(_utf8 0xD091D092D093))
|
||||||
|
D091303030
|
||||||
SET collation_connection='utf8_general_ci';
|
SET collation_connection='utf8_general_ci';
|
||||||
create table t1 select repeat('a',4000) a;
|
create table t1 select repeat('a',4000) a;
|
||||||
delete from t1;
|
delete from t1;
|
||||||
|
@ -18,6 +18,29 @@ create table t2 like t1;
|
|||||||
load data local infile 'MYSQLTEST_VARDIR/master-data/test/rpl_misc_functions.outfile' into table t2;
|
load data local infile 'MYSQLTEST_VARDIR/master-data/test/rpl_misc_functions.outfile' into table t2;
|
||||||
select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and t1.r2=t2.r2 and t1.p=t2.p);
|
select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and t1.r2=t2.r2 and t1.p=t2.p);
|
||||||
id i r1 r2 p id i r1 r2 p
|
id i r1 r2 p id i r1 r2 p
|
||||||
stop slave;
|
|
||||||
drop table t1;
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
DROP TABLE IF EXISTS t1;
|
||||||
|
CREATE TABLE t1 (col_a double default NULL);
|
||||||
|
CREATE PROCEDURE test_replication_sp1()
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO t1 VALUES (rand()), (rand());
|
||||||
|
INSERT INTO t1 VALUES (rand());
|
||||||
|
END|
|
||||||
|
CREATE PROCEDURE test_replication_sp2()
|
||||||
|
BEGIN
|
||||||
|
CALL test_replication_sp1();
|
||||||
|
CALL test_replication_sp1();
|
||||||
|
END|
|
||||||
|
CREATE FUNCTION test_replication_sf() RETURNS DOUBLE DETERMINISTIC
|
||||||
|
BEGIN
|
||||||
|
RETURN (rand() + rand());
|
||||||
|
END|
|
||||||
|
CALL test_replication_sp1();
|
||||||
|
CALL test_replication_sp2();
|
||||||
|
INSERT INTO t1 VALUES (test_replication_sf());
|
||||||
|
INSERT INTO t1 VALUES (test_replication_sf());
|
||||||
|
INSERT INTO t1 VALUES (test_replication_sf());
|
||||||
|
DROP PROCEDURE IF EXISTS test_replication_sp1;
|
||||||
|
DROP PROCEDURE IF EXISTS test_replication_sp2;
|
||||||
|
DROP FUNCTION IF EXISTS test_replication_sf;
|
||||||
|
DROP TABLE IF EXISTS t1;
|
||||||
|
@ -475,3 +475,13 @@ ALTER TABLE t1 MODIFY a VARCHAR(30) character set utf8 collate utf8_turkish_ci;
|
|||||||
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
|
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
|
||||||
FROM t1 ORDER BY id;
|
FROM t1 ORDER BY id;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #27079 Crash while grouping empty ucs2 strings
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
c1 text character set ucs2 collate ucs2_polish_ci NOT NULL
|
||||||
|
) ENGINE=MyISAM;
|
||||||
|
insert into t1 values (''),('a');
|
||||||
|
SELECT COUNT(*), c1 FROM t1 GROUP BY c1;
|
||||||
|
DROP TABLE IF EXISTS t1;
|
||||||
|
@ -572,6 +572,20 @@ select utext from t1 where utext like '%%';
|
|||||||
drop table t1;
|
drop table t1;
|
||||||
deallocate prepare stmt;
|
deallocate prepare stmt;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#22638 SOUNDEX broken for international characters
|
||||||
|
#
|
||||||
|
set names latin1;
|
||||||
|
set character_set_connection=ucs2;
|
||||||
|
select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb');
|
||||||
|
select hex(soundex('')),hex(soundex('he')),hex(soundex('hello all folks')),hex(soundex('#3556 in bugdb'));
|
||||||
|
select 'mood' sounds like 'mud';
|
||||||
|
# Cyrillic A, BE, VE
|
||||||
|
select hex(soundex(_ucs2 0x041004110412));
|
||||||
|
# Make sure that "U+00BF INVERTED QUESTION MARK" is not considered as letter
|
||||||
|
select hex(soundex(_ucs2 0x00BF00C0));
|
||||||
|
set names latin1;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug #14290: character_maximum_length for text fields
|
# Bug #14290: character_maximum_length for text fields
|
||||||
#
|
#
|
||||||
|
@ -702,6 +702,14 @@ select * from t1 where soundex(a) = soundex('TEST');
|
|||||||
select * from t1 where soundex(a) = soundex('test');
|
select * from t1 where soundex(a) = soundex('test');
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#22638 SOUNDEX broken for international characters
|
||||||
|
#
|
||||||
|
select soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB);
|
||||||
|
select hex(soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB));
|
||||||
|
select soundex(_utf8 0xD091D092D093);
|
||||||
|
select hex(soundex(_utf8 0xD091D092D093));
|
||||||
|
|
||||||
|
|
||||||
SET collation_connection='utf8_general_ci';
|
SET collation_connection='utf8_general_ci';
|
||||||
-- source include/ctype_filesort.inc
|
-- source include/ctype_filesort.inc
|
||||||
|
@ -28,10 +28,76 @@ create table t2 like t1;
|
|||||||
eval load data local infile '$MYSQLTEST_VARDIR/master-data/test/rpl_misc_functions.outfile' into table t2;
|
eval load data local infile '$MYSQLTEST_VARDIR/master-data/test/rpl_misc_functions.outfile' into table t2;
|
||||||
# compare them with the replica; the SELECT below should return no row
|
# compare them with the replica; the SELECT below should return no row
|
||||||
select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and t1.r2=t2.r2 and t1.p=t2.p);
|
select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and t1.r2=t2.r2 and t1.p=t2.p);
|
||||||
stop slave;
|
|
||||||
drop table t1;
|
|
||||||
|
|
||||||
connection master;
|
connection master;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
# End of 4.1 tests
|
# End of 4.1 tests
|
||||||
|
|
||||||
|
#
|
||||||
|
# BUG#25543 test calling rand() multiple times on the master in
|
||||||
|
# a stored procedure.
|
||||||
|
#
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
DROP TABLE IF EXISTS t1;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
CREATE TABLE t1 (col_a double default NULL);
|
||||||
|
|
||||||
|
DELIMITER |;
|
||||||
|
|
||||||
|
# Use a SP that calls rand() multiple times
|
||||||
|
CREATE PROCEDURE test_replication_sp1()
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO t1 VALUES (rand()), (rand());
|
||||||
|
INSERT INTO t1 VALUES (rand());
|
||||||
|
END|
|
||||||
|
|
||||||
|
# Use a SP that calls another SP to call rand() multiple times
|
||||||
|
CREATE PROCEDURE test_replication_sp2()
|
||||||
|
BEGIN
|
||||||
|
CALL test_replication_sp1();
|
||||||
|
CALL test_replication_sp1();
|
||||||
|
END|
|
||||||
|
|
||||||
|
# Use a SF that calls rand() multiple times
|
||||||
|
CREATE FUNCTION test_replication_sf() RETURNS DOUBLE DETERMINISTIC
|
||||||
|
BEGIN
|
||||||
|
RETURN (rand() + rand());
|
||||||
|
END|
|
||||||
|
|
||||||
|
DELIMITER ;|
|
||||||
|
|
||||||
|
# Exercise the functions and procedures then compare the results on
|
||||||
|
# the master to those on the slave.
|
||||||
|
CALL test_replication_sp1();
|
||||||
|
CALL test_replication_sp2();
|
||||||
|
INSERT INTO t1 VALUES (test_replication_sf());
|
||||||
|
INSERT INTO t1 VALUES (test_replication_sf());
|
||||||
|
INSERT INTO t1 VALUES (test_replication_sf());
|
||||||
|
|
||||||
|
# Record the results of the query on the master
|
||||||
|
--exec $MYSQL --port=$MASTER_MYPORT test -e "SELECT * FROM test.t1" > $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql
|
||||||
|
|
||||||
|
--sync_slave_with_master
|
||||||
|
|
||||||
|
# Record the results of the query on the slave
|
||||||
|
--exec $MYSQL --port=$SLAVE_MYPORT test -e "SELECT * FROM test.t1" > $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql
|
||||||
|
|
||||||
|
# Compare the results from the master to the slave.
|
||||||
|
--exec diff $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
connection master;
|
||||||
|
--disable_warnings
|
||||||
|
DROP PROCEDURE IF EXISTS test_replication_sp1;
|
||||||
|
DROP PROCEDURE IF EXISTS test_replication_sp2;
|
||||||
|
DROP FUNCTION IF EXISTS test_replication_sf;
|
||||||
|
DROP TABLE IF EXISTS t1;
|
||||||
|
--enable_warnings
|
||||||
|
--sync_slave_with_master
|
||||||
|
|
||||||
|
# If all is good, when can cleanup our dump files.
|
||||||
|
--system rm $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql
|
||||||
|
--system rm $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql
|
||||||
|
@ -1805,7 +1805,8 @@ void Item_func_soundex::fix_length_and_dec()
|
|||||||
{
|
{
|
||||||
collation.set(args[0]->collation);
|
collation.set(args[0]->collation);
|
||||||
max_length=args[0]->max_length;
|
max_length=args[0]->max_length;
|
||||||
set_if_bigger(max_length,4);
|
set_if_bigger(max_length, 4 * collation.collation->mbminlen);
|
||||||
|
tmp_value.set_charset(collation.collation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1815,14 +1816,15 @@ void Item_func_soundex::fix_length_and_dec()
|
|||||||
else return 0
|
else return 0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char soundex_toupper(char ch)
|
static int soundex_toupper(int ch)
|
||||||
{
|
{
|
||||||
return (ch >= 'a' && ch <= 'z') ? ch - 'a' + 'A' : ch;
|
return (ch >= 'a' && ch <= 'z') ? ch - 'a' + 'A' : ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char get_scode(char *ptr)
|
|
||||||
|
static char get_scode(int wc)
|
||||||
{
|
{
|
||||||
uchar ch= soundex_toupper(*ptr);
|
int ch= soundex_toupper(wc);
|
||||||
if (ch < 'A' || ch > 'Z')
|
if (ch < 'A' || ch > 'Z')
|
||||||
{
|
{
|
||||||
// Thread extended alfa (country spec)
|
// Thread extended alfa (country spec)
|
||||||
@ -1832,46 +1834,121 @@ static char get_scode(char *ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool my_uni_isalpha(int wc)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Return true for all Basic Latin letters: a..z A..Z.
|
||||||
|
Return true for all Unicode characters with code higher than U+00C0:
|
||||||
|
- characters between 'z' and U+00C0 are controls and punctuations.
|
||||||
|
- "U+00C0 LATIN CAPITAL LETTER A WITH GRAVE" is the first letter after 'z'.
|
||||||
|
*/
|
||||||
|
return (wc >= 'a' && wc <= 'z') ||
|
||||||
|
(wc >= 'A' && wc <= 'Z') ||
|
||||||
|
(wc >= 0xC0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
String *Item_func_soundex::val_str(String *str)
|
String *Item_func_soundex::val_str(String *str)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
String *res =args[0]->val_str(str);
|
String *res =args[0]->val_str(str);
|
||||||
char last_ch,ch;
|
char last_ch,ch;
|
||||||
CHARSET_INFO *cs= collation.collation;
|
CHARSET_INFO *cs= collation.collation;
|
||||||
|
my_wc_t wc;
|
||||||
|
uint nchars;
|
||||||
|
int rc;
|
||||||
|
|
||||||
if ((null_value= args[0]->null_value))
|
if ((null_value= args[0]->null_value))
|
||||||
return 0; /* purecov: inspected */
|
return 0; /* purecov: inspected */
|
||||||
|
|
||||||
if (tmp_value.alloc(max(res->length(),4)))
|
if (tmp_value.alloc(max(res->length(), 4 * cs->mbminlen)))
|
||||||
return str; /* purecov: inspected */
|
return str; /* purecov: inspected */
|
||||||
char *to= (char *) tmp_value.ptr();
|
char *to= (char *) tmp_value.ptr();
|
||||||
|
char *to_end= to + tmp_value.alloced_length();
|
||||||
char *from= (char *) res->ptr(), *end= from + res->length();
|
char *from= (char *) res->ptr(), *end= from + res->length();
|
||||||
tmp_value.set_charset(cs);
|
|
||||||
|
|
||||||
while (from != end && !my_isalpha(cs,*from)) // Skip pre-space
|
for ( ; ; ) /* Skip pre-space */
|
||||||
from++; /* purecov: inspected */
|
|
||||||
if (from == end)
|
|
||||||
return &my_empty_string; // No alpha characters.
|
|
||||||
*to++ = soundex_toupper(*from); // Copy first letter
|
|
||||||
last_ch = get_scode(from); // code of the first letter
|
|
||||||
// for the first 'double-letter check.
|
|
||||||
// Loop on input letters until
|
|
||||||
// end of input (null) or output
|
|
||||||
// letter code count = 3
|
|
||||||
for (from++ ; from < end ; from++)
|
|
||||||
{
|
{
|
||||||
if (!my_isalpha(cs,*from))
|
if ((rc= cs->cset->mb_wc(cs, &wc, (uchar*) from, (uchar*) end)) <= 0)
|
||||||
|
return &my_empty_string; /* EOL or invalid byte sequence */
|
||||||
|
|
||||||
|
if (rc == 1 && cs->ctype)
|
||||||
|
{
|
||||||
|
/* Single byte letter found */
|
||||||
|
if (my_isalpha(cs, *from))
|
||||||
|
{
|
||||||
|
last_ch= get_scode(*from); // Code of the first letter
|
||||||
|
*to++= soundex_toupper(*from++); // Copy first letter
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
from++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
from+= rc;
|
||||||
|
if (my_uni_isalpha(wc))
|
||||||
|
{
|
||||||
|
/* Multibyte letter found */
|
||||||
|
wc= soundex_toupper(wc);
|
||||||
|
last_ch= get_scode(wc); // Code of the first letter
|
||||||
|
if ((rc= cs->cset->wc_mb(cs, wc, (uchar*) to, (uchar*) to_end)) <= 0)
|
||||||
|
{
|
||||||
|
/* Extra safety - should not really happen */
|
||||||
|
DBUG_ASSERT(false);
|
||||||
|
return &my_empty_string;
|
||||||
|
}
|
||||||
|
to+= rc;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
last_ch is now set to the first 'double-letter' check.
|
||||||
|
loop on input letters until end of input
|
||||||
|
*/
|
||||||
|
for (nchars= 1 ; ; )
|
||||||
|
{
|
||||||
|
if ((rc= cs->cset->mb_wc(cs, &wc, (uchar*) from, (uchar*) end)) <= 0)
|
||||||
|
break; /* EOL or invalid byte sequence */
|
||||||
|
|
||||||
|
if (rc == 1 && cs->ctype)
|
||||||
|
{
|
||||||
|
if (!my_isalpha(cs, *from++))
|
||||||
continue;
|
continue;
|
||||||
ch=get_scode(from);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
from+= rc;
|
||||||
|
if (!my_uni_isalpha(wc))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ch= get_scode(wc);
|
||||||
if ((ch != '0') && (ch != last_ch)) // if not skipped or double
|
if ((ch != '0') && (ch != last_ch)) // if not skipped or double
|
||||||
{
|
{
|
||||||
*to++ = ch; // letter, copy to output
|
// letter, copy to output
|
||||||
|
if ((rc= cs->cset->wc_mb(cs, (my_wc_t) ch,
|
||||||
|
(uchar*) to, (uchar*) to_end)) <= 0)
|
||||||
|
{
|
||||||
|
// Extra safety - should not really happen
|
||||||
|
DBUG_ASSERT(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
to+= rc;
|
||||||
|
nchars++;
|
||||||
last_ch= ch; // save code of last input letter
|
last_ch= ch; // save code of last input letter
|
||||||
} // for next double-letter check
|
} // for next double-letter check
|
||||||
}
|
}
|
||||||
for (end=(char*) tmp_value.ptr()+4 ; to < end ; to++)
|
|
||||||
*to = '0';
|
/* Pad up to 4 characters with DIGIT ZERO, if the string is shorter */
|
||||||
*to=0; // end string
|
if (nchars < 4)
|
||||||
|
{
|
||||||
|
uint nbytes= (4 - nchars) * cs->mbminlen;
|
||||||
|
cs->cset->fill(cs, to, nbytes, '0');
|
||||||
|
to+= nbytes;
|
||||||
|
}
|
||||||
|
|
||||||
tmp_value.length((uint) (to-tmp_value.ptr()));
|
tmp_value.length((uint) (to-tmp_value.ptr()));
|
||||||
return &tmp_value;
|
return &tmp_value;
|
||||||
}
|
}
|
||||||
|
@ -544,7 +544,7 @@ TABLE_LIST *mysql_lock_have_duplicate(THD *thd, TABLE_LIST *needle,
|
|||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
/* A temporary table does not have locks. */
|
/* A temporary table does not have locks. */
|
||||||
if (table->s->tmp_table == TMP_TABLE)
|
if (table->s->tmp_table == NON_TRANSACTIONAL_TMP_TABLE)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
/* Get command lock or LOCK TABLES lock. Maybe empty for INSERT DELAYED. */
|
/* Get command lock or LOCK TABLES lock. Maybe empty for INSERT DELAYED. */
|
||||||
@ -569,7 +569,7 @@ TABLE_LIST *mysql_lock_have_duplicate(THD *thd, TABLE_LIST *needle,
|
|||||||
if (haystack->placeholder())
|
if (haystack->placeholder())
|
||||||
continue;
|
continue;
|
||||||
table2= haystack->table;
|
table2= haystack->table;
|
||||||
if (table2->s->tmp_table == TMP_TABLE)
|
if (table2->s->tmp_table == NON_TRANSACTIONAL_TMP_TABLE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* All tables in list must be in lock. */
|
/* All tables in list must be in lock. */
|
||||||
@ -655,7 +655,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
|
|||||||
*write_lock_used=0;
|
*write_lock_used=0;
|
||||||
for (i=tables=lock_count=0 ; i < count ; i++)
|
for (i=tables=lock_count=0 ; i < count ; i++)
|
||||||
{
|
{
|
||||||
if (table_ptr[i]->s->tmp_table != TMP_TABLE)
|
if (table_ptr[i]->s->tmp_table != NON_TRANSACTIONAL_TMP_TABLE)
|
||||||
{
|
{
|
||||||
tables+=table_ptr[i]->file->lock_count();
|
tables+=table_ptr[i]->file->lock_count();
|
||||||
lock_count++;
|
lock_count++;
|
||||||
@ -697,7 +697,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
|
|||||||
TABLE *table;
|
TABLE *table;
|
||||||
enum thr_lock_type lock_type;
|
enum thr_lock_type lock_type;
|
||||||
|
|
||||||
if ((table=table_ptr[i])->s->tmp_table == TMP_TABLE)
|
if ((table=table_ptr[i])->s->tmp_table == NON_TRANSACTIONAL_TMP_TABLE)
|
||||||
continue;
|
continue;
|
||||||
lock_type= table->reginfo.lock_type;
|
lock_type= table->reginfo.lock_type;
|
||||||
if (lock_type >= TL_WRITE_ALLOW_WRITE)
|
if (lock_type >= TL_WRITE_ALLOW_WRITE)
|
||||||
|
@ -6125,12 +6125,12 @@ The minimum value for this variable is 4096.",
|
|||||||
(gptr*) &max_system_variables.tmp_table_size, 0, GET_ULL,
|
(gptr*) &max_system_variables.tmp_table_size, 0, GET_ULL,
|
||||||
REQUIRED_ARG, 32*1024*1024L, 1024, MAX_MEM_TABLE_SIZE, 0, 1, 0},
|
REQUIRED_ARG, 32*1024*1024L, 1024, MAX_MEM_TABLE_SIZE, 0, 1, 0},
|
||||||
{"transaction_alloc_block_size", OPT_TRANS_ALLOC_BLOCK_SIZE,
|
{"transaction_alloc_block_size", OPT_TRANS_ALLOC_BLOCK_SIZE,
|
||||||
"Allocation block size for transactions to be stored in binary log",
|
"Allocation block size for various transaction-related structures",
|
||||||
(gptr*) &global_system_variables.trans_alloc_block_size,
|
(gptr*) &global_system_variables.trans_alloc_block_size,
|
||||||
(gptr*) &max_system_variables.trans_alloc_block_size, 0, GET_ULONG,
|
(gptr*) &max_system_variables.trans_alloc_block_size, 0, GET_ULONG,
|
||||||
REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ~0L, 0, 1024, 0},
|
REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ~0L, 0, 1024, 0},
|
||||||
{"transaction_prealloc_size", OPT_TRANS_PREALLOC_SIZE,
|
{"transaction_prealloc_size", OPT_TRANS_PREALLOC_SIZE,
|
||||||
"Persistent buffer for transactions to be stored in binary log",
|
"Persistent buffer for various transaction-related structures",
|
||||||
(gptr*) &global_system_variables.trans_prealloc_size,
|
(gptr*) &global_system_variables.trans_prealloc_size,
|
||||||
(gptr*) &max_system_variables.trans_prealloc_size, 0, GET_ULONG,
|
(gptr*) &max_system_variables.trans_prealloc_size, 0, GET_ULONG,
|
||||||
REQUIRED_ARG, TRANS_ALLOC_PREALLOC_SIZE, 1024, ~0L, 0, 1024, 0},
|
REQUIRED_ARG, TRANS_ALLOC_PREALLOC_SIZE, 1024, ~0L, 0, 1024, 0},
|
||||||
|
@ -2950,7 +2950,7 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
|
|||||||
share= tmp_table->s;
|
share= tmp_table->s;
|
||||||
tmp_table->reginfo.lock_type=TL_WRITE; // Simulate locked
|
tmp_table->reginfo.lock_type=TL_WRITE; // Simulate locked
|
||||||
share->tmp_table= (tmp_table->file->has_transactions() ?
|
share->tmp_table= (tmp_table->file->has_transactions() ?
|
||||||
TRANSACTIONAL_TMP_TABLE : TMP_TABLE);
|
TRANSACTIONAL_TMP_TABLE : NON_TRANSACTIONAL_TMP_TABLE);
|
||||||
share->table_cache_key= (char*) (tmp_table+1);
|
share->table_cache_key= (char*) (tmp_table+1);
|
||||||
share->db= share->table_cache_key;
|
share->db= share->table_cache_key;
|
||||||
share->key_length= (uint) (strmov(((char*) (share->table_name=
|
share->key_length= (uint) (strmov(((char*) (share->table_name=
|
||||||
|
@ -613,6 +613,18 @@ void THD::cleanup_after_query()
|
|||||||
clear_next_insert_id= 0;
|
clear_next_insert_id= 0;
|
||||||
next_insert_id= 0;
|
next_insert_id= 0;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
Reset rand_used so that detection of calls to rand() will save random
|
||||||
|
seeds if needed by the slave.
|
||||||
|
|
||||||
|
Do not reset rand_used if inside a stored function or trigger because
|
||||||
|
only the call to these operations is logged. Thus only the calling
|
||||||
|
statement needs to detect rand() calls made by its substatements. These
|
||||||
|
substatements must not set rand_used to 0 because it would remove the
|
||||||
|
detection of rand() by the calling statement.
|
||||||
|
*/
|
||||||
|
if (!in_sub_stmt)
|
||||||
|
rand_used= 0;
|
||||||
/* Free Items that were created during this execution */
|
/* Free Items that were created during this execution */
|
||||||
free_items();
|
free_items();
|
||||||
/* Reset where. */
|
/* Reset where. */
|
||||||
|
@ -179,7 +179,7 @@ exit:
|
|||||||
orig_table_list->table_name= (char*) table->s->table_name;
|
orig_table_list->table_name= (char*) table->s->table_name;
|
||||||
orig_table_list->table_name_length= strlen((char*)table->s->table_name);
|
orig_table_list->table_name_length= strlen((char*)table->s->table_name);
|
||||||
table->derived_select_number= first_select->select_number;
|
table->derived_select_number= first_select->select_number;
|
||||||
table->s->tmp_table= TMP_TABLE;
|
table->s->tmp_table= NON_TRANSACTIONAL_TMP_TABLE;
|
||||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||||
if (orig_table_list->referencing_view)
|
if (orig_table_list->referencing_view)
|
||||||
table->grant= orig_table_list->grant;
|
table->grant= orig_table_list->grant;
|
||||||
|
@ -9169,7 +9169,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
|||||||
table->s->table_name= table->s->path= tmpname;
|
table->s->table_name= table->s->path= tmpname;
|
||||||
table->s->db= "";
|
table->s->db= "";
|
||||||
table->s->blob_ptr_size= mi_portable_sizeof_char_ptr;
|
table->s->blob_ptr_size= mi_portable_sizeof_char_ptr;
|
||||||
table->s->tmp_table= TMP_TABLE;
|
table->s->tmp_table= NON_TRANSACTIONAL_TMP_TABLE;
|
||||||
table->s->db_low_byte_first=1; // True for HEAP and MyISAM
|
table->s->db_low_byte_first=1; // True for HEAP and MyISAM
|
||||||
table->s->table_charset= param->table_charset;
|
table->s->table_charset= param->table_charset;
|
||||||
table->s->keys_for_keyread.init();
|
table->s->keys_for_keyread.init();
|
||||||
|
@ -55,7 +55,8 @@ typedef struct st_grant_info
|
|||||||
ulong orig_want_privilege;
|
ulong orig_want_privilege;
|
||||||
} GRANT_INFO;
|
} GRANT_INFO;
|
||||||
|
|
||||||
enum tmp_table_type {NO_TMP_TABLE=0, TMP_TABLE=1, TRANSACTIONAL_TMP_TABLE=2,
|
enum tmp_table_type {NO_TMP_TABLE=0,
|
||||||
|
NON_TRANSACTIONAL_TMP_TABLE=1, TRANSACTIONAL_TMP_TABLE=2,
|
||||||
SYSTEM_TMP_TABLE=3};
|
SYSTEM_TMP_TABLE=3};
|
||||||
|
|
||||||
enum frm_type_enum
|
enum frm_type_enum
|
||||||
|
@ -6744,7 +6744,7 @@ typedef struct my_uca_scanner_handler_st
|
|||||||
int (*next)(my_uca_scanner *scanner);
|
int (*next)(my_uca_scanner *scanner);
|
||||||
} my_uca_scanner_handler;
|
} my_uca_scanner_handler;
|
||||||
|
|
||||||
static uint16 nochar[]= {0};
|
static uint16 nochar[]= {0,0};
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_CHARSET_ucs2
|
#ifdef HAVE_CHARSET_ucs2
|
||||||
@ -6769,13 +6769,32 @@ static void my_uca_scanner_init_ucs2(my_uca_scanner *scanner,
|
|||||||
CHARSET_INFO *cs __attribute__((unused)),
|
CHARSET_INFO *cs __attribute__((unused)),
|
||||||
const uchar *str, uint length)
|
const uchar *str, uint length)
|
||||||
{
|
{
|
||||||
/* Note, no needs to initialize scanner->wbeg */
|
scanner->wbeg= nochar;
|
||||||
|
if (length)
|
||||||
|
{
|
||||||
scanner->sbeg= str;
|
scanner->sbeg= str;
|
||||||
scanner->send= str + length - 2;
|
scanner->send= str + length - 2;
|
||||||
scanner->wbeg= nochar;
|
|
||||||
scanner->uca_length= cs->sort_order;
|
scanner->uca_length= cs->sort_order;
|
||||||
scanner->uca_weight= cs->sort_order_big;
|
scanner->uca_weight= cs->sort_order_big;
|
||||||
scanner->contractions= cs->contractions;
|
scanner->contractions= cs->contractions;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Sometimes this function is called with
|
||||||
|
str=NULL and length=0, which should be
|
||||||
|
considered as an empty string.
|
||||||
|
|
||||||
|
The above initialization is unsafe for such cases,
|
||||||
|
because scanner->send is initialized to (NULL-2), which is 0xFFFFFFFE.
|
||||||
|
Then we fall into an endless loop in my_uca_scanner_next_ucs2().
|
||||||
|
|
||||||
|
Do special initialization for the case when length=0.
|
||||||
|
Initialize scanner->sbeg to an address greater than scanner->send.
|
||||||
|
Next call of my_uca_scanner_next_ucs2() will correctly return with -1.
|
||||||
|
*/
|
||||||
|
scanner->sbeg= (uchar*) &nochar[1];
|
||||||
|
scanner->send= (uchar*) &nochar[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2764,6 +2764,7 @@ static int my_strnncoll_utf8_cs(CHARSET_INFO *cs,
|
|||||||
const uchar *te=t+tlen;
|
const uchar *te=t+tlen;
|
||||||
int save_diff = 0;
|
int save_diff = 0;
|
||||||
int diff;
|
int diff;
|
||||||
|
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
|
||||||
|
|
||||||
while ( s < se && t < te )
|
while ( s < se && t < te )
|
||||||
{
|
{
|
||||||
@ -2800,13 +2801,16 @@ static int my_strnncoll_utf8_cs(CHARSET_INFO *cs,
|
|||||||
|
|
||||||
static int my_strnncollsp_utf8_cs(CHARSET_INFO *cs,
|
static int my_strnncollsp_utf8_cs(CHARSET_INFO *cs,
|
||||||
const uchar *s, uint slen,
|
const uchar *s, uint slen,
|
||||||
const uchar *t, uint tlen)
|
const uchar *t, uint tlen,
|
||||||
|
my_bool diff_if_only_endspace_difference
|
||||||
|
__attribute__((unused)))
|
||||||
{
|
{
|
||||||
int s_res,t_res;
|
int s_res,t_res;
|
||||||
my_wc_t s_wc,t_wc;
|
my_wc_t s_wc,t_wc;
|
||||||
const uchar *se= s+slen;
|
const uchar *se= s+slen;
|
||||||
const uchar *te= t+tlen;
|
const uchar *te= t+tlen;
|
||||||
int save_diff = 0;
|
int save_diff = 0;
|
||||||
|
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
|
||||||
|
|
||||||
while ( s < se && t < te )
|
while ( s < se && t < te )
|
||||||
{
|
{
|
||||||
@ -2875,6 +2879,7 @@ static MY_COLLATION_HANDLER my_collation_cs_handler =
|
|||||||
my_strnncoll_utf8_cs,
|
my_strnncoll_utf8_cs,
|
||||||
my_strnncollsp_utf8_cs,
|
my_strnncollsp_utf8_cs,
|
||||||
my_strnxfrm_utf8,
|
my_strnxfrm_utf8,
|
||||||
|
my_strnxfrmlen_utf8,
|
||||||
my_like_range_simple,
|
my_like_range_simple,
|
||||||
my_wildcmp_mb,
|
my_wildcmp_mb,
|
||||||
my_strcasecmp_utf8,
|
my_strcasecmp_utf8,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user