diff options
author | unknown <cmiller@zippy.cornsilk.net> | 2006-09-28 07:35:04 -0400 |
---|---|---|
committer | unknown <cmiller@zippy.cornsilk.net> | 2006-09-28 07:35:04 -0400 |
commit | 96bc9f80794b305f6f7636213187472eb81a9045 (patch) | |
tree | ffcaba33428981d743d5080320c0fdee220422cd | |
parent | be29dd430e35e12b86cf0a44d62d9ca32387e955 (diff) | |
parent | d165736b8d091dcb173cd80b357197845f41cbf0 (diff) | |
download | mariadb-git-96bc9f80794b305f6f7636213187472eb81a9045.tar.gz |
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-maint
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-maint
client/mysql.cc:
Auto merged
mysql-test/r/ctype_utf8.result:
Auto merged
mysql-test/r/func_time.result:
Auto merged
mysql-test/t/ctype_utf8.test:
Auto merged
mysql-test/t/func_time.test:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/item_func.h:
Auto merged
sql/item_strfunc.cc:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_string.cc:
Auto merged
-rw-r--r-- | client/mysql.cc | 4 | ||||
-rw-r--r-- | mysql-test/r/ctype_utf8.result | 12 | ||||
-rw-r--r-- | mysql-test/r/func_time.result | 12 | ||||
-rw-r--r-- | mysql-test/t/ctype_utf8.test | 11 | ||||
-rw-r--r-- | mysql-test/t/func_time.test | 19 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 3 |
6 files changed, 58 insertions, 3 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index b5f28090283..9ce3139c56f 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -2896,7 +2896,7 @@ com_connect(String *buffer, char *line) bzero(buff, sizeof(buff)); if (buffer) { - strmake(buff, line, sizeof(buff)); + strmake(buff, line, sizeof(buff) - 1); tmp= get_arg(buff, 0); if (tmp && *tmp) { @@ -3011,7 +3011,7 @@ com_use(String *buffer __attribute__((unused)), char *line) int select_db; bzero(buff, sizeof(buff)); - strmov(buff, line); + strmake(buff, line, sizeof(buff) - 1); tmp= get_arg(buff, 0); if (!tmp || !*tmp) { diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index f5e4054a385..60e05779ba0 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -1353,6 +1353,18 @@ database() имя_базы_в_кодировке_утф8_длиной_больше_чем_45 drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45; use test; +create table t1(a char(10)) default charset utf8; +insert into t1 values ('123'), ('456'); +explain +select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE Y ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +1 SIMPLE Z ALL NULL NULL NULL NULL 2 Using where +select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1; +substr(Z.a,-1) a +3 123 +6 456 +drop table t1; CREATE TABLE t1(id varchar(20) NOT NULL) DEFAULT CHARSET=utf8; INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa'); SELECT id FROM t1; diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 34507e0491c..82c361edd39 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -890,6 +890,18 @@ t1 CREATE TABLE `t1` ( `from_unixtime(1) + 0` double(23,6) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; +SET NAMES latin1; +SET character_set_results = NULL; +SHOW VARIABLES LIKE 'character_set_results'; +Variable_name Value +character_set_results +CREATE TABLE testBug8868 (field1 DATE, field2 VARCHAR(32) CHARACTER SET BINARY); +INSERT INTO testBug8868 VALUES ('2006-09-04', 'abcd'); +SELECT DATE_FORMAT(field1,'%b-%e %l:%i%p') as fmtddate, field2 FROM testBug8868; +fmtddate field2 +Sep-4 12:00AM abcd +DROP TABLE testBug8868; +SET NAMES DEFAULT; (select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H) union (select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H); diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 54ded650a1e..b40632b1ddc 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1086,6 +1086,17 @@ select database(); drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45; use test; +# +# Bug #20204: "order by" changes the results returned +# + +create table t1(a char(10)) default charset utf8; +insert into t1 values ('123'), ('456'); +explain + select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1; +select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1; +drop table t1; + # End of 4.1 tests # diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 08d3ff14ca1..d49a4fed9d2 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -447,6 +447,25 @@ show create table t1; drop table t1; # +# 21913: DATE_FORMAT() Crashes mysql server if I use it through +# mysql-connector-j driver. +# + +SET NAMES latin1; +SET character_set_results = NULL; +SHOW VARIABLES LIKE 'character_set_results'; + +CREATE TABLE testBug8868 (field1 DATE, field2 VARCHAR(32) CHARACTER SET BINARY); +INSERT INTO testBug8868 VALUES ('2006-09-04', 'abcd'); + +SELECT DATE_FORMAT(field1,'%b-%e %l:%i%p') as fmtddate, field2 FROM testBug8868; + +DROP TABLE testBug8868; + +SET NAMES DEFAULT; + + +# # Bug #19844 time_format in Union truncates values # diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 851551a86d9..7a82dd753b3 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1149,12 +1149,13 @@ void Item_func_substr::fix_length_and_dec() } if (arg_count == 3 && args[2]->const_item()) { - int32 length= (int32) args[2]->val_int() * collation.collation->mbmaxlen; + int32 length= (int32) args[2]->val_int(); if (length <= 0) max_length=0; /* purecov: inspected */ else set_if_smaller(max_length,(uint) length); } + max_length*= collation.collation->mbmaxlen; } |