Commit ecc3a619 authored by unknown's avatar unknown

Merge mysql.com:/nfsdisk1/lars/bkroot/mysql-5.0-rpl

into  mysql.com:/nfsdisk1/lars/MERGE/mysql-5.0-merge


client/mysqlbinlog.cc:
  Auto merged
client/mysqldump.c:
  Auto merged
include/my_pthread.h:
  Auto merged
mysql-test/t/disabled.def:
  Auto merged
mysys/my_thr_init.c:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
sql/log.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/log_event.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/set_var.h:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_locale.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
parents 50361d9a 34a72398
...@@ -93,8 +93,10 @@ static bool stop_passed= 0; ...@@ -93,8 +93,10 @@ static bool stop_passed= 0;
*/ */
Format_description_log_event* description_event; Format_description_log_event* description_event;
static int dump_local_log_entries(const char* logname); static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
static int dump_remote_log_entries(const char* logname); const char* logname);
static int dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
const char* logname);
static int dump_log_entries(const char* logname); static int dump_log_entries(const char* logname);
static int dump_remote_file(NET* net, const char* fname); static int dump_remote_file(NET* net, const char* fname);
static void die(const char* fmt, ...); static void die(const char* fmt, ...);
...@@ -949,8 +951,22 @@ static MYSQL* safe_connect() ...@@ -949,8 +951,22 @@ static MYSQL* safe_connect()
static int dump_log_entries(const char* logname) static int dump_log_entries(const char* logname)
{ {
return (remote_opt ? dump_remote_log_entries(logname) : int rc;
dump_local_log_entries(logname)); PRINT_EVENT_INFO print_event_info;
/*
Set safe delimiter, to dump things
like CREATE PROCEDURE safely
*/
fprintf(result_file, "DELIMITER /*!*/;\n");
strcpy(print_event_info.delimiter, "/*!*/;");
rc= (remote_opt ? dump_remote_log_entries(&print_event_info, logname) :
dump_local_log_entries(&print_event_info, logname));
/* Set delimiter back to semicolon */
fprintf(result_file, "DELIMITER ;\n");
strcpy(print_event_info.delimiter, ";");
return rc;
} }
...@@ -1015,11 +1031,11 @@ static int check_master_version(MYSQL* mysql, ...@@ -1015,11 +1031,11 @@ static int check_master_version(MYSQL* mysql,
} }
static int dump_remote_log_entries(const char* logname) static int dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
const char* logname)
{ {
char buf[128]; char buf[128];
PRINT_EVENT_INFO print_event_info;
ulong len; ulong len;
uint logname_len; uint logname_len;
NET* net; NET* net;
...@@ -1142,7 +1158,7 @@ could be out of memory"); ...@@ -1142,7 +1158,7 @@ could be out of memory");
len= 1; // fake Rotate, so don't increment old_off len= 1; // fake Rotate, so don't increment old_off
} }
} }
if ((error= process_event(&print_event_info, ev, old_off))) if ((error= process_event(print_event_info, ev, old_off)))
{ {
error= ((error < 0) ? 0 : 1); error= ((error < 0) ? 0 : 1);
goto err; goto err;
...@@ -1161,7 +1177,7 @@ could be out of memory"); ...@@ -1161,7 +1177,7 @@ could be out of memory");
goto err; goto err;
} }
if ((error= process_event(&print_event_info, ev, old_off))) if ((error= process_event(print_event_info, ev, old_off)))
{ {
my_close(file,MYF(MY_WME)); my_close(file,MYF(MY_WME));
error= ((error < 0) ? 0 : 1); error= ((error < 0) ? 0 : 1);
...@@ -1287,11 +1303,11 @@ at offset %lu ; this could be a log format error or read error", ...@@ -1287,11 +1303,11 @@ at offset %lu ; this could be a log format error or read error",
} }
static int dump_local_log_entries(const char* logname) static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
const char* logname)
{ {
File fd = -1; File fd = -1;
IO_CACHE cache,*file= &cache; IO_CACHE cache,*file= &cache;
PRINT_EVENT_INFO print_event_info;
byte tmp_buff[BIN_LOG_HEADER_SIZE]; byte tmp_buff[BIN_LOG_HEADER_SIZE];
int error= 0; int error= 0;
...@@ -1363,7 +1379,7 @@ static int dump_local_log_entries(const char* logname) ...@@ -1363,7 +1379,7 @@ static int dump_local_log_entries(const char* logname)
// file->error == 0 means EOF, that's OK, we break in this case // file->error == 0 means EOF, that's OK, we break in this case
break; break;
} }
if ((error= process_event(&print_event_info, ev, old_off))) if ((error= process_event(print_event_info, ev, old_off)))
{ {
if (error < 0) if (error < 0)
error= 0; error= 0;
......
...@@ -30,6 +30,26 @@ extern "C" { ...@@ -30,6 +30,26 @@ extern "C" {
#define EXTERNC #define EXTERNC
#endif /* __cplusplus */ #endif /* __cplusplus */
/*
BUG#24507: Race conditions inside current NPTL pthread_exit() implementation.
If macro NPTL_PTHREAD_EXIT_HACK is defined then a hack described in the bug
report will be implemented inside my_thread_global_init() in my_thr_init.c.
This amounts to spawning a dummy thread which does nothing but executes
pthread_exit(0).
This bug is fixed in version 2.5 of glibc library.
TODO: Remove this code when fixed versions of glibc6 are in common use.
*/
#if defined(TARGET_OS_LINUX) && defined(HAVE_NPTL) && \
defined(__GLIBC__) && ( __GLIBC__ < 2 || __GLIBC__ == 2 && __GLIBC_MINOR__ < 5 )
#define NPTL_PTHREAD_EXIT_BUG 1
#endif
#if defined(__WIN__) || defined(OS2) #if defined(__WIN__) || defined(OS2)
#ifdef OS2 #ifdef OS2
......
...@@ -41,6 +41,6 @@ IN ind DECIMAL(10,2)) ...@@ -41,6 +41,6 @@ IN ind DECIMAL(10,2))
BEGIN BEGIN
INSERT INTO t4 VALUES (ins1, ins2, ind); INSERT INTO t4 VALUES (ins1, ins2, ind);
END END
master-bin.000001 801 Query 1 1006 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1'Foo\'s a Bar'), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93)) master-bin.000001 801 Query 1 1017 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93))
master-bin.000001 1006 Query 1 1092 use `test`; DROP PROCEDURE bug18293 master-bin.000001 1017 Query 1 1103 use `test`; DROP PROCEDURE bug18293
master-bin.000001 1092 Query 1 1168 use `test`; DROP TABLE t4 master-bin.000001 1103 Query 1 1179 use `test`; DROP TABLE t4
...@@ -9,15 +9,17 @@ master-bin.000001 98 User var 1 138 @`v`=_ucs2 0x006100620063 COLLATE ucs2_gener ...@@ -9,15 +9,17 @@ master-bin.000001 98 User var 1 138 @`v`=_ucs2 0x006100620063 COLLATE ucs2_gener
master-bin.000001 138 Query 1 227 use `test`; insert into t2 values (@v) master-bin.000001 138 Query 1 227 use `test`; insert into t2 values (@v)
/*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
ROLLBACK; DELIMITER /*!*/;
SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`; ROLLBACK/*!*/;
use test; SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`/*!*/;
SET TIMESTAMP=10000; use test/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; SET TIMESTAMP=10000/*!*/;
SET @@session.sql_mode=0; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
/*!\C latin1 */; SET @@session.sql_mode=0/*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; /*!\C latin1 *//*!*/;
insert into t2 values (@v); SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
insert into t2 values (@v)/*!*/;
DELIMITER ;
# End of log file # End of log file
ROLLBACK /* added by mysqlbinlog */; ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
......
...@@ -124,12 +124,34 @@ create table t1 select date_format("2004-01-19 10:10:10", "%Y-%m-%d"); ...@@ -124,12 +124,34 @@ create table t1 select date_format("2004-01-19 10:10:10", "%Y-%m-%d");
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`date_format("2004-01-19 10:10:10", "%Y-%m-%d")` varbinary(10) default NULL `date_format("2004-01-19 10:10:10", "%Y-%m-%d")` varchar(10) character set utf8 default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t1; select * from t1;
date_format("2004-01-19 10:10:10", "%Y-%m-%d") date_format("2004-01-19 10:10:10", "%Y-%m-%d")
2004-01-19 2004-01-19
drop table t1; drop table t1;
set names utf8;
set LC_TIME_NAMES='fr_FR';
create table t1 (s1 char(20) character set latin1);
insert into t1 values (date_format('2004-02-02','%M'));
select hex(s1) from t1;
hex(s1)
66E97672696572
drop table t1;
create table t1 (s1 char(20) character set koi8r);
set LC_TIME_NAMES='ru_RU';
insert into t1 values (date_format('2004-02-02','%M'));
insert into t1 values (date_format('2004-02-02','%b'));
insert into t1 values (date_format('2004-02-02','%W'));
insert into t1 values (date_format('2004-02-02','%a'));
select hex(s1), s1 from t1;
hex(s1) s1
E6C5D7D2C1CCD1 Февраля
E6C5D7 Фев
F0CFCEC5C4C5CCD8CEC9CB Понедельник
F0CEC4 Пнд
drop table t1;
set LC_TIME_NAMES='en_US';
set names koi8r; set names koi8r;
create table t1 (s1 char(1) character set utf8); create table t1 (s1 char(1) character set utf8);
insert into t1 values (_koi8r''); insert into t1 values (_koi8r'');
......
...@@ -275,8 +275,8 @@ is not null; ...@@ -275,8 +275,8 @@ is not null;
is not null is not null
1 1
select select
@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%", @a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%",
@a not like "%#%error_code=%error_code=%"; @a not like "%#%error_code=%error_code=%";
@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%" @a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%"
1 1 1 1
drop table t1, t2; drop table t1, t2;
This diff is collapsed.
This diff is collapsed.
...@@ -1786,6 +1786,78 @@ CREATE TABLE `t1` ( ...@@ -1786,6 +1786,78 @@ CREATE TABLE `t1` (
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
drop table t1; drop table t1;
#
# BUG#13926: --order-by-primary fails if PKEY contains quote character
#
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a b` INT,
`c"d` INT,
`e``f` INT,
PRIMARY KEY (`a b`, `c"d`, `e``f`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
insert into t1 values (0815, 4711, 2006);
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS "t1";
CREATE TABLE "t1" (
"a b" int(11) NOT NULL default '0',
"c""d" int(11) NOT NULL default '0',
"e`f" int(11) NOT NULL default '0',
PRIMARY KEY ("a b","c""d","e`f")
);
LOCK TABLES "t1" WRITE;
/*!40000 ALTER TABLE "t1" DISABLE KEYS */;
INSERT INTO "t1" VALUES (815,4711,2006);
/*!40000 ALTER TABLE "t1" ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a b` int(11) NOT NULL default '0',
`c"d` int(11) NOT NULL default '0',
`e``f` int(11) NOT NULL default '0',
PRIMARY KEY (`a b`,`c"d`,`e``f`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT INTO `t1` VALUES (815,4711,2006);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE `t1`;
End of 4.1 tests End of 4.1 tests
# #
# Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X) # Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
...@@ -3124,78 +3196,6 @@ drop user myDB_User@localhost; ...@@ -3124,78 +3196,6 @@ drop user myDB_User@localhost;
drop database mysqldump_myDB; drop database mysqldump_myDB;
use test; use test;
# #
# BUG#13926: --order-by-primary fails if PKEY contains quote character
#
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a b` INT,
`c"d` INT,
`e``f` INT,
PRIMARY KEY (`a b`, `c"d`, `e``f`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
insert into t1 values (0815, 4711, 2006);
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS "t1";
CREATE TABLE "t1" (
"a b" int(11) NOT NULL default '0',
"c""d" int(11) NOT NULL default '0',
"e`f" int(11) NOT NULL default '0',
PRIMARY KEY ("a b","c""d","e`f")
);
LOCK TABLES "t1" WRITE;
/*!40000 ALTER TABLE "t1" DISABLE KEYS */;
INSERT INTO "t1" VALUES (815,4711,2006);
/*!40000 ALTER TABLE "t1" ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a b` int(11) NOT NULL default '0',
`c"d` int(11) NOT NULL default '0',
`e``f` int(11) NOT NULL default '0',
PRIMARY KEY (`a b`,`c"d`,`e``f`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT INTO `t1` VALUES (815,4711,2006);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE `t1`;
#
# Bug #19745: mysqldump --xml produces invalid xml # Bug #19745: mysqldump --xml produces invalid xml
# #
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
......
...@@ -176,84 +176,86 @@ hex(c1) hex(c2) ...@@ -176,84 +176,86 @@ hex(c1) hex(c2)
CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
/*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
ROLLBACK; DELIMITER /*!*/;
SET TIMESTAMP=1000000000; ROLLBACK/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; SET TIMESTAMP=1000000000/*!*/;
SET @@session.sql_mode=0; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
/*!\C latin1 */; SET @@session.sql_mode=0/*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; /*!\C latin1 *//*!*/;
drop database if exists mysqltest2; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET TIMESTAMP=1000000000; drop database if exists mysqltest2/*!*/;
drop database if exists mysqltest3; SET TIMESTAMP=1000000000/*!*/;
SET TIMESTAMP=1000000000; drop database if exists mysqltest3/*!*/;
create database mysqltest2 character set latin2; SET TIMESTAMP=1000000000/*!*/;
SET TIMESTAMP=1000000000; create database mysqltest2 character set latin2/*!*/;
/*!\C latin1 */; SET TIMESTAMP=1000000000/*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=30; /*!\C latin1 *//*!*/;
create database mysqltest3; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=30/*!*/;
SET TIMESTAMP=1000000000; create database mysqltest3/*!*/;
/*!\C latin1 */; SET TIMESTAMP=1000000000/*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=64; /*!\C latin1 *//*!*/;
drop database mysqltest3; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=64/*!*/;
SET TIMESTAMP=1000000000; drop database mysqltest3/*!*/;
create database mysqltest3; SET TIMESTAMP=1000000000/*!*/;
use mysqltest2; create database mysqltest3/*!*/;
SET TIMESTAMP=1000000000; use mysqltest2/*!*/;
create table t1 (a int auto_increment primary key, b varchar(100)); SET TIMESTAMP=1000000000/*!*/;
SET INSERT_ID=1; create table t1 (a int auto_increment primary key, b varchar(100))/*!*/;
SET TIMESTAMP=1000000000; SET INSERT_ID=1/*!*/;
/*!\C cp850 */; SET TIMESTAMP=1000000000/*!*/;
SET @@session.character_set_client=4,@@session.collation_connection=27,@@session.collation_server=64; /*!\C cp850 *//*!*/;
insert into t1 (b) values(@@character_set_server); SET @@session.character_set_client=4,@@session.collation_connection=27,@@session.collation_server=64/*!*/;
SET INSERT_ID=2; insert into t1 (b) values(@@character_set_server)/*!*/;
SET TIMESTAMP=1000000000; SET INSERT_ID=2/*!*/;
insert into t1 (b) values(@@collation_server); SET TIMESTAMP=1000000000/*!*/;
SET INSERT_ID=3; insert into t1 (b) values(@@collation_server)/*!*/;
SET TIMESTAMP=1000000000; SET INSERT_ID=3/*!*/;
insert into t1 (b) values(@@character_set_client); SET TIMESTAMP=1000000000/*!*/;
SET INSERT_ID=4; insert into t1 (b) values(@@character_set_client)/*!*/;
SET TIMESTAMP=1000000000; SET INSERT_ID=4/*!*/;
insert into t1 (b) values(@@character_set_connection); SET TIMESTAMP=1000000000/*!*/;
SET INSERT_ID=5; insert into t1 (b) values(@@character_set_connection)/*!*/;
SET TIMESTAMP=1000000000; SET INSERT_ID=5/*!*/;
insert into t1 (b) values(@@collation_connection); SET TIMESTAMP=1000000000/*!*/;
SET TIMESTAMP=1000000000; insert into t1 (b) values(@@collation_connection)/*!*/;
/*!\C latin1 */; SET TIMESTAMP=1000000000/*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=5,@@session.collation_server=64; /*!\C latin1 *//*!*/;
truncate table t1; SET @@session.character_set_client=8,@@session.collation_connection=5,@@session.collation_server=64/*!*/;
SET INSERT_ID=1; truncate table t1/*!*/;
SET TIMESTAMP=1000000000; SET INSERT_ID=1/*!*/;
insert into t1 (b) values(@@collation_connection); SET TIMESTAMP=1000000000/*!*/;
SET INSERT_ID=2; insert into t1 (b) values(@@collation_connection)/*!*/;
SET TIMESTAMP=1000000000; SET INSERT_ID=2/*!*/;
insert into t1 (b) values(LEAST("Mller","Muffler")); SET TIMESTAMP=1000000000/*!*/;
SET INSERT_ID=3; insert into t1 (b) values(LEAST("Mller","Muffler"))/*!*/;
SET TIMESTAMP=1000000000; SET INSERT_ID=3/*!*/;
/*!\C latin1 */; SET TIMESTAMP=1000000000/*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=31,@@session.collation_server=64; /*!\C latin1 *//*!*/;
insert into t1 (b) values(@@collation_connection); SET @@session.character_set_client=8,@@session.collation_connection=31,@@session.collation_server=64/*!*/;
SET INSERT_ID=4; insert into t1 (b) values(@@collation_connection)/*!*/;
SET TIMESTAMP=1000000000; SET INSERT_ID=4/*!*/;
insert into t1 (b) values(LEAST("Mller","Muffler")); SET TIMESTAMP=1000000000/*!*/;
SET TIMESTAMP=1000000000; insert into t1 (b) values(LEAST("Mller","Muffler"))/*!*/;
truncate table t1; SET TIMESTAMP=1000000000/*!*/;
SET INSERT_ID=1; truncate table t1/*!*/;
SET @`a`:=_cp850 0x4DFC6C6C6572 COLLATE `cp850_general_ci`; SET INSERT_ID=1/*!*/;
SET TIMESTAMP=1000000000; SET @`a`:=_cp850 0x4DFC6C6C6572 COLLATE `cp850_general_ci`/*!*/;
insert into t1 (b) values(collation(@a)); SET TIMESTAMP=1000000000/*!*/;
SET TIMESTAMP=1000000000; insert into t1 (b) values(collation(@a))/*!*/;
drop database mysqltest2; SET TIMESTAMP=1000000000/*!*/;
SET TIMESTAMP=1000000000; drop database mysqltest2/*!*/;
drop database mysqltest3; SET TIMESTAMP=1000000000/*!*/;
use test; drop database mysqltest3/*!*/;
SET TIMESTAMP=1000000000; use test/*!*/;
/*!\C latin1 */; SET TIMESTAMP=1000000000/*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=30; /*!\C latin1 *//*!*/;
CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255)); SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=30/*!*/;
SET TIMESTAMP=1000000000; CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255))/*!*/;
/*!\C koi8r */; SET TIMESTAMP=1000000000/*!*/;
SET @@session.character_set_client=7,@@session.collation_connection=51,@@session.collation_server=30; /*!\C koi8r *//*!*/;
INSERT INTO t1 (c1, c2) VALUES (', ',', '); SET @@session.character_set_client=7,@@session.collation_connection=51,@@session.collation_server=30/*!*/;
INSERT INTO t1 (c1, c2) VALUES (', ',', ')/*!*/;
DELIMITER ;
# End of log file # End of log file
ROLLBACK /* added by mysqlbinlog */; ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
......
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
drop table if exists t1;
drop procedure if exists p1;
create table t1 (a varchar(255) character set sjis);
create procedure p1 (in a varchar(255) character set sjis) insert into t1 values (a);
SET NAMES binary;
CALL p1 ('–\\');
select "--- on master ---";
--- on master ---
--- on master ---
select hex(a) from t1 ;
hex(a)
965C
select "--- on slave ---";
--- on slave ---
--- on slave ---
select hex(a) from t1;
hex(a)
965C
drop table t1;
drop procedure p1;
...@@ -20,6 +20,17 @@ set password for rpl_do_grant@localhost=password("does it work?"); ...@@ -20,6 +20,17 @@ set password for rpl_do_grant@localhost=password("does it work?");
select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant'; select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
password<>_binary'' password<>_binary''
1 1
update mysql.user set password='' where user='rpl_do_grant';
flush privileges;
select password<>'' from mysql.user where user='rpl_do_grant';
password<>''
0
set sql_mode='ANSI_QUOTES';
set password for rpl_do_grant@localhost=password('does it work?');
set sql_mode='';
select password<>'' from mysql.user where user='rpl_do_grant';
password<>''
1
delete from mysql.user where user=_binary'rpl_do_grant'; delete from mysql.user where user=_binary'rpl_do_grant';
delete from mysql.db where user=_binary'rpl_do_grant'; delete from mysql.db where user=_binary'rpl_do_grant';
flush privileges; flush privileges;
......
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create table t1 (s1 char(10));
set lc_time_names= 'de_DE';
insert into t1 values (date_format('2001-01-01','%W'));
set lc_time_names= 'en_US';
insert into t1 values (date_format('2001-01-01','%W'));
select * from t1;
s1
Montag
Monday
select * from t1;
s1
Montag
Monday
drop table t1;
...@@ -269,6 +269,118 @@ insert into t1 values (1); ...@@ -269,6 +269,118 @@ insert into t1 values (1);
select * from t1; select * from t1;
a a
1 1
select * from t1;
a
1
create procedure foo()
not deterministic
reads sql data
select * from t1;
call foo();
a
1
drop procedure foo;
drop function fn1;
drop database mysqltest1;
drop user "zedjzlcsjhd"@127.0.0.1;
use test;
use test;
drop function if exists f1;
create function f1() returns int reads sql data
begin
declare var integer;
declare c cursor for select a from v1;
open c;
fetch c into var;
close c;
return var;
end|
create view v1 as select 1 as a;
create table t1 (a int);
insert into t1 (a) values (f1());
select * from t1;
a
1
drop view v1;
drop function f1;
select * from t1;
a
1
DROP PROCEDURE IF EXISTS p1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(col VARCHAR(10));
CREATE PROCEDURE p1(arg VARCHAR(10))
INSERT INTO t1 VALUES(arg);
CALL p1('test');
SELECT * FROM t1;
col
test
SELECT * FROM t1;
col
test
DROP PROCEDURE p1;
---> Test for BUG#20438
---> Preparing environment...
---> connection: master
DROP PROCEDURE IF EXISTS p1;
DROP FUNCTION IF EXISTS f1;
---> Synchronizing slave with master...
---> connection: master
---> Creating procedure...
/*!50003 CREATE PROCEDURE p1() SET @a = 1 */;
/*!50003 CREATE FUNCTION f1() RETURNS INT RETURN 0 */;
---> Checking on master...
SHOW CREATE PROCEDURE p1;
Procedure sql_mode Create Procedure
p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
SET @a = 1
SHOW CREATE FUNCTION f1;
Function sql_mode Create Function
f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
RETURN 0
---> Synchronizing slave with master...
---> connection: master
---> Checking on slave...
SHOW CREATE PROCEDURE p1;
Procedure sql_mode Create Procedure
p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
SET @a = 1
SHOW CREATE FUNCTION f1;
Function sql_mode Create Function
f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
RETURN 0
---> connection: master
---> Cleaning up...
DROP PROCEDURE p1;
DROP FUNCTION f1;
drop table t1;
drop database if exists mysqltest;
drop database if exists mysqltest2;
create database mysqltest;
create database mysqltest2;
use mysqltest2;
create table t ( t integer );
create procedure mysqltest.test() begin end;
insert into t values ( 1 );
create procedure `\\`.test() begin end;
ERROR 42000: Incorrect database name '\\'
create function f1 () returns int
begin
insert into t values (1);
return 0;
end|
use mysqltest;
set @a:= mysqltest2.f1();
show binlog events in 'master-bin.000001' from 98; show binlog events in 'master-bin.000001' from 98;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # drop database if exists mysqltest1 master-bin.000001 # Query 1 # drop database if exists mysqltest1
...@@ -329,7 +441,7 @@ insert into t1 values (x); ...@@ -329,7 +441,7 @@ insert into t1 values (x);
return x+2; return x+2;
end end
master-bin.000001 # Query 1 # use `mysqltest1`; delete t1,t2 from t1,t2 master-bin.000001 # Query 1 # use `mysqltest1`; delete t1,t2 from t1,t2
master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(20) master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20)
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(fn1(21)) master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(fn1(21))
master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1 master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1() master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1()
...@@ -362,32 +474,23 @@ begin ...@@ -362,32 +474,23 @@ begin
insert into t2 values(x),(x); insert into t2 values(x),(x);
return 10; return 10;
end end
master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(100) master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(100)
master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(20) master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20)
master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10 master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1) master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1)
master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1
master-bin.000001 # Query 1 # use `mysqltest1`; drop trigger trg master-bin.000001 # Query 1 # use `mysqltest1`; drop trigger trg
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1) master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1)
select * from t1; master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo()
a
1
create procedure foo()
not deterministic not deterministic
reads sql data reads sql data
select * from t1; select * from t1
call foo(); master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo
a master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1
1 master-bin.000001 # Query 1 # drop database mysqltest1
drop procedure foo; master-bin.000001 # Query 1 # drop user "zedjzlcsjhd"@127.0.0.1
drop function fn1; master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` function f1() returns int reads sql data
drop database mysqltest1;
drop user "zedjzlcsjhd"@127.0.0.1;
use test;
use test;
drop function if exists f1;
create function f1() returns int reads sql data
begin begin
declare var integer; declare var integer;
declare c cursor for select a from v1; declare c cursor for select a from v1;
...@@ -395,97 +498,37 @@ open c; ...@@ -395,97 +498,37 @@ open c;
fetch c into var; fetch c into var;
close c; close c;
return var; return var;
end| end
create view v1 as select 1 as a; master-bin.000001 # Query 1 # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 as a
create table t1 (a int); master-bin.000001 # Query 1 # use `test`; create table t1 (a int)
insert into t1 (a) values (f1()); master-bin.000001 # Query 1 # use `test`; insert into t1 (a) values (f1())
select * from t1; master-bin.000001 # Query 1 # use `test`; drop view v1
a master-bin.000001 # Query 1 # use `test`; drop function f1
1 master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS t1
drop view v1; master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(col VARCHAR(10))
drop function f1; master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE p1(arg VARCHAR(10))
select * from t1; INSERT INTO t1 VALUES(arg)
a master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test'))
1 master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE p1
DROP PROCEDURE IF EXISTS p1; master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE p1() SET @a = 1
DROP TABLE IF EXISTS t1; master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION f1() RETURNS INT RETURN 0
CREATE TABLE t1(col VARCHAR(10)); master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE p1
CREATE PROCEDURE p1(arg VARCHAR(10)) master-bin.000001 # Query 1 # use `test`; DROP FUNCTION f1
INSERT INTO t1 VALUES(arg); master-bin.000001 # Query 1 # use `test`; drop table t1
CALL p1('test'); master-bin.000001 # Query 1 # drop database if exists mysqltest
SELECT * FROM t1; master-bin.000001 # Query 1 # drop database if exists mysqltest2
col master-bin.000001 # Query 1 # create database mysqltest
test master-bin.000001 # Query 1 # create database mysqltest2
SELECT * FROM t1; master-bin.000001 # Query 1 # use `mysqltest2`; create table t ( t integer )
col master-bin.000001 # Query 1 # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` procedure mysqltest.test() begin end
test master-bin.000001 # Query 1 # use `mysqltest2`; insert into t values ( 1 )
DROP PROCEDURE p1; master-bin.000001 # Query 1 # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` function f1 () returns int
begin
---> Test for BUG#20438 insert into t values (1);
return 0;
---> Preparing environment... end
---> connection: master master-bin.000001 # Query 1 # use `mysqltest`; SELECT `mysqltest2`.`f1`()
DROP PROCEDURE IF EXISTS p1;
DROP FUNCTION IF EXISTS f1;
---> Synchronizing slave with master...
---> connection: master
---> Creating procedure...
/*!50003 CREATE PROCEDURE p1() SET @a = 1 */;
/*!50003 CREATE FUNCTION f1() RETURNS INT RETURN 0 */;
---> Checking on master...
SHOW CREATE PROCEDURE p1;
Procedure sql_mode Create Procedure
p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
SET @a = 1
SHOW CREATE FUNCTION f1;
Function sql_mode Create Function
f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
RETURN 0
---> Synchronizing slave with master...
---> connection: master
---> Checking on slave...
SHOW CREATE PROCEDURE p1;
Procedure sql_mode Create Procedure
p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
SET @a = 1
SHOW CREATE FUNCTION f1;
Function sql_mode Create Function
f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
RETURN 0
---> connection: master
---> Cleaning up...
DROP PROCEDURE p1;
DROP FUNCTION f1;
drop table t1;
set global log_bin_trust_function_creators=0; set global log_bin_trust_function_creators=0;
set global log_bin_trust_function_creators=0; set global log_bin_trust_function_creators=0;
reset master;
drop database if exists mysqltest;
drop database if exists mysqltest2;
create database mysqltest;
create database mysqltest2;
use mysqltest2;
create table t ( t integer );
create procedure mysqltest.test() begin end;
insert into t values ( 1 );
show binlog events in 'master-bin.000001' from 98;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 199 drop database if exists mysqltest
master-bin.000001 199 Query 1 302 drop database if exists mysqltest2
master-bin.000001 302 Query 1 395 create database mysqltest
master-bin.000001 395 Query 1 490 create database mysqltest2
master-bin.000001 490 Query 1 587 use `mysqltest2`; create table t ( t integer )
master-bin.000001 587 Query 1 726 use `mysqltest2`; CREATE DEFINER=`root`@`localhost` procedure mysqltest.test() begin end
master-bin.000001 726 Query 1 821 use `mysqltest2`; insert into t values ( 1 )
create procedure `\\`.test() begin end;
ERROR 42000: Incorrect database name '\\'
drop database mysqltest; drop database mysqltest;
drop database mysqltest2; drop database mysqltest2;
...@@ -44,27 +44,29 @@ t ...@@ -44,27 +44,29 @@ t
2004-06-11 09:39:02 2004-06-11 09:39:02
/*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
ROLLBACK; DELIMITER /*!*/;
use test; ROLLBACK/*!*/;
SET TIMESTAMP=100000000; use test/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; SET TIMESTAMP=100000000/*!*/;
SET @@session.sql_mode=0; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
/*!\C latin1 */; SET @@session.sql_mode=0/*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; /*!\C latin1 *//*!*/;
create table t1 (t timestamp); SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET TIMESTAMP=100000000; create table t1 (t timestamp)/*!*/;
create table t2 (t char(32)); SET TIMESTAMP=100000000/*!*/;
SET TIMESTAMP=100000000; create table t2 (t char(32))/*!*/;
SET @@session.time_zone='Europe/Moscow'; SET TIMESTAMP=100000000/*!*/;
insert into t1 values ('20050101000000'), ('20050611093902'); SET @@session.time_zone='Europe/Moscow'/*!*/;
SET TIMESTAMP=100000000; insert into t1 values ('20050101000000'), ('20050611093902')/*!*/;
SET @@session.time_zone='UTC'; SET TIMESTAMP=100000000/*!*/;
insert into t1 values ('20040101000000'), ('20040611093902'); SET @@session.time_zone='UTC'/*!*/;
SET TIMESTAMP=100000000; insert into t1 values ('20040101000000'), ('20040611093902')/*!*/;
delete from t1; SET TIMESTAMP=100000000/*!*/;
SET TIMESTAMP=100000000; delete from t1/*!*/;
SET @@session.time_zone='Europe/Moscow'; SET TIMESTAMP=100000000/*!*/;
insert into t1 values ('20040101000000'), ('20040611093902'); SET @@session.time_zone='Europe/Moscow'/*!*/;
insert into t1 values ('20040101000000'), ('20040611093902')/*!*/;
DELIMITER ;
# End of log file # End of log file
ROLLBACK /* added by mysqlbinlog */; ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
......
...@@ -15,19 +15,21 @@ master-bin.000001 273 User var 1 311 @`var2`=_binary 0x61 COLLATE binary ...@@ -15,19 +15,21 @@ master-bin.000001 273 User var 1 311 @`var2`=_binary 0x61 COLLATE binary
master-bin.000001 311 Query 1 411 use `test`; insert into t1 values (@var1),(@var2) master-bin.000001 311 Query 1 411 use `test`; insert into t1 values (@var1),(@var2)
/*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
ROLLBACK; DELIMITER /*!*/;
SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`; ROLLBACK/*!*/;
use test; SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`/*!*/;
SET TIMESTAMP=10000; use test/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; SET TIMESTAMP=10000/*!*/;
SET @@session.sql_mode=0; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
/*!\C latin1 */; SET @@session.sql_mode=0/*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; /*!\C latin1 *//*!*/;
INSERT INTO t1 VALUES(@`a b`); SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @`var1`:=_latin1 0x273B616161 COLLATE `latin1_swedish_ci`; INSERT INTO t1 VALUES(@`a b`)/*!*/;
SET @`var2`:=_binary 0x61 COLLATE `binary`; SET @`var1`:=_latin1 0x273B616161 COLLATE `latin1_swedish_ci`/*!*/;
SET TIMESTAMP=10000; SET @`var2`:=_binary 0x61 COLLATE `binary`/*!*/;
insert into t1 values (@var1),(@var2); SET TIMESTAMP=10000/*!*/;
insert into t1 values (@var1),(@var2)/*!*/;
DELIMITER ;
# End of log file # End of log file
ROLLBACK /* added by mysqlbinlog */; ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
......
...@@ -580,6 +580,63 @@ set names latin1; ...@@ -580,6 +580,63 @@ set names latin1;
select @@have_innodb; select @@have_innodb;
@@have_innodb @@have_innodb
# #
*** Various tests with LC_TIME_NAMES
*** LC_TIME_NAMES: testing case insensitivity
set @@lc_time_names='ru_ru';
select @@lc_time_names;
@@lc_time_names
ru_RU
*** LC_TIME_NAMES: testing with a user variable
set @lc='JA_JP';
set @@lc_time_names=@lc;
select @@lc_time_names;
@@lc_time_names
ja_JP
*** LC_TIME_NAMES: testing with string expressions
set lc_time_names=concat('de','_','DE');
select @@lc_time_names;
@@lc_time_names
de_DE
set lc_time_names=concat('de','+','DE');
ERROR HY000: Unknown locale: 'de+DE'
select @@lc_time_names;
@@lc_time_names
de_DE
LC_TIME_NAMES: testing with numeric expressions
set @@lc_time_names=1+2;
select @@lc_time_names;
@@lc_time_names
sv_SE
set @@lc_time_names=1/0;
ERROR 42000: Incorrect argument type to variable 'lc_time_names'
select @@lc_time_names;
@@lc_time_names
sv_SE
set lc_time_names=en_US;
LC_TIME_NAMES: testing NULL and a negative number:
set lc_time_names=NULL;
ERROR 42000: Variable 'lc_time_names' can't be set to the value of 'NULL'
set lc_time_names=-1;
ERROR HY000: Unknown locale: '-1'
select @@lc_time_names;
@@lc_time_names
en_US
LC_TIME_NAMES: testing locale with the last ID:
set lc_time_names=108;
select @@lc_time_names;
@@lc_time_names
zh_HK
LC_TIME_NAMES: testing a number beyond the valid ID range:
set lc_time_names=109;
ERROR HY000: Unknown locale: '109'
select @@lc_time_names;
@@lc_time_names
zh_HK
LC_TIME_NAMES: testing that 0 is en_US:
set lc_time_names=0;
select @@lc_time_names;
@@lc_time_names
en_US
set @test = @@query_prealloc_size; set @test = @@query_prealloc_size;
set @@query_prealloc_size = @test; set @@query_prealloc_size = @test;
select @@query_prealloc_size = @test; select @@query_prealloc_size = @test;
......
...@@ -93,6 +93,26 @@ show create table t1; ...@@ -93,6 +93,26 @@ show create table t1;
select * from t1; select * from t1;
drop table t1; drop table t1;
#
# Bug#22646 LC_TIME_NAMES: Assignment to non-UTF8 target fails
#
set names utf8;
set LC_TIME_NAMES='fr_FR';
create table t1 (s1 char(20) character set latin1);
insert into t1 values (date_format('2004-02-02','%M'));
select hex(s1) from t1;
drop table t1;
create table t1 (s1 char(20) character set koi8r);
set LC_TIME_NAMES='ru_RU';
insert into t1 values (date_format('2004-02-02','%M'));
insert into t1 values (date_format('2004-02-02','%b'));
insert into t1 values (date_format('2004-02-02','%W'));
insert into t1 values (date_format('2004-02-02','%a'));
select hex(s1), s1 from t1;
drop table t1;
set LC_TIME_NAMES='en_US';
# #
# Bug #2366 Wrong utf8 behaviour when data is truncated # Bug #2366 Wrong utf8 behaviour when data is truncated
# #
......
...@@ -290,6 +290,6 @@ eval select ...@@ -290,6 +290,6 @@ eval select
is not null; is not null;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
eval select eval select
@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%", @a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%",
@a not like "%#%error_code=%error_code=%"; @a not like "%#%error_code=%error_code=%";
drop table t1, t2; drop table t1, t2;
...@@ -134,6 +134,48 @@ flush logs; ...@@ -134,6 +134,48 @@ flush logs;
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000006 | $MYSQL --exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000006 | $MYSQL
select * from t5 /* must be (1),(1) */; select * from t5 /* must be (1),(1) */;
#
# Bug#22645 LC_TIME_NAMES: Statement not replicated
# Check that a dump created by mysqlbinlog reproduces
# lc_time_names dependent values correctly
#
flush logs;
drop table if exists t5;
create table t5 (c1 int, c2 varchar(128) character set latin1 not null);
insert into t5 values (1, date_format('2001-01-01','%W'));
set lc_time_names=de_DE;
insert into t5 values (2, date_format('2001-01-01','%W'));
set lc_time_names=en_US;
insert into t5 values (3, date_format('2001-01-01','%W'));
select * from t5 order by c1;
flush logs;
drop table t5;
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007 | $MYSQL
select * from t5 order by c1;
#
# Bug#20396 Bin Log does not get DELIMETER cmd - Recover StoredProc fails
#
--disable_warnings
drop procedure if exists p1;
--enable_warnings
flush logs;
delimiter //;
create procedure p1()
begin
select 1;
end;
//
delimiter ;//
flush logs;
call p1();
drop procedure p1;
--error 1305
call p1();
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000009
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000009 | $MYSQL
call p1();
drop procedure p1;
# clean up # clean up
drop table t1, t2, t03, t04, t3, t4, t5; drop table t1, t2, t03, t04, t3, t4, t5;
......
...@@ -713,6 +713,25 @@ create table t1 (a int); ...@@ -713,6 +713,25 @@ create table t1 (a int);
--exec $MYSQL_DUMP --skip-comments --force test t1 --where='xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 2>&1 --exec $MYSQL_DUMP --skip-comments --force test t1 --where='xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 2>&1
drop table t1; drop table t1;
--echo #
--echo # BUG#13926: --order-by-primary fails if PKEY contains quote character
--echo #
--disable_warnings
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a b` INT,
`c"d` INT,
`e``f` INT,
PRIMARY KEY (`a b`, `c"d`, `e``f`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
insert into t1 values (0815, 4711, 2006);
--exec $MYSQL_DUMP --skip-comments --compatible=ansi --order-by-primary test t1
--exec $MYSQL_DUMP --skip-comments --order-by-primary test t1
DROP TABLE `t1`;
--enable_warnings
--echo End of 4.1 tests --echo End of 4.1 tests
--echo # --echo #
...@@ -1393,25 +1412,6 @@ drop user myDB_User@localhost; ...@@ -1393,25 +1412,6 @@ drop user myDB_User@localhost;
drop database mysqldump_myDB; drop database mysqldump_myDB;
use test; use test;
--echo #
--echo # BUG#13926: --order-by-primary fails if PKEY contains quote character
--echo #
--disable_warnings
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a b` INT,
`c"d` INT,
`e``f` INT,
PRIMARY KEY (`a b`, `c"d`, `e``f`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
insert into t1 values (0815, 4711, 2006);
--exec $MYSQL_DUMP --skip-comments --compatible=ansi --order-by-primary test t1
--exec $MYSQL_DUMP --skip-comments --order-by-primary test t1
DROP TABLE `t1`;
--enable_warnings
--echo # --echo #
--echo # Bug #19745: mysqldump --xml produces invalid xml --echo # Bug #19745: mysqldump --xml produces invalid xml
--echo # --echo #
......
source include/have_sjis.inc;
source include/master-slave.inc;
--disable_warnings
drop table if exists t1;
drop procedure if exists p1;
--enable_warnings
create table t1 (a varchar(255) character set sjis);
create procedure p1 (in a varchar(255) character set sjis) insert into t1 values (a);
SET NAMES binary;
CALL p1 ('\\');
select "--- on master ---";
select hex(a) from t1 ;
sync_slave_with_master;
connection slave;
select "--- on slave ---";
select hex(a) from t1;
connection master;
drop table t1;
drop procedure p1;
sync_slave_with_master;
connection master;
# End of 5.0 tests
...@@ -33,6 +33,22 @@ connection slave; ...@@ -33,6 +33,22 @@ connection slave;
sync_with_master; sync_with_master;
select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant'; select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
#
# Bug#24158 SET PASSWORD in binary log fails under ANSI_QUOTES
#
connection master;
update mysql.user set password='' where user='rpl_do_grant';
flush privileges;
select password<>'' from mysql.user where user='rpl_do_grant';
set sql_mode='ANSI_QUOTES';
set password for rpl_do_grant@localhost=password('does it work?');
set sql_mode='';
save_master_pos;
connection slave;
sync_with_master;
select password<>'' from mysql.user where user='rpl_do_grant';
# clear what we have done, to not influence other tests. # clear what we have done, to not influence other tests.
connection master; connection master;
delete from mysql.user where user=_binary'rpl_do_grant'; delete from mysql.user where user=_binary'rpl_do_grant';
......
# Replication of locale variables
source include/master-slave.inc;
#
# Bug#22645 LC_TIME_NAMES: Statement not replicated
#
connection master;
create table t1 (s1 char(10));
set lc_time_names= 'de_DE';
insert into t1 values (date_format('2001-01-01','%W'));
set lc_time_names= 'en_US';
insert into t1 values (date_format('2001-01-01','%W'));
select * from t1;
sync_slave_with_master;
connection slave;
select * from t1;
connection master;
drop table t1;
sync_slave_with_master;
# End of 4.1 tests
...@@ -338,12 +338,13 @@ delete from t1; ...@@ -338,12 +338,13 @@ delete from t1;
drop trigger trg; drop trigger trg;
insert into t1 values (1); insert into t1 values (1);
select * from t1; select * from t1;
--replace_column 2 # 5 #
show binlog events in 'master-bin.000001' from 98;
sync_slave_with_master; sync_slave_with_master;
select * from t1; select * from t1;
# ********************** PART 4 : RELATED FIXED BUGS ***************
# #
# Test for bug #13969 "Routines which are replicated from master can't be # Test for bug #13969 "Routines which are replicated from master can't be
# executed on slave". # executed on slave".
...@@ -520,15 +521,11 @@ connection master; ...@@ -520,15 +521,11 @@ connection master;
drop table t1; drop table t1;
sync_slave_with_master; sync_slave_with_master;
# Restore log_bin_trust_function_creators to original value
set global log_bin_trust_function_creators=0;
connection master;
set global log_bin_trust_function_creators=0;
# #
# Bug22043: MySQL don't add "USE <DATABASE>" before "DROP PROCEDURE IF EXISTS" # Bug22043: MySQL don't add "USE <DATABASE>" before "DROP PROCEDURE IF EXISTS"
# #
connection master; connection master;
reset master;
--disable_warnings --disable_warnings
drop database if exists mysqltest; drop database if exists mysqltest;
drop database if exists mysqltest2; drop database if exists mysqltest2;
...@@ -539,11 +536,44 @@ use mysqltest2; ...@@ -539,11 +536,44 @@ use mysqltest2;
create table t ( t integer ); create table t ( t integer );
create procedure mysqltest.test() begin end; create procedure mysqltest.test() begin end;
insert into t values ( 1 ); insert into t values ( 1 );
show binlog events in 'master-bin.000001' from 98;
--error ER_WRONG_DB_NAME --error ER_WRONG_DB_NAME
create procedure `\\`.test() begin end; create procedure `\\`.test() begin end;
#
# BUG#19725: Calls to stored function in other database are not
# replicated correctly in some cases
#
connection master;
delimiter |;
create function f1 () returns int
begin
insert into t values (1);
return 0;
end|
delimiter ;|
sync_slave_with_master;
# Let us test if we don't forget to binlog the function's database
connection master;
use mysqltest;
set @a:= mysqltest2.f1();
sync_slave_with_master;
connection master;
# Final inspection which verifies how all statements of this test file
# were written to the binary log.
--replace_column 2 # 5 #
show binlog events in 'master-bin.000001' from 98;
# Restore log_bin_trust_function_creators to its original value.
# This is a cleanup for all parts above where we tested stored
# functions and triggers.
set global log_bin_trust_function_creators=0;
connection master;
set global log_bin_trust_function_creators=0;
# Clean up # Clean up
drop database mysqltest; drop database mysqltest;
drop database mysqltest2; drop database mysqltest2;
...@@ -460,6 +460,50 @@ set names latin1; ...@@ -460,6 +460,50 @@ set names latin1;
--replace_column 1 # --replace_column 1 #
select @@have_innodb; select @@have_innodb;
#
# Tests for lc_time_names
# Note, when adding new locales, please fix ID accordingly:
# - to test the last ID (currently 108)
# - and the next after the last (currently 109)
#
--echo *** Various tests with LC_TIME_NAMES
--echo *** LC_TIME_NAMES: testing case insensitivity
set @@lc_time_names='ru_ru';
select @@lc_time_names;
--echo *** LC_TIME_NAMES: testing with a user variable
set @lc='JA_JP';
set @@lc_time_names=@lc;
select @@lc_time_names;
--echo *** LC_TIME_NAMES: testing with string expressions
set lc_time_names=concat('de','_','DE');
select @@lc_time_names;
--error 1105
set lc_time_names=concat('de','+','DE');
select @@lc_time_names;
--echo LC_TIME_NAMES: testing with numeric expressions
set @@lc_time_names=1+2;
select @@lc_time_names;
--error 1232
set @@lc_time_names=1/0;
select @@lc_time_names;
set lc_time_names=en_US;
--echo LC_TIME_NAMES: testing NULL and a negative number:
--error 1231
set lc_time_names=NULL;
--error 1105
set lc_time_names=-1;
select @@lc_time_names;
--echo LC_TIME_NAMES: testing locale with the last ID:
set lc_time_names=108;
select @@lc_time_names;
--echo LC_TIME_NAMES: testing a number beyond the valid ID range:
--error 1105
set lc_time_names=109;
select @@lc_time_names;
--echo LC_TIME_NAMES: testing that 0 is en_US:
set lc_time_names=0;
select @@lc_time_names;
# #
# Bug #13334: query_prealloc_size default less than minimum # Bug #13334: query_prealloc_size default less than minimum
# #
......
...@@ -46,6 +46,23 @@ pthread_mutexattr_t my_fast_mutexattr; ...@@ -46,6 +46,23 @@ pthread_mutexattr_t my_fast_mutexattr;
pthread_mutexattr_t my_errorcheck_mutexattr; pthread_mutexattr_t my_errorcheck_mutexattr;
#endif #endif
#ifdef NPTL_PTHREAD_EXIT_BUG /* see my_pthread.h */
/*
Dummy thread spawned in my_thread_global_init() below to avoid
race conditions in NPTL pthread_exit code.
*/
static
pthread_handler_t nptl_pthread_exit_hack_handler(void *arg)
{
/* Do nothing! */
pthread_exit(0);
return 0;
}
#endif
/* /*
initialize thread environment initialize thread environment
...@@ -64,6 +81,28 @@ my_bool my_thread_global_init(void) ...@@ -64,6 +81,28 @@ my_bool my_thread_global_init(void)
fprintf(stderr,"Can't initialize threads: error %d\n",errno); fprintf(stderr,"Can't initialize threads: error %d\n",errno);
return 1; return 1;
} }
#ifdef NPTL_PTHREAD_EXIT_BUG
/*
BUG#24507: Race conditions inside current NPTL pthread_exit() implementation.
To avoid a possible segmentation fault during concurrent executions of
pthread_exit(), a dummy thread is spawned which initializes internal variables
of pthread lib. See bug description for thoroughfull explanation.
TODO: Remove this code when fixed versions of glibc6 are in common use.
*/
pthread_t dummy_thread;
pthread_attr_t dummy_thread_attr;
pthread_attr_init(&dummy_thread_attr);
pthread_attr_setdetachstate(&dummy_thread_attr,PTHREAD_CREATE_DETACHED);
pthread_create(&dummy_thread,&dummy_thread_attr,nptl_pthread_exit_hack_handler,NULL);
#endif
#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP #ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
/* /*
......
...@@ -608,16 +608,10 @@ bool make_date_time(DATE_TIME_FORMAT *format, TIME *l_time, ...@@ -608,16 +608,10 @@ bool make_date_time(DATE_TIME_FORMAT *format, TIME *l_time,
uint weekday; uint weekday;
ulong length; ulong length;
const char *ptr, *end; const char *ptr, *end;
MY_LOCALE *locale;
THD *thd= current_thd; THD *thd= current_thd;
char buf[STRING_BUFFER_USUAL_SIZE]; MY_LOCALE *locale= thd->variables.lc_time_names;
String tmp(buf, sizeof(buf), thd->variables.character_set_results);
uint errors= 0;
tmp.length(0);
str->length(0); str->length(0);
str->set_charset(&my_charset_bin);
locale = thd->variables.lc_time_names;
if (l_time->neg) if (l_time->neg)
str->append('-'); str->append('-');
...@@ -631,41 +625,37 @@ bool make_date_time(DATE_TIME_FORMAT *format, TIME *l_time, ...@@ -631,41 +625,37 @@ bool make_date_time(DATE_TIME_FORMAT *format, TIME *l_time,
{ {
switch (*++ptr) { switch (*++ptr) {
case 'M': case 'M':
if (!l_time->month) if (!l_time->month)
return 1; return 1;
tmp.copy(locale->month_names->type_names[l_time->month-1], str->append(locale->month_names->type_names[l_time->month-1],
strlen(locale->month_names->type_names[l_time->month-1]), strlen(locale->month_names->type_names[l_time->month-1]),
system_charset_info, tmp.charset(), &errors); system_charset_info);
str->append(tmp.ptr(), tmp.length()); break;
break;
case 'b': case 'b':
if (!l_time->month) if (!l_time->month)
return 1; return 1;
tmp.copy(locale->ab_month_names->type_names[l_time->month-1], str->append(locale->ab_month_names->type_names[l_time->month-1],
strlen(locale->ab_month_names->type_names[l_time->month-1]), strlen(locale->ab_month_names->type_names[l_time->month-1]),
system_charset_info, tmp.charset(), &errors); system_charset_info);
str->append(tmp.ptr(), tmp.length()); break;
break;
case 'W': case 'W':
if (type == MYSQL_TIMESTAMP_TIME) if (type == MYSQL_TIMESTAMP_TIME)
return 1; return 1;
weekday= calc_weekday(calc_daynr(l_time->year,l_time->month, weekday= calc_weekday(calc_daynr(l_time->year,l_time->month,
l_time->day),0); l_time->day),0);
tmp.copy(locale->day_names->type_names[weekday], str->append(locale->day_names->type_names[weekday],
strlen(locale->day_names->type_names[weekday]), strlen(locale->day_names->type_names[weekday]),
system_charset_info, tmp.charset(), &errors); system_charset_info);
str->append(tmp.ptr(), tmp.length()); break;
break;
case 'a': case 'a':
if (type == MYSQL_TIMESTAMP_TIME) if (type == MYSQL_TIMESTAMP_TIME)
return 1; return 1;
weekday=calc_weekday(calc_daynr(l_time->year,l_time->month, weekday=calc_weekday(calc_daynr(l_time->year,l_time->month,
l_time->day),0); l_time->day),0);
tmp.copy(locale->ab_day_names->type_names[weekday], str->append(locale->ab_day_names->type_names[weekday],
strlen(locale->ab_day_names->type_names[weekday]), strlen(locale->ab_day_names->type_names[weekday]),
system_charset_info, tmp.charset(), &errors); system_charset_info);
str->append(tmp.ptr(), tmp.length()); break;
break;
case 'D': case 'D':
if (type == MYSQL_TIMESTAMP_TIME) if (type == MYSQL_TIMESTAMP_TIME)
return 1; return 1;
...@@ -1709,6 +1699,7 @@ longlong Item_func_sec_to_time::val_int() ...@@ -1709,6 +1699,7 @@ longlong Item_func_sec_to_time::val_int()
void Item_func_date_format::fix_length_and_dec() void Item_func_date_format::fix_length_and_dec()
{ {
THD* thd= current_thd;
/* /*
Must use this_item() in case it's a local SP variable Must use this_item() in case it's a local SP variable
(for ->max_length and ->str_value) (for ->max_length and ->str_value)
...@@ -1716,22 +1707,18 @@ void Item_func_date_format::fix_length_and_dec() ...@@ -1716,22 +1707,18 @@ void Item_func_date_format::fix_length_and_dec()
Item *arg1= args[1]->this_item(); Item *arg1= args[1]->this_item();
decimals=0; decimals=0;
collation.set(&my_charset_bin); collation.set(thd->variables.collation_connection);
if (arg1->type() == STRING_ITEM) if (arg1->type() == STRING_ITEM)
{ // Optimize the normal case { // Optimize the normal case
fixed_length=1; fixed_length=1;
max_length= format_length(&arg1->str_value) *
/* collation.collation->mbmaxlen;
The result is a binary string (no reason to use collation->mbmaxlen
This is becasue make_date_time() only returns binary strings
*/
max_length= format_length(&arg1->str_value);
} }
else else
{ {
fixed_length=0; fixed_length=0;
/* The result is a binary string (no reason to use collation->mbmaxlen */ max_length=min(arg1->max_length, MAX_BLOB_WIDTH) * 10 *
max_length=min(arg1->max_length, MAX_BLOB_WIDTH) * 10; collation.collation->mbmaxlen;
set_if_smaller(max_length,MAX_BLOB_WIDTH); set_if_smaller(max_length,MAX_BLOB_WIDTH);
} }
maybe_null=1; // If wrong date maybe_null=1; // If wrong date
...@@ -1876,6 +1863,7 @@ String *Item_func_date_format::val_str(String *str) ...@@ -1876,6 +1863,7 @@ String *Item_func_date_format::val_str(String *str)
date_time_format.format.length= format->length(); date_time_format.format.length= format->length();
/* Create the result string */ /* Create the result string */
str->set_charset(collation.collation);
if (!make_date_time(&date_time_format, &l_time, if (!make_date_time(&date_time_format, &l_time,
is_time_format ? MYSQL_TIMESTAMP_TIME : is_time_format ? MYSQL_TIMESTAMP_TIME :
MYSQL_TIMESTAMP_DATE, MYSQL_TIMESTAMP_DATE,
......
This diff is collapsed.
...@@ -270,6 +270,8 @@ struct sql_ex_info ...@@ -270,6 +270,8 @@ struct sql_ex_info
*/ */
#define Q_CATALOG_NZ_CODE 6 #define Q_CATALOG_NZ_CODE 6
#define Q_LC_TIME_NAMES_CODE 7
/* Intvar event post-header */ /* Intvar event post-header */
#define I_TYPE_OFFSET 0 #define I_TYPE_OFFSET 0
...@@ -506,9 +508,11 @@ typedef struct st_print_event_info ...@@ -506,9 +508,11 @@ typedef struct st_print_event_info
bool charset_inited; bool charset_inited;
char charset[6]; // 3 variables, each of them storable in 2 bytes char charset[6]; // 3 variables, each of them storable in 2 bytes
char time_zone_str[MAX_TIME_ZONE_NAME_LENGTH]; char time_zone_str[MAX_TIME_ZONE_NAME_LENGTH];
uint lc_time_names_number;
st_print_event_info() st_print_event_info()
:flags2_inited(0), sql_mode_inited(0), :flags2_inited(0), sql_mode_inited(0),
auto_increment_increment(1),auto_increment_offset(1), charset_inited(0) auto_increment_increment(1),auto_increment_offset(1), charset_inited(0),
lc_time_names_number(0)
{ {
/* /*
Currently we only use static PRINT_EVENT_INFO objects, so zeroed at Currently we only use static PRINT_EVENT_INFO objects, so zeroed at
...@@ -518,12 +522,14 @@ typedef struct st_print_event_info ...@@ -518,12 +522,14 @@ typedef struct st_print_event_info
bzero(db, sizeof(db)); bzero(db, sizeof(db));
bzero(charset, sizeof(charset)); bzero(charset, sizeof(charset));
bzero(time_zone_str, sizeof(time_zone_str)); bzero(time_zone_str, sizeof(time_zone_str));
strcpy(delimiter, ";");
} }
/* Settings on how to print the events */ /* Settings on how to print the events */
bool short_form; bool short_form;
my_off_t hexdump_from; my_off_t hexdump_from;
uint8 common_header_len; uint8 common_header_len;
char delimiter[16];
} PRINT_EVENT_INFO; } PRINT_EVENT_INFO;
#endif #endif
...@@ -539,6 +545,13 @@ typedef struct st_print_event_info ...@@ -539,6 +545,13 @@ typedef struct st_print_event_info
class Log_event class Log_event
{ {
public: public:
/*
The following type definition is to be used whenever data is placed
and manipulated in a common buffer. Use this typedef for buffers
that contain data containing binary and character data.
*/
typedef unsigned char Byte;
/* /*
The offset in the log where this event originally appeared (it is The offset in the log where this event originally appeared (it is
preserved in relay logs, making SHOW SLAVE STATUS able to print preserved in relay logs, making SHOW SLAVE STATUS able to print
...@@ -712,7 +725,7 @@ class Log_event ...@@ -712,7 +725,7 @@ class Log_event
class Query_log_event: public Log_event class Query_log_event: public Log_event
{ {
protected: protected:
char* data_buf; Log_event::Byte* data_buf;
public: public:
const char* query; const char* query;
const char* catalog; const char* catalog;
...@@ -783,6 +796,7 @@ class Query_log_event: public Log_event ...@@ -783,6 +796,7 @@ class Query_log_event: public Log_event
char charset[6]; char charset[6];
uint time_zone_len; /* 0 means uninited */ uint time_zone_len; /* 0 means uninited */
const char *time_zone_str; const char *time_zone_str;
uint lc_time_names_number; /* 0 means en_US */
#ifndef MYSQL_CLIENT #ifndef MYSQL_CLIENT
......
...@@ -108,6 +108,7 @@ enum Derivation ...@@ -108,6 +108,7 @@ enum Derivation
typedef struct my_locale_st typedef struct my_locale_st
{ {
uint number;
const char *name; const char *name;
const char *description; const char *description;
const bool is_ascii; const bool is_ascii;
...@@ -116,9 +117,11 @@ typedef struct my_locale_st ...@@ -116,9 +117,11 @@ typedef struct my_locale_st
TYPELIB *day_names; TYPELIB *day_names;
TYPELIB *ab_day_names; TYPELIB *ab_day_names;
#ifdef __cplusplus #ifdef __cplusplus
my_locale_st(const char *name_par, const char *descr_par, bool is_ascii_par, my_locale_st(uint number_par,
const char *name_par, const char *descr_par, bool is_ascii_par,
TYPELIB *month_names_par, TYPELIB *ab_month_names_par, TYPELIB *month_names_par, TYPELIB *ab_month_names_par,
TYPELIB *day_names_par, TYPELIB *ab_day_names_par) : TYPELIB *day_names_par, TYPELIB *ab_day_names_par) :
number(number_par),
name(name_par), description(descr_par), is_ascii(is_ascii_par), name(name_par), description(descr_par), is_ascii(is_ascii_par),
month_names(month_names_par), ab_month_names(ab_month_names_par), month_names(month_names_par), ab_month_names(ab_month_names_par),
day_names(day_names_par), ab_day_names(ab_day_names_par) day_names(day_names_par), ab_day_names(ab_day_names_par)
...@@ -130,6 +133,7 @@ extern MY_LOCALE my_locale_en_US; ...@@ -130,6 +133,7 @@ extern MY_LOCALE my_locale_en_US;
extern MY_LOCALE *my_locales[]; extern MY_LOCALE *my_locales[];
MY_LOCALE *my_locale_by_name(const char *name); MY_LOCALE *my_locale_by_name(const char *name);
MY_LOCALE *my_locale_by_number(uint number);
/*************************************************************************** /***************************************************************************
Configuration parameters Configuration parameters
......
...@@ -2776,17 +2776,39 @@ byte *sys_var_max_user_conn::value_ptr(THD *thd, enum_var_type type, ...@@ -2776,17 +2776,39 @@ byte *sys_var_max_user_conn::value_ptr(THD *thd, enum_var_type type,
return (byte*) &(max_user_connections); return (byte*) &(max_user_connections);
} }
bool sys_var_thd_lc_time_names::check(THD *thd, set_var *var) bool sys_var_thd_lc_time_names::check(THD *thd, set_var *var)
{ {
char *locale_str =var->value->str_value.c_ptr(); MY_LOCALE *locale_match;
MY_LOCALE *locale_match= my_locale_by_name(locale_str);
if (locale_match == NULL) if (var->value->result_type() == INT_RESULT)
{ {
my_printf_error(ER_UNKNOWN_ERROR, if (!(locale_match= my_locale_by_number((uint) var->value->val_int())))
"Unknown locale: '%s'", MYF(0), locale_str); {
return 1; char buf[20];
int10_to_str((int) var->value->val_int(), buf, -10);
my_printf_error(ER_UNKNOWN_ERROR, "Unknown locale: '%s'", MYF(0), buf);
return 1;
}
}
else // STRING_RESULT
{
char buff[6];
String str(buff, sizeof(buff), &my_charset_latin1), *res;
if (!(res=var->value->val_str(&str)))
{
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, "NULL");
return 1;
}
const char *locale_str= res->c_ptr();
if (!(locale_match= my_locale_by_name(locale_str)))
{
my_printf_error(ER_UNKNOWN_ERROR,
"Unknown locale: '%s'", MYF(0), locale_str);
return 1;
}
} }
var->save_result.locale_value= locale_match; var->save_result.locale_value= locale_match;
return 0; return 0;
} }
......
...@@ -818,13 +818,17 @@ class sys_var_thd_lc_time_names :public sys_var_thd ...@@ -818,13 +818,17 @@ class sys_var_thd_lc_time_names :public sys_var_thd
{ {
public: public:
sys_var_thd_lc_time_names(const char *name_arg): sys_var_thd_lc_time_names(const char *name_arg):
sys_var_thd(name_arg) sys_var_thd(name_arg)
{} {
#if MYSQL_VERSION_ID < 50000
no_support_one_shot= 0;
#endif
}
bool check(THD *thd, set_var *var); bool check(THD *thd, set_var *var);
SHOW_TYPE type() { return SHOW_CHAR; } SHOW_TYPE type() { return SHOW_CHAR; }
bool check_update_type(Item_result type) bool check_update_type(Item_result type)
{ {
return type != STRING_RESULT; /* Only accept strings */ return ((type != STRING_RESULT) && (type != INT_RESULT));
} }
bool check_default(enum_var_type type) { return 0; } bool check_default(enum_var_type type) { return 0; }
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
......
...@@ -92,7 +92,7 @@ sp_map_item_type(enum enum_field_types type) ...@@ -92,7 +92,7 @@ sp_map_item_type(enum enum_field_types type)
*/ */
static String * static String *
sp_get_item_value(Item *item, String *str) sp_get_item_value(THD *thd, Item *item, String *str)
{ {
Item_result result_type= item->result_type(); Item_result result_type= item->result_type();
...@@ -112,15 +112,16 @@ sp_get_item_value(Item *item, String *str) ...@@ -112,15 +112,16 @@ sp_get_item_value(Item *item, String *str)
{ {
char buf_holder[STRING_BUFFER_USUAL_SIZE]; char buf_holder[STRING_BUFFER_USUAL_SIZE];
String buf(buf_holder, sizeof(buf_holder), result->charset()); String buf(buf_holder, sizeof(buf_holder), result->charset());
CHARSET_INFO *cs= thd->variables.character_set_client;
/* We must reset length of the buffer, because of String specificity. */ /* We must reset length of the buffer, because of String specificity. */
buf.length(0); buf.length(0);
buf.append('_'); buf.append('_');
buf.append(result->charset()->csname); buf.append(result->charset()->csname);
if (result->charset()->escape_with_backslash_is_dangerous) if (cs->escape_with_backslash_is_dangerous)
buf.append(' '); buf.append(' ');
append_query_string(result->charset(), result, &buf); append_query_string(cs, result, &buf);
str->copy(buf); str->copy(buf);
return str; return str;
...@@ -864,7 +865,7 @@ subst_spvars(THD *thd, sp_instr *instr, LEX_STRING *query_str) ...@@ -864,7 +865,7 @@ subst_spvars(THD *thd, sp_instr *instr, LEX_STRING *query_str)
val= (*splocal)->this_item(); val= (*splocal)->this_item();
DBUG_PRINT("info", ("print %p", val)); DBUG_PRINT("info", ("print %p", val));
str_value= sp_get_item_value(val, &str_value_holder); str_value= sp_get_item_value(thd, val, &str_value_holder);
if (str_value) if (str_value)
res|= qbuf.append(*str_value); res|= qbuf.append(*str_value);
else else
...@@ -1448,6 +1449,8 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, ...@@ -1448,6 +1449,8 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount,
{ {
binlog_buf.length(0); binlog_buf.length(0);
binlog_buf.append(STRING_WITH_LEN("SELECT ")); binlog_buf.append(STRING_WITH_LEN("SELECT "));
append_identifier(thd, &binlog_buf, m_db.str, m_db.length);
binlog_buf.append('.');
append_identifier(thd, &binlog_buf, m_name.str, m_name.length); append_identifier(thd, &binlog_buf, m_name.str, m_name.length);
binlog_buf.append('('); binlog_buf.append('(');
for (arg_no= 0; arg_no < argcount; arg_no++) for (arg_no= 0; arg_no < argcount; arg_no++)
...@@ -1458,7 +1461,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, ...@@ -1458,7 +1461,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount,
if (arg_no) if (arg_no)
binlog_buf.append(','); binlog_buf.append(',');
str_value= sp_get_item_value(nctx->get_item(arg_no), str_value= sp_get_item_value(thd, nctx->get_item(arg_no),
&str_value_holder); &str_value_holder);
if (str_value) if (str_value)
......
...@@ -1497,7 +1497,7 @@ bool change_password(THD *thd, const char *host, const char *user, ...@@ -1497,7 +1497,7 @@ bool change_password(THD *thd, const char *host, const char *user,
{ {
query_length= query_length=
my_sprintf(buff, my_sprintf(buff,
(buff,"SET PASSWORD FOR \"%-.120s\"@\"%-.120s\"=\"%-.120s\"", (buff,"SET PASSWORD FOR '%-.120s'@'%-.120s'='%-.120s'",
acl_user->user ? acl_user->user : "", acl_user->user ? acl_user->user : "",
acl_user->host.hostname ? acl_user->host.hostname : "", acl_user->host.hostname ? acl_user->host.hostname : "",
new_password)); new_password));
......
This diff is collapsed.
...@@ -2384,6 +2384,7 @@ static void reset_one_shot_variables(THD *thd) ...@@ -2384,6 +2384,7 @@ static void reset_one_shot_variables(THD *thd)
thd->update_charset(); thd->update_charset();
thd->variables.time_zone= thd->variables.time_zone=
global_system_variables.time_zone; global_system_variables.time_zone;
thd->variables.lc_time_names= &my_locale_en_US;
thd->one_shot_set= 0; thd->one_shot_set= 0;
} }
......
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