summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoracurtis@xiphis.org <>2005-08-11 12:18:53 +0100
committeracurtis@xiphis.org <>2005-08-11 12:18:53 +0100
commitb9476f7d50e9911ea83f304351e5cab7a3880089 (patch)
tree7e424eae0123e35fa5eec3670a550a310c6e1916
parent0f75d647349694d820923342325440e9abdd49a6 (diff)
parent3b64651683a6f8d9276fd49843832f672312f880 (diff)
downloadmariadb-git-b9476f7d50e9911ea83f304351e5cab7a3880089.tar.gz
Merge xiphis.org:/usr/home/antony/work2/mysql-4.1
into xiphis.org:/usr/home/antony/work2/merge-5.0
-rw-r--r--client/mysql.cc5
-rw-r--r--client/mysqltest.c1
-rw-r--r--include/my_sys.h5
-rw-r--r--myisam/ft_boolean_search.c1
-rw-r--r--mysql-test/r/bigint.result9
-rw-r--r--mysql-test/r/func_str.result117
-rw-r--r--mysql-test/r/query_cache_notembedded.result14
-rw-r--r--mysql-test/r/subselect.result21
-rw-r--r--mysql-test/r/type_datetime.result23
-rw-r--r--mysql-test/t/bigint.test3
-rw-r--r--mysql-test/t/func_str.test39
-rw-r--r--mysql-test/t/query_cache_notembedded.test19
-rw-r--r--mysql-test/t/subselect.test15
-rw-r--r--mysql-test/t/type_datetime.test21
-rw-r--r--mysys/charset.c26
-rw-r--r--mysys/mf_dirname.c33
-rw-r--r--mysys/mf_pack.c12
-rw-r--r--ndb/src/common/logger/LogHandler.cpp2
-rw-r--r--sql-common/my_time.c6
-rw-r--r--sql/item_cmpfunc.cc2
-rw-r--r--sql/item_strfunc.cc16
-rw-r--r--sql/slave.cc4
-rw-r--r--sql/sql_cache.cc6
-rw-r--r--sql/sql_parse.cc12
-rw-r--r--sql/sql_union.cc1
-rw-r--r--strings/Makefile.am4
-rw-r--r--strings/longlong2str-x86.s35
-rw-r--r--strings/longlong2str_asm.c33
-rw-r--r--strings/my_strtoll10-x86.s62
-rw-r--r--tests/mysql_client_test.c2
30 files changed, 467 insertions, 82 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index b8655d7c5f5..bee5376e036 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -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);
diff --git a/client/mysqltest.c b/client/mysqltest.c
index ca4d9319707..57b81e46b66 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -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)
{
diff --git a/include/my_sys.h b/include/my_sys.h
index d5488ce12fa..11e8a36f5fa 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -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);
diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c
index 35c41b7d2d6..c18984c7584 100644
--- a/myisam/ft_boolean_search.c
+++ b/myisam/ft_boolean_search.c
@@ -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)
diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result
index a0c8f317db2..35374024649 100644
--- a/mysql-test/r/bigint.result
+++ b/mysql-test/r/bigint.result
@@ -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;
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 57942d1fcdf..c7e69ae1d31 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -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:
diff --git a/mysql-test/r/query_cache_notembedded.result b/mysql-test/r/query_cache_notembedded.result
index 16a397f78b6..e773a63525b 100644
--- a/mysql-test/r/query_cache_notembedded.result
+++ b/mysql-test/r/query_cache_notembedded.result
@@ -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;
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 9606ed97ee7..5927419579d 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -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);
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index 788478de77e..3aaa0e5f151 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -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;
diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test
index 5c06ef89676..5f21d2b5813 100644
--- a/mysql-test/t/bigint.test
+++ b/mysql-test/t/bigint.test
@@ -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
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index c66f3eaa294..4a6c98c8d7f 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -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 '),':');
diff --git a/mysql-test/t/query_cache_notembedded.test b/mysql-test/t/query_cache_notembedded.test
index d29dc10ccae..fd4785ffe95 100644
--- a/mysql-test/t/query_cache_notembedded.test
+++ b/mysql-test/t/query_cache_notembedded.test
@@ -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;
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 8bc47190dca..995c3528ae6 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -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
#
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
index ca70e35d3cd..4b6741b4242 100644
--- a/mysql-test/t/type_datetime.test
+++ b/mysql-test/t/type_datetime.test
@@ -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
diff --git a/mysys/charset.c b/mysys/charset.c
index 701170b747b..c02144fafc0 100644
--- a/mysys/charset.c
+++ b/mysys/charset.c
@@ -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
diff --git a/mysys/mf_dirname.c b/mysys/mf_dirname.c
index 3de82c05b87..45bf4d56c31 100644
--- a/mysys/mf_dirname.c
+++ b/mysys/mf_dirname.c
@@ -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;
}
diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c
index 86172f648f4..049aa59a578 100644
--- a/mysys/mf_pack.c
+++ b/mysys/mf_pack.c
@@ -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)
diff --git a/ndb/src/common/logger/LogHandler.cpp b/ndb/src/common/logger/LogHandler.cpp
index a9d4512112f..521bd346fd3 100644
--- a/ndb/src/common/logger/LogHandler.cpp
+++ b/ndb/src/common/logger/LogHandler.cpp
@@ -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;
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index 95ac779e0cd..72809ee9b4b 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -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++;
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index d430d0d3c23..261f719e502 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -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;
}
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 256090d3e61..39e74acb2e9 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -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;
diff --git a/sql/slave.cc b/sql/slave.cc
index c09753d805b..d2a60076cef 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -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);
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 15d4f699bc9..0f4fdd52583 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -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 */
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 77b2cdad62b..fefe670432c 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -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
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index cdbe8a986b2..05472058489 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -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++))
{
diff --git a/strings/Makefile.am b/strings/Makefile.am
index ad652862222..c43cf0f290a 100644
--- a/strings/Makefile.am
+++ b/strings/Makefile.am
@@ -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 \
diff --git a/strings/longlong2str-x86.s b/strings/longlong2str-x86.s
index fcc57810224..1840bab3f47 100644
--- a/strings/longlong2str-x86.s
+++ b/strings/longlong2str-x86.s
@@ -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
diff --git a/strings/longlong2str_asm.c b/strings/longlong2str_asm.c
new file mode 100644
index 00000000000..e38a8328b91
--- /dev/null
+++ b/strings/longlong2str_asm.c
@@ -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);
+}
diff --git a/strings/my_strtoll10-x86.s b/strings/my_strtoll10-x86.s
index c04384667a7..1d8b8f2bbce 100644
--- a/strings/my_strtoll10-x86.s
+++ b/strings/my_strtoll10-x86.s
@@ -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
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 75f57436c38..75b41ebe4d1 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -7195,7 +7195,7 @@ static void test_prepare_grant()
}
}
-#endif
+#endif /* EMBEDDED_LIBRARY */
/*
Test a crash when invalid/corrupted .frm is used in the