1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Merge xiphis.org:/usr/home/antony/work2/mysql-4.1

into  xiphis.org:/usr/home/antony/work2/merge-5.0


client/mysql.cc:
  Auto merged
client/mysqldump.c:
  Auto merged
client/mysqltest.c:
  Auto merged
myisam/ft_boolean_search.c:
  Auto merged
myisammrg/myrg_static.c:
  Auto merged
mysql-test/r/func_str.result:
  Auto merged
mysql-test/r/rpl_drop_temp.result:
  Auto merged
mysql-test/r/type_datetime.result:
  Auto merged
mysql-test/t/bigint.test:
  Auto merged
mysql-test/t/func_str.test:
  Auto merged
mysql-test/t/rpl_drop_temp.test:
  Auto merged
sql/field.cc:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sql_cache.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql-common/my_time.c:
  Auto merged
include/my_sys.h:
  manual merge 4.1->5.0
mysql-test/r/bigint.result:
  manual merge 4.1->5.0
mysql-test/r/subselect.result:
  manual merge 4.1->5.0
mysql-test/t/subselect.test:
  manual merge 4.1->5.0
mysys/charset.c:
  manual merge 4.1->5.0
sql/ha_ndbcluster.cc:
  manual merge 4.1->5.0
sql/item_strfunc.cc:
  manual merge 4.1->5.0
sql/sql_base.cc:
  manual merge 4.1->5.0
sql/sql_select.cc:
  manual merge 4.1->5.0
sql/sql_union.cc:
  manual merge 4.1->5.0
strings/Makefile.am:
  manual merge 4.1->5.0
tests/mysql_client_test.c:
  manual merge 4.1->5.0
This commit is contained in:
unknown
2005-08-11 12:18:53 +01:00
30 changed files with 467 additions and 82 deletions

View File

@ -1598,11 +1598,8 @@ You can turn off this feature to get a quicker startup with -A\n\n");
mysql_free_result(fields);
}
else
{
tee_fprintf(stdout,
"Didn't find any fields in table '%s'\n",table_row[0]);
field_names[i]= 0;
}
i++;
}
mysql_free_result(tables);

View File

@ -2781,6 +2781,7 @@ static int run_query_normal(MYSQL* mysql, struct st_query* q, int flags)
if (!disable_result_log)
{
ulong affected_rows; /* Ok to be undef if 'disable_info' is set */
LINT_INIT(affected_rows);
if (res)
{

View File

@ -866,6 +866,11 @@ extern void add_compiled_collation(CHARSET_INFO *cs);
extern ulong escape_string_for_mysql(CHARSET_INFO *charset_info,
char *to, ulong to_length,
const char *from, ulong length);
#ifdef __WIN__
#define BACKSLASH_MBTAIL
/* File system character set */
extern CHARSET_INFO *fs_character_set(void);
#endif
extern ulong escape_quotes_for_mysql(CHARSET_INFO *charset_info,
char *to, ulong to_length,
const char *from, ulong length);

View File

@ -221,6 +221,7 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
MI_INFO *info=ftb->info;
uint off, extra=HA_FT_WLEN+info->s->base.rec_reflength;
byte *lastkey_buf=ftbw->word+ftbw->off;
LINT_INIT(off);
LINT_INIT(off);
if (ftbw->flags & FTB_FLAG_TRUNC)

View File

@ -17,6 +17,15 @@ select 9223372036854775808+1;
select -(0-3),round(-(0-3)), round(9999999999999999999);
-(0-3) round(-(0-3)) round(9999999999999999999)
3 3 9999999999999999999
select 1,11,101,1001,10001,100001,1000001,10000001,100000001,1000000001,10000000001,100000000001,1000000000001,10000000000001,100000000000001,1000000000000001,10000000000000001,100000000000000001,1000000000000000001,10000000000000000001;
1 11 101 1001 10001 100001 1000001 10000001 100000001 1000000001 10000000001 100000000001 1000000000001 10000000000001 100000000000001 1000000000000001 10000000000000001 100000000000000001 1000000000000000001 10000000000000000001
1 11 101 1001 10001 100001 1000001 10000001 100000001 1000000001 10000000001 100000000001 1000000000001 10000000000001 100000000000001 1000000000000001 10000000000000001 100000000000000001 1000000000000000001 10000000000000000001
select -1,-11,-101,-1001,-10001,-100001,-1000001,-10000001,-100000001,-1000000001,-10000000001,-100000000001,-1000000000001,-10000000000001,-100000000000001,-1000000000000001,-10000000000000001,-100000000000000001,-1000000000000000001,-10000000000000000001;
-1 -11 -101 -1001 -10001 -100001 -1000001 -10000001 -100000001 -1000000001 -10000000001 -100000000001 -1000000000001 -10000000000001 -100000000000001 -1000000000000001 -10000000000000001 -100000000000000001 -1000000000000000001 -10000000000000000001
-1 -11 -101 -1001 -10001 -100001 -1000001 -10000001 -100000001 -1000000001 -10000000001 -100000000001 -1000000000001 -10000000000001 -100000000000001 -1000000000000001 -10000000000000001 -100000000000000001 -1000000000000000001 -10000000000000000000
select conv(1,10,16),conv((1<<2)-1,10,16),conv((1<<10)-2,10,16),conv((1<<16)-3,10,16),conv((1<<25)-4,10,16),conv((1<<31)-5,10,16),conv((1<<36)-6,10,16),conv((1<<47)-7,10,16),conv((1<<48)-8,10,16),conv((1<<55)-9,10,16),conv((1<<56)-10,10,16),conv((1<<63)-11,10,16);
conv(1,10,16) conv((1<<2)-1,10,16) conv((1<<10)-2,10,16) conv((1<<16)-3,10,16) conv((1<<25)-4,10,16) conv((1<<31)-5,10,16) conv((1<<36)-6,10,16) conv((1<<47)-7,10,16) conv((1<<48)-8,10,16) conv((1<<55)-9,10,16) conv((1<<56)-10,10,16) conv((1<<63)-11,10,16)
1 3 3FE FFFD 1FFFFFC 7FFFFFFB FFFFFFFFA 7FFFFFFFFFF9 FFFFFFFFFFF8 7FFFFFFFFFFFF7 FFFFFFFFFFFFF6 7FFFFFFFFFFFFFF5
create table t1 (a bigint unsigned not null, primary key(a));
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
select * from t1;

View File

@ -45,6 +45,123 @@ www. .se
select substring_index('.tcx.se','.',-2),substring_index('.tcx.se','.tcx',-1);
substring_index('.tcx.se','.',-2) substring_index('.tcx.se','.tcx',-1)
tcx.se .se
select substring_index('aaaaaaaaa1','a',1);
substring_index('aaaaaaaaa1','a',1)
select substring_index('aaaaaaaaa1','aa',1);
substring_index('aaaaaaaaa1','aa',1)
select substring_index('aaaaaaaaa1','aa',2);
substring_index('aaaaaaaaa1','aa',2)
aa
select substring_index('aaaaaaaaa1','aa',3);
substring_index('aaaaaaaaa1','aa',3)
aaaa
select substring_index('aaaaaaaaa1','aa',4);
substring_index('aaaaaaaaa1','aa',4)
aaaaaa
select substring_index('aaaaaaaaa1','aa',5);
substring_index('aaaaaaaaa1','aa',5)
aaaaaaaaa1
select substring_index('aaaaaaaaa1','aaa',1);
substring_index('aaaaaaaaa1','aaa',1)
select substring_index('aaaaaaaaa1','aaa',2);
substring_index('aaaaaaaaa1','aaa',2)
aaa
select substring_index('aaaaaaaaa1','aaa',3);
substring_index('aaaaaaaaa1','aaa',3)
aaaaaa
select substring_index('aaaaaaaaa1','aaa',4);
substring_index('aaaaaaaaa1','aaa',4)
aaaaaaaaa1
select substring_index('aaaaaaaaa1','aaaa',1);
substring_index('aaaaaaaaa1','aaaa',1)
select substring_index('aaaaaaaaa1','aaaa',2);
substring_index('aaaaaaaaa1','aaaa',2)
aaaa
select substring_index('aaaaaaaaa1','1',1);
substring_index('aaaaaaaaa1','1',1)
aaaaaaaaa
select substring_index('aaaaaaaaa1','a',-1);
substring_index('aaaaaaaaa1','a',-1)
1
select substring_index('aaaaaaaaa1','aa',-1);
substring_index('aaaaaaaaa1','aa',-1)
1
select substring_index('aaaaaaaaa1','aa',-2);
substring_index('aaaaaaaaa1','aa',-2)
aa1
select substring_index('aaaaaaaaa1','aa',-3);
substring_index('aaaaaaaaa1','aa',-3)
aaaa1
select substring_index('aaaaaaaaa1','aa',-4);
substring_index('aaaaaaaaa1','aa',-4)
aaaaaa1
select substring_index('aaaaaaaaa1','aa',-5);
substring_index('aaaaaaaaa1','aa',-5)
aaaaaaaaa1
select substring_index('aaaaaaaaa1','aaa',-1);
substring_index('aaaaaaaaa1','aaa',-1)
1
select substring_index('aaaaaaaaa1','aaa',-2);
substring_index('aaaaaaaaa1','aaa',-2)
aaa1
select substring_index('aaaaaaaaa1','aaa',-3);
substring_index('aaaaaaaaa1','aaa',-3)
aaaaaa1
select substring_index('aaaaaaaaa1','aaa',-4);
substring_index('aaaaaaaaa1','aaa',-4)
select substring_index('the king of thethe hill','the',-2);
substring_index('the king of thethe hill','the',-2)
the hill
select substring_index('the king of the the hill','the',-2);
substring_index('the king of the the hill','the',-2)
the hill
select substring_index('the king of the the hill','the',-2);
substring_index('the king of the the hill','the',-2)
the hill
select substring_index('the king of the the hill',' the ',-1);
substring_index('the king of the the hill',' the ',-1)
hill
select substring_index('the king of the the hill',' the ',-2);
substring_index('the king of the the hill',' the ',-2)
the hill
select substring_index('the king of the the hill',' ',-1);
substring_index('the king of the the hill',' ',-1)
hill
select substring_index('the king of the the hill',' ',-2);
substring_index('the king of the the hill',' ',-2)
the hill
select substring_index('the king of the the hill',' ',-3);
substring_index('the king of the the hill',' ',-3)
the hill
select substring_index('the king of the the hill',' ',-4);
substring_index('the king of the the hill',' ',-4)
the the hill
select substring_index('the king of the the hill',' ',-5);
substring_index('the king of the the hill',' ',-5)
of the the hill
select substring_index('the king of the.the hill','the',-2);
substring_index('the king of the.the hill','the',-2)
.the hill
select substring_index('the king of thethethe.the hill','the',-3);
substring_index('the king of thethethe.the hill','the',-3)
the.the hill
select substring_index('the king of thethethe.the hill','the',-1);
substring_index('the king of thethethe.the hill','the',-1)
hill
select substring_index('the king of the the hill','the',1);
substring_index('the king of the the hill','the',1)
select substring_index('the king of the the hill','the',2);
substring_index('the king of the the hill','the',2)
the king of
select substring_index('the king of the the hill','the',3);
substring_index('the king of the the hill','the',3)
the king of the
select concat(':',ltrim(' left '),':',rtrim(' right '),':');
concat(':',ltrim(' left '),':',rtrim(' right '),':')
:left : right:

View File

@ -80,4 +80,18 @@ show status like "Qcache_free_blocks";
Variable_name Value
Qcache_free_blocks 1
drop table t1, t2, t3, t11, t21;
CREATE TABLE t1 ( a INT NOT NULL PRIMARY KEY AUTO_INCREMENT ) ENGINE =
MyISAM;
LOCK TABLE t1 READ LOCAL;
INSERT INTO t1 VALUES (), (), ();
SELECT * FROM t1;
a
SELECT * FROM t1;
a
1
2
3
SELECT * FROM t1;
a
drop table t1;
set GLOBAL query_cache_size=0;

View File

@ -2753,7 +2753,28 @@ WHERE ROW(one,two) IN (SELECT DISTINCT one,two FROM t1 WHERE flag = 'N');
one two flag
5 6 N
7 8 N
insert into t2 values (null,null,'N');
SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N') as 'test' from t1;
one two test
1 2 0
2 3 0
3 4 0
5 6 1
7 8 1
SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N' group by one,two) as 'test' from t1;
one two test
1 2 NULL
2 3 NULL
3 4 NULL
5 6 1
7 8 1
DROP TABLE t1,t2;
CREATE TABLE t1 (a char(5), b char(5));
INSERT INTO t1 VALUES (NULL,'aaa'), ('aaa','aaa');
SELECT * FROM t1 WHERE (a,b) IN (('aaa','aaa'), ('aaa','bbb'));
a b
aaa aaa
DROP TABLE t1;
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
insert into t1 values(2.2);

View File

@ -26,6 +26,8 @@ Table Op Msg_type Msg_text
test.t1 check status OK
delete from t1;
insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030100000000"),("20030000000000");
insert into t1 values ("2003-003-03");
insert into t1 values ("20030102T131415"),("2001-01-01T01:01:01"), ("2001-1-1T1:01:01");
select * from t1;
t
2000-01-01 00:00:00
@ -43,6 +45,17 @@ t
9999-12-31 23:59:59
2003-01-00 00:00:00
2003-00-00 00:00:00
2003-03-03 00:00:00
2003-01-02 13:14:15
2001-01-01 01:01:01
2001-01-01 01:01:01
truncate table t1;
insert into t1 values("2003-0303 12:13:14");
Warnings:
Warning 1264 Data truncated; out of range for column 't' at row 1
select * from t1;
t
0000-00-00 00:00:00
drop table t1;
CREATE TABLE t1 (a timestamp, b date, c time, d datetime);
insert into t1 (b,c,d) values(now(),curtime(),now());
@ -153,13 +166,3 @@ dt
0000-00-00 00:00:00
0000-00-00 00:00:00
drop table t1;
create table t1 (dt datetime);
insert into t1 values ("20010101T010101");
insert into t1 values ("2001-01-01T01:01:01");
insert into t1 values ("2001-1-1T1:01:01");
select * from t1;
dt
2001-01-01 01:01:01
2001-01-01 01:01:01
2001-01-01 01:01:01
drop table t1;

View File

@ -14,6 +14,9 @@ select +9999999999999999999,-9999999999999999999;
select cast(9223372036854775808 as unsigned)+1;
select 9223372036854775808+1;
select -(0-3),round(-(0-3)), round(9999999999999999999);
select 1,11,101,1001,10001,100001,1000001,10000001,100000001,1000000001,10000000001,100000000001,1000000000001,10000000000001,100000000000001,1000000000000001,10000000000000001,100000000000000001,1000000000000000001,10000000000000000001;
select -1,-11,-101,-1001,-10001,-100001,-1000001,-10000001,-100000001,-1000000001,-10000000001,-100000000001,-1000000000001,-10000000000001,-100000000000001,-1000000000000001,-10000000000000001,-100000000000000001,-1000000000000000001,-10000000000000000001;
select conv(1,10,16),conv((1<<2)-1,10,16),conv((1<<10)-2,10,16),conv((1<<16)-3,10,16),conv((1<<25)-4,10,16),conv((1<<31)-5,10,16),conv((1<<36)-6,10,16),conv((1<<47)-7,10,16),conv((1<<48)-8,10,16),conv((1<<55)-9,10,16),conv((1<<56)-10,10,16),conv((1<<63)-11,10,16);
#
# In 3.23 we have to disable the test of column to bigint as

View File

@ -23,6 +23,45 @@ select concat('',left(right(concat('what ',concat('is ','happening')),9),4),'',s
select substring_index('www.tcx.se','.',-2),substring_index('www.tcx.se','.',1);
select substring_index('www.tcx.se','tcx',1),substring_index('www.tcx.se','tcx',-1);
select substring_index('.tcx.se','.',-2),substring_index('.tcx.se','.tcx',-1);
select substring_index('aaaaaaaaa1','a',1);
select substring_index('aaaaaaaaa1','aa',1);
select substring_index('aaaaaaaaa1','aa',2);
select substring_index('aaaaaaaaa1','aa',3);
select substring_index('aaaaaaaaa1','aa',4);
select substring_index('aaaaaaaaa1','aa',5);
select substring_index('aaaaaaaaa1','aaa',1);
select substring_index('aaaaaaaaa1','aaa',2);
select substring_index('aaaaaaaaa1','aaa',3);
select substring_index('aaaaaaaaa1','aaa',4);
select substring_index('aaaaaaaaa1','aaaa',1);
select substring_index('aaaaaaaaa1','aaaa',2);
select substring_index('aaaaaaaaa1','1',1);
select substring_index('aaaaaaaaa1','a',-1);
select substring_index('aaaaaaaaa1','aa',-1);
select substring_index('aaaaaaaaa1','aa',-2);
select substring_index('aaaaaaaaa1','aa',-3);
select substring_index('aaaaaaaaa1','aa',-4);
select substring_index('aaaaaaaaa1','aa',-5);
select substring_index('aaaaaaaaa1','aaa',-1);
select substring_index('aaaaaaaaa1','aaa',-2);
select substring_index('aaaaaaaaa1','aaa',-3);
select substring_index('aaaaaaaaa1','aaa',-4);
select substring_index('the king of thethe hill','the',-2);
select substring_index('the king of the the hill','the',-2);
select substring_index('the king of the the hill','the',-2);
select substring_index('the king of the the hill',' the ',-1);
select substring_index('the king of the the hill',' the ',-2);
select substring_index('the king of the the hill',' ',-1);
select substring_index('the king of the the hill',' ',-2);
select substring_index('the king of the the hill',' ',-3);
select substring_index('the king of the the hill',' ',-4);
select substring_index('the king of the the hill',' ',-5);
select substring_index('the king of the.the hill','the',-2);
select substring_index('the king of thethethe.the hill','the',-3);
select substring_index('the king of thethethe.the hill','the',-1);
select substring_index('the king of the the hill','the',1);
select substring_index('the king of the the hill','the',2);
select substring_index('the king of the the hill','the',3);
select concat(':',ltrim(' left '),':',rtrim(' right '),':');
select concat(':',trim(leading from ' left '),':',trim(trailing from ' right '),':');

View File

@ -78,4 +78,23 @@ show status like "Qcache_total_blocks";
show status like "Qcache_free_blocks";
drop table t1, t2, t3, t11, t21;
#
# do not use QC if tables locked (BUG#12385)
#
connect (root,localhost,root,,test,$MASTER_MYPORT,master.sock);
connection root;
CREATE TABLE t1 ( a INT NOT NULL PRIMARY KEY AUTO_INCREMENT ) ENGINE =
MyISAM;
LOCK TABLE t1 READ LOCAL;
connect (root2,localhost,root,,test,$MASTER_MYPORT,master.sock);
connection root2;
INSERT INTO t1 VALUES (), (), ();
connection root;
SELECT * FROM t1;
connection root2;
SELECT * FROM t1;
connection root;
SELECT * FROM t1;
drop table t1;
set GLOBAL query_cache_size=0;

View File

@ -1773,8 +1773,23 @@ SELECT * FROM t1
SELECT * FROM t1
WHERE ROW(one,two) IN (SELECT DISTINCT one,two FROM t1 WHERE flag = 'N');
insert into t2 values (null,null,'N');
SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N') as 'test' from t1;
SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N' group by one,two) as 'test' from t1;
DROP TABLE t1,t2;
#
# Bug #12392: where cond with IN predicate for rows and NULL values in table
#
CREATE TABLE t1 (a char(5), b char(5));
INSERT INTO t1 VALUES (NULL,'aaa'), ('aaa','aaa');
SELECT * FROM t1 WHERE (a,b) IN (('aaa','aaa'), ('aaa','bbb'));
DROP TABLE t1;
# End of 4.1 tests
#

View File

@ -14,6 +14,17 @@ optimize table t1;
check table t1;
delete from t1;
insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030100000000"),("20030000000000");
# Strange dates
insert into t1 values ("2003-003-03");
# Bug #7308: ISO-8601 date format not handled correctly
insert into t1 values ("20030102T131415"),("2001-01-01T01:01:01"), ("2001-1-1T1:01:01");
select * from t1;
# Test some wrong dates
truncate table t1;
insert into t1 values("2003-0303 12:13:14");
select * from t1;
drop table t1;
@ -102,14 +113,4 @@ insert into t1 values ("00-00-00"), ("00-00-00 00:00:00");
select * from t1;
drop table t1;
#
# Bug #7308: ISO-8601 date format not handled correctly
#
create table t1 (dt datetime);
insert into t1 values ("20010101T010101");
insert into t1 values ("2001-01-01T01:01:01");
insert into t1 values ("2001-1-1T1:01:01");
select * from t1;
drop table t1;
# End of 4.1 tests

View File

@ -679,6 +679,32 @@ ulong escape_string_for_mysql(CHARSET_INFO *charset_info,
}
#ifdef BACKSLASH_MBTAIL
static CHARSET_INFO *fs_cset_cache= NULL;
CHARSET_INFO *fs_character_set()
{
if (!fs_cset_cache)
{
char buf[10]= "cp";
GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_IDEFAULTANSICODEPAGE,
buf+2, sizeof(buf)-3);
/*
We cannot call get_charset_by_name here
because fs_character_set() is executed before
LOCK_THD_charset mutex initialization, which
is used inside get_charset_by_name.
As we're now interested in cp932 only,
let's just detect it using strcmp().
*/
fs_cset_cache= !strcmp(buf, "cp932") ?
&my_charset_cp932_japanese_ci : &my_charset_bin;
}
return fs_cset_cache;
}
#endif
/*
Escape apostrophes by doubling them up

View File

@ -22,6 +22,9 @@
uint dirname_length(const char *name)
{
register my_string pos,gpos;
#ifdef BASKSLASH_MBTAIL
CHARSET_INFO *fs= fs_character_set();
#endif
#ifdef FN_DEVCHAR
if ((pos=(char*)strrchr(name,FN_DEVCHAR)) == 0)
#endif
@ -29,12 +32,22 @@ uint dirname_length(const char *name)
gpos= pos++;
for ( ; *pos ; pos++) /* Find last FN_LIBCHAR */
{
#ifdef BASKSLASH_MBTAIL
uint l;
if (use_mb(fs) && (l= my_ismbchar(fs, pos, pos + 3)))
{
pos+= l - 1;
continue;
}
#endif
if (*pos == FN_LIBCHAR || *pos == '/'
#ifdef FN_C_AFTER_DIR
|| *pos == FN_C_AFTER_DIR || *pos == FN_C_AFTER_DIR_2
#endif
)
gpos=pos;
}
return ((uint) (uint) (gpos+1-(char*) name));
}
@ -85,6 +98,9 @@ uint dirname_part(my_string to, const char *name)
char *convert_dirname(char *to, const char *from, const char *from_end)
{
char *to_org=to;
#ifdef BACKSLASH_MBTAIL
CHARSET_INFO *fs= fs_character_set();
#endif
/* We use -2 here, becasue we need place for the last FN_LIBCHAR */
if (!from_end || (from_end - from) > FN_REFLEN-2)
@ -103,7 +119,22 @@ char *convert_dirname(char *to, const char *from, const char *from_end)
*to++= FN_C_AFTER_DIR;
#endif
else
*to++= *from;
{
#ifdef BACKSLASH_MBTAIL
uint l;
if (use_mb(fs) && (l= my_ismbchar(fs, from, from + 3)))
{
memmove(to, from, l);
to+= l;
from+= l - 1;
to_org= to; /* Don't look inside mbchar */
}
else
#endif
{
*to++= *from;
}
}
}
*to=0;
}

View File

@ -124,6 +124,9 @@ uint cleanup_dirname(register my_string to, const char *from)
reg4 my_string start;
char parent[5], /* for "FN_PARENTDIR" */
buff[FN_REFLEN+1],*end_parentdir;
#ifdef BACKSLASH_MBTAIL
CHARSET_INFO *fs= fs_character_set();
#endif
DBUG_ENTER("cleanup_dirname");
DBUG_PRINT("enter",("from: '%s'",from));
@ -141,6 +144,15 @@ uint cleanup_dirname(register my_string to, const char *from)
length=(uint) (strmov(parent+1,FN_PARENTDIR)-parent);
for (pos=start ; (*pos= *from_ptr++) != 0 ; pos++)
{
#ifdef BACKSLASH_MBTAIL
uint l;
if (use_mb(fs) && (l= my_ismbchar(fs, from_ptr - 1, from_ptr + 2)))
{
for (l-- ; l ; *++pos= *from_ptr++, l--);
start= pos + 1; /* Don't look inside multi-byte char */
continue;
}
#endif
if (*pos == '/')
*pos = FN_LIBCHAR;
if (*pos == FN_LIBCHAR)

View File

@ -58,7 +58,7 @@ LogHandler::append(const char* pCategory, Logger::LoggerLevel level,
}
else // repeated message
{
if (now < m_last_log_time+m_max_repeat_frequency)
if (now < (time_t) (m_last_log_time+m_max_repeat_frequency))
{
m_count_repeated_messages++;
m_now= now;

View File

@ -197,7 +197,9 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
If length= 8 or >= 14 then year is of format YYYY.
(YYYY-MM-DD, YYYYMMDD, YYYYYMMDDHHMMSS)
*/
for (pos=str; pos != end && my_isdigit(&my_charset_latin1,*pos) ; pos++)
for (pos=str;
pos != end && (my_isdigit(&my_charset_latin1,*pos) || *pos == 'T');
pos++)
;
digits= (uint) (pos-str);
@ -263,7 +265,7 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
const char *start= str;
ulong tmp_value= (uint) (uchar) (*str++ - '0');
while (str != end && my_isdigit(&my_charset_latin1,str[0]) &&
--field_length)
(!is_internal_format || --field_length))
{
tmp_value=tmp_value*10 + (ulong) (uchar) (*str - '0');
str++;

View File

@ -1903,6 +1903,8 @@ in_row::~in_row()
byte *in_row::get_value(Item *item)
{
tmp.store_value(item);
if (item->is_null())
return 0;
return (byte *)&tmp;
}

View File

@ -1177,11 +1177,23 @@ String *Item_func_substr_index::val_str(String *str)
}
}
else
{ // Start counting at end
for (offset=res->length() ; ; offset-=delimeter_length-1)
{
/*
Negative index, start counting at the end
*/
for (offset=res->length(); offset ;)
{
/*
this call will result in finding the position pointing to one
address space less than where the found substring is located
in res
*/
if ((int) (offset=res->strrstr(*delimeter,offset)) < 0)
return res; // Didn't find, return org string
/*
At this point, we've searched for the substring
the number of times as supplied by the index value
*/
if (!++count)
{
offset+=delimeter_length;

View File

@ -2396,8 +2396,8 @@ bool show_master_info(THD* thd, MASTER_INFO* mi)
&my_charset_bin);
protocol->store((ulonglong) mi->rli.group_relay_log_pos);
protocol->store(mi->rli.group_master_log_name, &my_charset_bin);
protocol->store(mi->slave_running == MYSQL_SLAVE_RUN_CONNECT
? "Yes":"No", &my_charset_bin);
protocol->store(mi->slave_running == MYSQL_SLAVE_RUN_CONNECT ?
"Yes" : "No", &my_charset_bin);
protocol->store(mi->rli.slave_running ? "Yes":"No", &my_charset_bin);
protocol->store(&replicate_do_db);
protocol->store(&replicate_ignore_db);

View File

@ -762,7 +762,7 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
TABLE_COUNTER_TYPE local_tables;
ulong tot_length;
DBUG_ENTER("Query_cache::store_query");
if (query_cache_size == 0)
if (query_cache_size == 0 || thd->locked_tables)
DBUG_VOID_RETURN;
uint8 tables_type= 0;
@ -936,8 +936,8 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
Query_cache_query_flags flags;
DBUG_ENTER("Query_cache::send_result_to_client");
if (query_cache_size == 0 || thd->variables.query_cache_type == 0)
if (query_cache_size == 0 || thd->locked_tables ||
thd->variables.query_cache_type == 0)
goto err;
/* Check that we haven't forgot to reset the query cache variables */

View File

@ -5311,10 +5311,12 @@ void create_select_for_variable(const char *var_name)
We set the name of Item to @@session.var_name because that then is used
as the column name in the output.
*/
var= get_system_var(thd, OPT_SESSION, tmp, null_lex_string);
end= strxmov(buff, "@@session.", var_name, NullS);
var->set_name(buff, end-buff, system_charset_info);
add_item_to_list(thd, var);
if ((var= get_system_var(thd, OPT_SESSION, tmp, null_lex_string)))
{
end= strxmov(buff, "@@session.", var_name, NullS);
var->set_name(buff, end-buff, system_charset_info);
add_item_to_list(thd, var);
}
DBUG_VOID_RETURN;
}
@ -6464,11 +6466,13 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
THR_LOCK_DATA **end_p= lock_p + thd->locked_tables->lock_count;
for (; lock_p < end_p; lock_p++)
{
if ((*lock_p)->type == TL_WRITE)
{
my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0));
return 1;
}
}
}
/*
Writing to the binlog could cause deadlocks, as we don't log

View File

@ -289,6 +289,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
List_iterator_fast<Item> tp(types);
Query_arena *arena= thd->current_arena;
Item *type;
ulong create_options;
while ((type= tp++))
{

View File

@ -22,7 +22,7 @@ pkglib_LIBRARIES = libmystrings.a
# Exact one of ASSEMBLER_X
if ASSEMBLER_x86
ASRCS = strings-x86.s longlong2str-x86.s my_strtoll10-x86.s
CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c str_alloc.c
CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c str_alloc.c longlong2str_asm.c
else
if ASSEMBLER_sparc32
# These file MUST all be on the same line!! Otherwise automake
@ -45,7 +45,7 @@ EXTRA_DIST = ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc
ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-utf8.c \
ctype-ucs2.c ctype-uca.c ctype-tis620.c ctype-ujis.c \
xml.c decimal.c strto.c strings-x86.s \
longlong2str.c longlong2str-x86.s \
longlong2str.c longlong2str-x86.s longlong2str_asm.c \
my_strtoll10.c my_strtoll10-x86.s \
strxmov.c bmove_upp.c strappend.c strcont.c strend.c \
strfill.c strcend.c is_prefix.c strstr.c strinstr.c \

View File

@ -16,26 +16,26 @@
# Optimized longlong2str function for Intel 80x86 (gcc/gas syntax)
# Some set sequences are optimized for pentuimpro II
.file "longlong2str.s"
.version "1.01"
.file "longlong2str-x86.s"
.version "1.02"
.text
.align 4
.globl longlong2str
.type longlong2str,@function
.globl longlong2str_with_dig_vector
.type longlong2str_with_dig_vector,@function
longlong2str:
longlong2str_with_dig_vector:
subl $80,%esp
pushl %ebp
pushl %esi
pushl %edi
pushl %ebx
movl 100(%esp),%esi # Lower part of val
movl 104(%esp),%ebp # Higher part of val
movl 108(%esp),%edi # get dst
movl 112(%esp),%ebx # Radix
movl 104(%esp),%ebp # Higher part of val
movl %ebx,%eax
movl 108(%esp),%edi # get dst
testl %eax,%eax
jge .L144
@ -69,6 +69,8 @@ longlong2str:
.L150:
leal 92(%esp),%ecx # End of buffer
movl %edi, 108(%esp) # Store possible modified dest
movl 116(%esp), %edi # dig_vec_upper
jmp .L155
.align 4
@ -83,7 +85,7 @@ longlong2str:
divl %ebx
decl %ecx
movl %eax,%esi # quotent in ebp:esi
movb _dig_vec_upper(%edx),%al # al is faster than dl
movb (%edx,%edi),%al # al is faster than dl
movb %al,(%ecx) # store value in buff
.align 4
.L155:
@ -91,20 +93,22 @@ longlong2str:
ja .L153
testl %esi,%esi # rest value
jl .L153
je .L10_mov # Ready
je .L160 # Ready
movl %esi,%eax
movl $_dig_vec_upper,%ebp
.align 4
.L154: # Do rest with integer precision
cltd
divl %ebx
decl %ecx
movb (%edx,%ebp),%dl # bh is always zero as ebx=radix < 36
movb (%edx,%edi),%dl # bh is always zero as ebx=radix < 36
testl %eax,%eax
movb %dl,(%ecx)
jne .L154
.L160:
movl 108(%esp),%edi # get dst
.L10_mov:
movl %ecx,%esi
leal 92(%esp),%ecx # End of buffer
@ -129,7 +133,7 @@ longlong2str:
jmp .L165
.Lfe3:
.size longlong2str,.Lfe3-longlong2str
.size longlong2str_with_dig_vector,.Lfe3-longlong2str_with_dig_vector
#
# This is almost equal to the above, except that we can do the final
@ -137,9 +141,6 @@ longlong2str:
#
.align 4
.Ltmp:
.long 0xcccccccd
.align 4
.globl longlong10_to_str
.type longlong10_to_str,@function
@ -202,8 +203,8 @@ longlong10_to_str:
# The following code uses some tricks to change division by 10 to
# multiplication and shifts
movl .Ltmp,%esi # set %esi to 0xcccccccd
movl $0xcccccccd,%esi
.L10_40:
movl %ebx,%eax
mull %esi

View File

@ -0,0 +1,33 @@
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
Wrapper for longlong2str.s
We need this because the assembler code can't access the local variable
_dig_vector in a portable manner.
*/
#include <my_global.h>
#include "m_string.h"
extern char *longlong2str_with_dig_vector(longlong val,char *dst,int radix,
const char *dig_vector);
char *longlong2str(longlong val,char *dst,int radix)
{
return longlong2str_with_dig_vector(val, dst, radix, _dig_vec_upper);
}

View File

@ -17,21 +17,8 @@
# For documentation, check my_strtoll.c
.file "my_strtoll10-x86.s"
.version "01.01"
.data
.align 32
.type lfactor,@object
.size lfactor,36
lfactor:
.long 1
.long 10
.long 100
.long 1000
.long 10000
.long 100000
.long 1000000
.long 10000000
.long 100000000
.version "01.02"
.text
.align 4
@ -209,14 +196,16 @@ my_strtoll10:
jne .L500
cmpl -36(%ebp),%esi # Test if string is less than 18 digits
jne .Lend_i_and_j
jmp .Lend3 # 18 digit string
.L499:
movl $1000000000,%eax
jmp .Lgot_factor # 18 digit string
# Handle the possible next to last digit and store in ecx
.L500:
movb (%esi),%al
addb $-48,%al
cmpb $9,%al
ja .Lend3
ja .L499 # 18 digit string
incl %esi
movzbl %al,%ecx
@ -315,14 +304,41 @@ my_strtoll10:
.Lend_i_and_j:
movl %esi,%ecx
subl -12(%ebp),%ecx # ecx= number of digits in second part
movl lfactor(,%ecx,4),%eax
jmp .L523
# Return -8(%ebp) * $1000000000 + edi
# Calculate %eax= 10 ** %cl, where %cl <= 8
# With an array one could do this with:
# movl 10_factor_table(,%ecx,4),%eax
# We calculate the table here to avoid problems in
# position independent code (gcc -pic)
cmpb $3,%cl
ja .L4_to_8
movl $1000, %eax
je .Lgot_factor # %cl=3, eax= 1000
movl $10, %eax
cmpb $1,%cl # %cl is here 0 - 2
je .Lgot_factor # %cl=1, eax= 10
movl $100, %eax
ja .Lgot_factor # %cl=2, eax=100
movl $1, %eax
jmp .Lgot_factor # %cl=0, eax=1
.L4_to_8: # %cl is here 4-8
cmpb $5,%cl
movl $100000, %eax
je .Lgot_factor # %cl=5, eax=100000
movl $10000, %eax
jbe .Lgot_factor # %cl=4, eax=10000
movl $10000000, %eax
cmpb $7,%cl
je .Lgot_factor # %cl=7, eax=10000000
movl $100000000, %eax
ja .Lgot_factor # %cl=8, eax=100000000
movl $1000000, %eax # %cl=6, eax=1000000
# Return -8(%ebp) * %eax + edi
.p2align 4,,7
.Lend3:
movl $1000000000,%eax
.L523:
.Lgot_factor:
mull -8(%ebp)
addl %edi,%eax
adcl $0,%edx

View File

@ -7195,7 +7195,7 @@ static void test_prepare_grant()
}
}
#endif
#endif /* EMBEDDED_LIBRARY */
/*
Test a crash when invalid/corrupted .frm is used in the