Commit 4d0c4c5c authored by unknown's avatar unknown

Merge bk-internal:/home/bk/mysql-5.1-new-maint

into  neptunus.(none):/home/msvensson/mysql/mysql-5.1-new-maint


mysql-test/mysql-test-run.pl:
  Auto merged
parents 4f810b3b 96bc9f80
...@@ -2896,7 +2896,7 @@ com_connect(String *buffer, char *line) ...@@ -2896,7 +2896,7 @@ com_connect(String *buffer, char *line)
bzero(buff, sizeof(buff)); bzero(buff, sizeof(buff));
if (buffer) if (buffer)
{ {
strmake(buff, line, sizeof(buff)); strmake(buff, line, sizeof(buff) - 1);
tmp= get_arg(buff, 0); tmp= get_arg(buff, 0);
if (tmp && *tmp) if (tmp && *tmp)
{ {
...@@ -3011,7 +3011,7 @@ com_use(String *buffer __attribute__((unused)), char *line) ...@@ -3011,7 +3011,7 @@ com_use(String *buffer __attribute__((unused)), char *line)
int select_db; int select_db;
bzero(buff, sizeof(buff)); bzero(buff, sizeof(buff));
strmov(buff, line); strmake(buff, line, sizeof(buff) - 1);
tmp= get_arg(buff, 0); tmp= get_arg(buff, 0);
if (!tmp || !*tmp) if (!tmp || !*tmp)
{ {
......
...@@ -141,11 +141,11 @@ enum enum_server_command ...@@ -141,11 +141,11 @@ enum enum_server_command
#define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */ #define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */
#define CLIENT_RESERVED 16384 /* Old flag for 4.1 protocol */ #define CLIENT_RESERVED 16384 /* Old flag for 4.1 protocol */
#define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */ #define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */
#define CLIENT_MULTI_STATEMENTS (((ulong) 1) << 16) /* Enable/disable multi-stmt support */ #define CLIENT_MULTI_STATEMENTS (1UL << 16) /* Enable/disable multi-stmt support */
#define CLIENT_MULTI_RESULTS (((ulong) 1) << 17) /* Enable/disable multi-results */ #define CLIENT_MULTI_RESULTS (1UL << 17) /* Enable/disable multi-results */
#define CLIENT_SSL_VERIFY_SERVER_CERT (((ulong) 1) << 30) #define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30)
#define CLIENT_REMEMBER_OPTIONS (((ulong) 1) << 31) #define CLIENT_REMEMBER_OPTIONS (1UL << 31)
#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */ #define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */
#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */ #define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */
......
...@@ -1353,6 +1353,18 @@ database() ...@@ -1353,6 +1353,18 @@ database()
имя_базы_в_кодировке_утф8_длиной_больше_чем_45 имя_базы_в_кодировке_утф8_длиной_больше_чем_45
drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45; drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
use test; 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; CREATE TABLE t1(id varchar(20) NOT NULL) DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa'); INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa');
SELECT id FROM t1; SELECT id FROM t1;
......
...@@ -890,6 +890,18 @@ t1 CREATE TABLE `t1` ( ...@@ -890,6 +890,18 @@ t1 CREATE TABLE `t1` (
`from_unixtime(1) + 0` double(23,6) DEFAULT NULL `from_unixtime(1) + 0` double(23,6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; 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) (select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H)
union union
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H); (select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H);
......
...@@ -1086,6 +1086,17 @@ select database(); ...@@ -1086,6 +1086,17 @@ select database();
drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45; drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
use test; 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 # End of 4.1 tests
# #
......
...@@ -446,6 +446,25 @@ create table t1 select now() - now(), curtime() - curtime(), ...@@ -446,6 +446,25 @@ create table t1 select now() - now(), curtime() - curtime(),
show create table t1; show create table t1;
drop 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 # Bug #19844 time_format in Union truncates values
# #
......
...@@ -1149,12 +1149,13 @@ void Item_func_substr::fix_length_and_dec() ...@@ -1149,12 +1149,13 @@ void Item_func_substr::fix_length_and_dec()
} }
if (arg_count == 3 && args[2]->const_item()) 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) if (length <= 0)
max_length=0; /* purecov: inspected */ max_length=0; /* purecov: inspected */
else else
set_if_smaller(max_length,(uint) length); set_if_smaller(max_length,(uint) length);
} }
max_length*= collation.collation->mbmaxlen;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment