Merge siva.hindu.god:/home/tsmith/m/bk/mrg-jan17/50
into siva.hindu.god:/home/tsmith/m/bk/mrg-jan17/maint/50
This commit is contained in:
commit
244b2004ee
@ -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()
|
|||||||
|
|
||||||
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,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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");
|
|||||||
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");
|
|||||||
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",
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
@ -1382,7 +1398,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" {
|
|||||||
#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))
|
|||||||
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
|
|||||||
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");
|
|||||||
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;
|
|||||||
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;
|
||||||
|
@ -15,31 +15,33 @@ flush logs;
|
|||||||
--- Local --
|
--- Local --
|
||||||
/*!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=1000000000;
|
use test/*!*/;
|
||||||
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 table if exists t1,t2;
|
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
||||||
SET TIMESTAMP=1000000000;
|
drop table if exists t1,t2/*!*/;
|
||||||
create table t1 (word varchar(20));
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
SET TIMESTAMP=1000000000;
|
create table t1 (word varchar(20))/*!*/;
|
||||||
create table t2 (id int auto_increment not null primary key);
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
SET TIMESTAMP=1000000000;
|
create table t2 (id int auto_increment not null primary key)/*!*/;
|
||||||
insert into t1 values ("abirvalg");
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
SET INSERT_ID=1;
|
insert into t1 values ("abirvalg")/*!*/;
|
||||||
SET TIMESTAMP=1000000000;
|
SET INSERT_ID=1/*!*/;
|
||||||
insert into t2 values ();
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
SET TIMESTAMP=1000000000;
|
insert into t2 values ()/*!*/;
|
||||||
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-1-0' INTO table t1;
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
SET TIMESTAMP=1000000000;
|
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-1-0' INTO table t1/*!*/;
|
||||||
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-2-0' INTO table t1;
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
SET TIMESTAMP=1000000000;
|
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-2-0' INTO table t1/*!*/;
|
||||||
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-3-0' INTO table t1;
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
SET TIMESTAMP=1000000000;
|
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-3-0' INTO table t1/*!*/;
|
||||||
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-4-0' INTO table t1;
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
|
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-4-0' INTO table t1/*!*/;
|
||||||
|
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*/;
|
||||||
@ -47,13 +49,15 @@ ROLLBACK /* added by mysqlbinlog */;
|
|||||||
--- Broken LOAD DATA --
|
--- Broken LOAD DATA --
|
||||||
/*!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*/;
|
||||||
use test;
|
DELIMITER /*!*/;
|
||||||
SET TIMESTAMP=1000000000;
|
use test/*!*/;
|
||||||
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 *//*!*/;
|
||||||
insert into t1 values ("Alas");
|
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
||||||
|
insert into t1 values ("Alas")/*!*/;
|
||||||
|
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*/;
|
||||||
@ -61,8 +65,10 @@ ROLLBACK /* added by mysqlbinlog */;
|
|||||||
--- --database --
|
--- --database --
|
||||||
/*!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 INSERT_ID=1;
|
ROLLBACK/*!*/;
|
||||||
|
SET INSERT_ID=1/*!*/;
|
||||||
|
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*/;
|
||||||
@ -70,13 +76,15 @@ ROLLBACK /* added by mysqlbinlog */;
|
|||||||
--- --position --
|
--- --position --
|
||||||
/*!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*/;
|
||||||
use test;
|
DELIMITER /*!*/;
|
||||||
SET TIMESTAMP=1000000000;
|
use test/*!*/;
|
||||||
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 *//*!*/;
|
||||||
insert into t1 values ("Alas");
|
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
||||||
|
insert into t1 values ("Alas")/*!*/;
|
||||||
|
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*/;
|
||||||
@ -84,31 +92,33 @@ ROLLBACK /* added by mysqlbinlog */;
|
|||||||
--- Remote --
|
--- Remote --
|
||||||
/*!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=1000000000;
|
use test/*!*/;
|
||||||
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 table if exists t1,t2;
|
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
||||||
SET TIMESTAMP=1000000000;
|
drop table if exists t1,t2/*!*/;
|
||||||
create table t1 (word varchar(20));
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
SET TIMESTAMP=1000000000;
|
create table t1 (word varchar(20))/*!*/;
|
||||||
create table t2 (id int auto_increment not null primary key);
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
SET TIMESTAMP=1000000000;
|
create table t2 (id int auto_increment not null primary key)/*!*/;
|
||||||
insert into t1 values ("abirvalg");
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
SET INSERT_ID=1;
|
insert into t1 values ("abirvalg")/*!*/;
|
||||||
SET TIMESTAMP=1000000000;
|
SET INSERT_ID=1/*!*/;
|
||||||
insert into t2 values ();
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
SET TIMESTAMP=1000000000;
|
insert into t2 values ()/*!*/;
|
||||||
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-1-2' INTO table t1;
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
SET TIMESTAMP=1000000000;
|
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-1-2' INTO table t1/*!*/;
|
||||||
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-2-2' INTO table t1;
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
SET TIMESTAMP=1000000000;
|
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-2-2' INTO table t1/*!*/;
|
||||||
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-3-2' INTO table t1;
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
SET TIMESTAMP=1000000000;
|
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-3-2' INTO table t1/*!*/;
|
||||||
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-4-2' INTO table t1;
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
|
load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-4-2' INTO table t1/*!*/;
|
||||||
|
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*/;
|
||||||
@ -116,13 +126,15 @@ ROLLBACK /* added by mysqlbinlog */;
|
|||||||
--- Broken LOAD DATA --
|
--- Broken LOAD DATA --
|
||||||
/*!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*/;
|
||||||
use test;
|
DELIMITER /*!*/;
|
||||||
SET TIMESTAMP=1000000000;
|
use test/*!*/;
|
||||||
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 *//*!*/;
|
||||||
insert into t1 values ("Alas");
|
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
||||||
|
insert into t1 values ("Alas")/*!*/;
|
||||||
|
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*/;
|
||||||
@ -130,8 +142,10 @@ ROLLBACK /* added by mysqlbinlog */;
|
|||||||
--- --database --
|
--- --database --
|
||||||
/*!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 INSERT_ID=1;
|
ROLLBACK/*!*/;
|
||||||
|
SET INSERT_ID=1/*!*/;
|
||||||
|
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*/;
|
||||||
@ -139,13 +153,15 @@ ROLLBACK /* added by mysqlbinlog */;
|
|||||||
--- --position --
|
--- --position --
|
||||||
/*!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*/;
|
||||||
use test;
|
DELIMITER /*!*/;
|
||||||
SET TIMESTAMP=1000000000;
|
use test/*!*/;
|
||||||
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 *//*!*/;
|
||||||
insert into t1 values ("Alas");
|
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
||||||
|
insert into t1 values ("Alas")/*!*/;
|
||||||
|
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*/;
|
||||||
@ -153,22 +169,26 @@ ROLLBACK /* added by mysqlbinlog */;
|
|||||||
--- reading stdin --
|
--- reading stdin --
|
||||||
/*!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=1108844556;
|
use test/*!*/;
|
||||||
BEGIN;
|
SET TIMESTAMP=1108844556/*!*/;
|
||||||
SET TIMESTAMP=1108844555;
|
BEGIN/*!*/;
|
||||||
insert t1 values (1);
|
SET TIMESTAMP=1108844555/*!*/;
|
||||||
|
insert t1 values (1)/*!*/;
|
||||||
|
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*/;
|
||||||
/*!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*/;
|
||||||
use test;
|
DELIMITER /*!*/;
|
||||||
SET TIMESTAMP=1108844556;
|
use test/*!*/;
|
||||||
BEGIN;
|
SET TIMESTAMP=1108844556/*!*/;
|
||||||
SET TIMESTAMP=1108844555;
|
BEGIN/*!*/;
|
||||||
insert t1 values (1);
|
SET TIMESTAMP=1108844555/*!*/;
|
||||||
|
insert t1 values (1)/*!*/;
|
||||||
|
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*/;
|
||||||
@ -194,4 +214,59 @@ select * from t5 /* must be (1),(1) */;
|
|||||||
a
|
a
|
||||||
1
|
1
|
||||||
1
|
1
|
||||||
|
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;
|
||||||
|
c1 c2
|
||||||
|
1 Monday
|
||||||
|
2 Montag
|
||||||
|
3 Monday
|
||||||
|
flush logs;
|
||||||
|
drop table t5;
|
||||||
|
select * from t5 order by c1;
|
||||||
|
c1 c2
|
||||||
|
1 Monday
|
||||||
|
2 Montag
|
||||||
|
3 Monday
|
||||||
|
drop procedure if exists p1;
|
||||||
|
flush logs;
|
||||||
|
create procedure p1()
|
||||||
|
begin
|
||||||
|
select 1;
|
||||||
|
end;
|
||||||
|
//
|
||||||
|
flush logs;
|
||||||
|
call p1();
|
||||||
|
1
|
||||||
|
1
|
||||||
|
drop procedure p1;
|
||||||
|
call p1();
|
||||||
|
ERROR 42000: PROCEDURE test.p1 does not exist
|
||||||
|
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||||
|
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
||||||
|
DELIMITER /*!*/;
|
||||||
|
use test/*!*/;
|
||||||
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
|
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
|
||||||
|
SET @@session.sql_mode=0/*!*/;
|
||||||
|
/*!\C latin1 *//*!*/;
|
||||||
|
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
||||||
|
CREATE DEFINER=`root`@`localhost` procedure p1()
|
||||||
|
begin
|
||||||
|
select 1;
|
||||||
|
end/*!*/;
|
||||||
|
DELIMITER ;
|
||||||
|
# End of log file
|
||||||
|
ROLLBACK /* added by mysqlbinlog */;
|
||||||
|
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||||
|
call p1();
|
||||||
|
1
|
||||||
|
1
|
||||||
|
drop procedure p1;
|
||||||
drop table t1, t2, t03, t04, t3, t4, t5;
|
drop table t1, t2, t03, t04, t3, t4, t5;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -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;
|
|||||||
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;
|
||||||
|
@ -87,11 +87,27 @@ x y z
|
|||||||
rollback;
|
rollback;
|
||||||
commit;
|
commit;
|
||||||
begin;
|
begin;
|
||||||
|
select * from t1 where y = 'one' or y = 'three' for update;
|
||||||
|
x y z
|
||||||
|
# # #
|
||||||
|
# # #
|
||||||
|
begin;
|
||||||
|
select * from t1 where x = 2 for update;
|
||||||
|
x y z
|
||||||
|
2 two 2
|
||||||
|
select * from t1 where x = 1 for update;
|
||||||
|
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||||
|
rollback;
|
||||||
|
commit;
|
||||||
|
begin;
|
||||||
select * from t1 where y = 'one' or y = 'three' order by x for update;
|
select * from t1 where y = 'one' or y = 'three' order by x for update;
|
||||||
x y z
|
x y z
|
||||||
1 one 1
|
1 one 1
|
||||||
3 three 3
|
3 three 3
|
||||||
begin;
|
begin;
|
||||||
|
select * from t1 where x = 2 for update;
|
||||||
|
x y z
|
||||||
|
2 two 2
|
||||||
select * from t1 where x = 1 for update;
|
select * from t1 where x = 1 for update;
|
||||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||||
rollback;
|
rollback;
|
||||||
@ -124,6 +140,22 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
|||||||
rollback;
|
rollback;
|
||||||
commit;
|
commit;
|
||||||
begin;
|
begin;
|
||||||
|
select * from t1 where y = 'one' or y = 'three' lock in share mode;
|
||||||
|
x y z
|
||||||
|
# # #
|
||||||
|
# # #
|
||||||
|
begin;
|
||||||
|
select * from t1 where y = 'one' lock in share mode;
|
||||||
|
x y z
|
||||||
|
1 one 1
|
||||||
|
select * from t1 where x = 2 for update;
|
||||||
|
x y z
|
||||||
|
2 two 2
|
||||||
|
select * from t1 where x = 1 for update;
|
||||||
|
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||||
|
rollback;
|
||||||
|
commit;
|
||||||
|
begin;
|
||||||
select * from t1 where y = 'one' or y = 'three' order by x lock in share mode;
|
select * from t1 where y = 'one' or y = 'three' order by x lock in share mode;
|
||||||
x y z
|
x y z
|
||||||
1 one 1
|
1 one 1
|
||||||
@ -132,6 +164,9 @@ begin;
|
|||||||
select * from t1 where y = 'one' lock in share mode;
|
select * from t1 where y = 'one' lock in share mode;
|
||||||
x y z
|
x y z
|
||||||
1 one 1
|
1 one 1
|
||||||
|
select * from t1 where x = 2 for update;
|
||||||
|
x y z
|
||||||
|
2 two 2
|
||||||
select * from t1 where x = 1 for update;
|
select * from t1 where x = 1 for update;
|
||||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||||
rollback;
|
rollback;
|
||||||
|
@ -1055,6 +1055,65 @@ EXECUTE stmt USING @a;
|
|||||||
0 0
|
0 0
|
||||||
DEALLOCATE PREPARE stmt;
|
DEALLOCATE PREPARE stmt;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
DROP TABLE IF EXISTS t1, t2;
|
||||||
|
CREATE TABLE t1 (i INT);
|
||||||
|
PREPARE st_19182
|
||||||
|
FROM "CREATE TABLE t2 (i INT, j INT, KEY (i), KEY(j)) SELECT i FROM t1";
|
||||||
|
EXECUTE st_19182;
|
||||||
|
DESC t2;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
j int(11) YES MUL NULL
|
||||||
|
i int(11) YES MUL NULL
|
||||||
|
DROP TABLE t2;
|
||||||
|
EXECUTE st_19182;
|
||||||
|
DESC t2;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
j int(11) YES MUL NULL
|
||||||
|
i int(11) YES MUL NULL
|
||||||
|
DEALLOCATE PREPARE st_19182;
|
||||||
|
DROP TABLE t2, t1;
|
||||||
|
drop database if exists mysqltest;
|
||||||
|
drop table if exists t1, t2;
|
||||||
|
create database mysqltest character set utf8;
|
||||||
|
prepare stmt1 from "create table mysqltest.t1 (c char(10))";
|
||||||
|
prepare stmt2 from "create table mysqltest.t2 select 'test'";
|
||||||
|
execute stmt1;
|
||||||
|
execute stmt2;
|
||||||
|
show create table mysqltest.t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`c` char(10) default NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8
|
||||||
|
show create table mysqltest.t2;
|
||||||
|
Table Create Table
|
||||||
|
t2 CREATE TABLE `t2` (
|
||||||
|
`test` varchar(4) character set latin1 NOT NULL default ''
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8
|
||||||
|
drop table mysqltest.t1;
|
||||||
|
drop table mysqltest.t2;
|
||||||
|
alter database mysqltest character set latin1;
|
||||||
|
execute stmt1;
|
||||||
|
execute stmt2;
|
||||||
|
show create table mysqltest.t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`c` char(10) character set utf8 default NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
show create table mysqltest.t2;
|
||||||
|
Table Create Table
|
||||||
|
t2 CREATE TABLE `t2` (
|
||||||
|
`test` varchar(4) NOT NULL default ''
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
drop database mysqltest;
|
||||||
|
deallocate prepare stmt1;
|
||||||
|
deallocate prepare stmt2;
|
||||||
|
execute stmt;
|
||||||
|
show create table t1;
|
||||||
|
drop table t1;
|
||||||
|
execute stmt;
|
||||||
|
show create table t1;
|
||||||
|
drop table t1;
|
||||||
|
deallocate prepare stmt;
|
||||||
End of 4.1 tests.
|
End of 4.1 tests.
|
||||||
create table t1 (a varchar(20));
|
create table t1 (a varchar(20));
|
||||||
insert into t1 values ('foo');
|
insert into t1 values ('foo');
|
||||||
@ -1536,4 +1595,54 @@ a
|
|||||||
2
|
2
|
||||||
DEALLOCATE PREPARE stmt;
|
DEALLOCATE PREPARE stmt;
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
|
drop table if exists t1;
|
||||||
|
create table t1 (s1 char(20));
|
||||||
|
prepare stmt from "alter table t1 modify s1 int";
|
||||||
|
execute stmt;
|
||||||
|
execute stmt;
|
||||||
|
drop table t1;
|
||||||
|
deallocate prepare stmt;
|
||||||
|
drop table if exists t1;
|
||||||
|
create table t1 (a int, b int);
|
||||||
|
prepare s_6895 from "alter table t1 drop column b";
|
||||||
|
execute s_6895;
|
||||||
|
show columns from t1;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
a int(11) YES NULL
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (a int, b int);
|
||||||
|
execute s_6895;
|
||||||
|
show columns from t1;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
a int(11) YES NULL
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (a int, b int);
|
||||||
|
execute s_6895;
|
||||||
|
show columns from t1;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
a int(11) YES NULL
|
||||||
|
deallocate prepare s_6895;
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (i int primary key auto_increment) comment='comment for table t1';
|
||||||
|
create table t2 (i int, j int, k int);
|
||||||
|
prepare stmt from "alter table t1 auto_increment=100";
|
||||||
|
execute stmt;
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`i` int(11) NOT NULL auto_increment,
|
||||||
|
PRIMARY KEY (`i`)
|
||||||
|
) ENGINE=MyISAM AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 COMMENT='comment for table t1'
|
||||||
|
flush tables;
|
||||||
|
select * from t2;
|
||||||
|
i j k
|
||||||
|
execute stmt;
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`i` int(11) NOT NULL auto_increment,
|
||||||
|
PRIMARY KEY (`i`)
|
||||||
|
) ENGINE=MyISAM AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 COMMENT='comment for table t1'
|
||||||
|
deallocate prepare stmt;
|
||||||
|
drop table t1, t2;
|
||||||
End of 5.0 tests.
|
End of 5.0 tests.
|
||||||
|
@ -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("Müller","Muffler"));
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
SET INSERT_ID=3;
|
insert into t1 (b) values(LEAST("Müller","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("Müller","Muffler"));
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
SET TIMESTAMP=1000000000;
|
insert into t1 (b) values(LEAST("Müller","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*/;
|
||||||
|
26
mysql-test/r/rpl_charset_sjis.result
Normal file
26
mysql-test/r/rpl_charset_sjis.result
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
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?");
|
|||||||
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;
|
||||||
|
20
mysql-test/r/rpl_locale.result
Normal file
20
mysql-test/r/rpl_locale.result
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
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,107 +269,6 @@ insert into t1 values (1);
|
|||||||
select * from t1;
|
select * from t1;
|
||||||
a
|
a
|
||||||
1
|
1
|
||||||
show binlog events in 'master-bin.000001' from 98;
|
|
||||||
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 # create database mysqltest1
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a varchar(100))
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo()
|
|
||||||
begin
|
|
||||||
declare b int;
|
|
||||||
set b = 8;
|
|
||||||
insert into t1 values (b);
|
|
||||||
insert into t1 values (unix_timestamp());
|
|
||||||
end
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values ( NAME_CONST('b',8))
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (unix_timestamp())
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo2()
|
|
||||||
select * from mysqltest1.t1
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; alter procedure foo2 contains sql
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int)
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; create table t2 like t1
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo3()
|
|
||||||
deterministic
|
|
||||||
insert into t1 values (15)
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` procedure foo4()
|
|
||||||
deterministic
|
|
||||||
begin
|
|
||||||
insert into t2 values(3);
|
|
||||||
insert into t1 values (5);
|
|
||||||
end
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3)
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (15)
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3)
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; alter procedure foo4 sql security invoker
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3)
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (5)
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a)
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo4
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo4()
|
|
||||||
deterministic
|
|
||||||
begin
|
|
||||||
insert into t2 values(20),(20);
|
|
||||||
end
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(20),(20)
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo4
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo2
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo3
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1(x int)
|
|
||||||
returns int
|
|
||||||
deterministic
|
|
||||||
begin
|
|
||||||
insert into t1 values (x);
|
|
||||||
return x+2;
|
|
||||||
end
|
|
||||||
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`; insert into t2 values(fn1(21))
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1()
|
|
||||||
returns int
|
|
||||||
no sql
|
|
||||||
begin
|
|
||||||
return unix_timestamp();
|
|
||||||
end
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(fn1())
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` function fn2()
|
|
||||||
returns int
|
|
||||||
no sql
|
|
||||||
begin
|
|
||||||
return unix_timestamp();
|
|
||||||
end
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn3()
|
|
||||||
returns int
|
|
||||||
not deterministic
|
|
||||||
reads sql data
|
|
||||||
begin
|
|
||||||
return 0;
|
|
||||||
end
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a)
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1(x int)
|
|
||||||
returns int
|
|
||||||
begin
|
|
||||||
insert into t2 values(x),(x);
|
|
||||||
return 10;
|
|
||||||
end
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(100)
|
|
||||||
master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(20)
|
|
||||||
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`; insert into t1 values (1)
|
|
||||||
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`; insert into t1 values (1)
|
|
||||||
select * from t1;
|
select * from t1;
|
||||||
a
|
a
|
||||||
1
|
1
|
||||||
@ -465,9 +364,6 @@ RETURN 0
|
|||||||
DROP PROCEDURE p1;
|
DROP PROCEDURE p1;
|
||||||
DROP FUNCTION f1;
|
DROP FUNCTION f1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
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 mysqltest;
|
||||||
drop database if exists mysqltest2;
|
drop database if exists mysqltest2;
|
||||||
create database mysqltest;
|
create database mysqltest;
|
||||||
@ -476,16 +372,163 @@ 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;
|
|
||||||
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;
|
create procedure `\\`.test() begin end;
|
||||||
ERROR 42000: Incorrect database name '\\'
|
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;
|
||||||
|
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 # create database mysqltest1
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a varchar(100))
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo()
|
||||||
|
begin
|
||||||
|
declare b int;
|
||||||
|
set b = 8;
|
||||||
|
insert into t1 values (b);
|
||||||
|
insert into t1 values (unix_timestamp());
|
||||||
|
end
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values ( NAME_CONST('b',8))
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (unix_timestamp())
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo2()
|
||||||
|
select * from mysqltest1.t1
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; alter procedure foo2 contains sql
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int)
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; create table t2 like t1
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo3()
|
||||||
|
deterministic
|
||||||
|
insert into t1 values (15)
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` procedure foo4()
|
||||||
|
deterministic
|
||||||
|
begin
|
||||||
|
insert into t2 values(3);
|
||||||
|
insert into t1 values (5);
|
||||||
|
end
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3)
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (15)
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3)
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; alter procedure foo4 sql security invoker
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3)
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (5)
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a)
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo4
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo4()
|
||||||
|
deterministic
|
||||||
|
begin
|
||||||
|
insert into t2 values(20),(20);
|
||||||
|
end
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(20),(20)
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo4
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo2
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo3
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1(x int)
|
||||||
|
returns int
|
||||||
|
deterministic
|
||||||
|
begin
|
||||||
|
insert into t1 values (x);
|
||||||
|
return x+2;
|
||||||
|
end
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; delete t1,t2 from t1,t2
|
||||||
|
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`; drop function fn1
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1()
|
||||||
|
returns int
|
||||||
|
no sql
|
||||||
|
begin
|
||||||
|
return unix_timestamp();
|
||||||
|
end
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(fn1())
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` function fn2()
|
||||||
|
returns int
|
||||||
|
no sql
|
||||||
|
begin
|
||||||
|
return unix_timestamp();
|
||||||
|
end
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn3()
|
||||||
|
returns int
|
||||||
|
not deterministic
|
||||||
|
reads sql data
|
||||||
|
begin
|
||||||
|
return 0;
|
||||||
|
end
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a)
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1(x int)
|
||||||
|
returns int
|
||||||
|
begin
|
||||||
|
insert into t2 values(x),(x);
|
||||||
|
return 10;
|
||||||
|
end
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(100)
|
||||||
|
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`; 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`; delete from t1
|
||||||
|
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`; CREATE DEFINER=`root`@`localhost` procedure foo()
|
||||||
|
not deterministic
|
||||||
|
reads sql data
|
||||||
|
select * from t1
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1
|
||||||
|
master-bin.000001 # Query 1 # drop database mysqltest1
|
||||||
|
master-bin.000001 # Query 1 # drop user "zedjzlcsjhd"@127.0.0.1
|
||||||
|
master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` 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
|
||||||
|
master-bin.000001 # Query 1 # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 as a
|
||||||
|
master-bin.000001 # Query 1 # use `test`; create table t1 (a int)
|
||||||
|
master-bin.000001 # Query 1 # use `test`; insert into t1 (a) values (f1())
|
||||||
|
master-bin.000001 # Query 1 # use `test`; drop view v1
|
||||||
|
master-bin.000001 # Query 1 # use `test`; drop function f1
|
||||||
|
master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS t1
|
||||||
|
master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(col VARCHAR(10))
|
||||||
|
master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE p1(arg VARCHAR(10))
|
||||||
|
INSERT INTO t1 VALUES(arg)
|
||||||
|
master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test'))
|
||||||
|
master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE p1
|
||||||
|
master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE p1() SET @a = 1
|
||||||
|
master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION f1() RETURNS INT RETURN 0
|
||||||
|
master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE p1
|
||||||
|
master-bin.000001 # Query 1 # use `test`; DROP FUNCTION f1
|
||||||
|
master-bin.000001 # Query 1 # use `test`; drop table t1
|
||||||
|
master-bin.000001 # Query 1 # drop database if exists mysqltest
|
||||||
|
master-bin.000001 # Query 1 # drop database if exists mysqltest2
|
||||||
|
master-bin.000001 # Query 1 # create database mysqltest
|
||||||
|
master-bin.000001 # Query 1 # create database mysqltest2
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest2`; create table t ( t integer )
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` procedure mysqltest.test() begin end
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest2`; insert into t values ( 1 )
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` function f1 () returns int
|
||||||
|
begin
|
||||||
|
insert into t values (1);
|
||||||
|
return 0;
|
||||||
|
end
|
||||||
|
master-bin.000001 # Query 1 # use `mysqltest`; SELECT `mysqltest2`.`f1`()
|
||||||
|
set global log_bin_trust_function_creators=0;
|
||||||
|
set global log_bin_trust_function_creators=0;
|
||||||
drop database mysqltest;
|
drop database mysqltest;
|
||||||
drop database mysqltest2;
|
drop database mysqltest2;
|
||||||
|
@ -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*/;
|
||||||
|
@ -3611,3 +3611,9 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t2 range si,ai si 5 NULL 2 Using where
|
1 SIMPLE t2 range si,ai si 5 NULL 2 Using where
|
||||||
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
||||||
DROP TABLE t1,t2,t3;
|
DROP TABLE t1,t2,t3;
|
||||||
|
DROP TABLE IF EXISTS t1;
|
||||||
|
CREATE TABLE t1(a int);
|
||||||
|
INSERT into t1 values (1), (2), (3);
|
||||||
|
SELECT * FROM t1 LIMIT 2, -1;
|
||||||
|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1' at line 1
|
||||||
|
DROP TABLE t1;
|
||||||
|
@ -5626,6 +5626,23 @@ Called B
|
|||||||
Called B
|
Called B
|
||||||
drop procedure proc_21462_a|
|
drop procedure proc_21462_a|
|
||||||
drop procedure proc_21462_b|
|
drop procedure proc_21462_b|
|
||||||
|
drop table if exists t3|
|
||||||
|
drop procedure if exists proc_bug19733|
|
||||||
|
create table t3 (s1 int)|
|
||||||
|
create procedure proc_bug19733()
|
||||||
|
begin
|
||||||
|
declare v int default 0;
|
||||||
|
while v < 100 do
|
||||||
|
create index i on t3 (s1);
|
||||||
|
drop index i on t3;
|
||||||
|
set v = v + 1;
|
||||||
|
end while;
|
||||||
|
end|
|
||||||
|
call proc_bug19733()|
|
||||||
|
call proc_bug19733()|
|
||||||
|
call proc_bug19733()|
|
||||||
|
drop procedure proc_bug19733|
|
||||||
|
drop table t3|
|
||||||
End of 5.0 tests
|
End of 5.0 tests
|
||||||
DROP TABLE IF EXISTS bug23760|
|
DROP TABLE IF EXISTS bug23760|
|
||||||
DROP TABLE IF EXISTS bug23760_log|
|
DROP TABLE IF EXISTS bug23760_log|
|
||||||
|
@ -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;
|
|||||||
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;
|
|||||||
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
|
|||||||
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;
|
|||||||
--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);
|
|||||||
--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;
|
|||||||
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 #
|
||||||
|
@ -102,16 +102,36 @@ connection con1;
|
|||||||
commit;
|
commit;
|
||||||
|
|
||||||
# table scan
|
# table scan
|
||||||
|
#
|
||||||
|
# Note that there are two distinct execution paths in which we unlock
|
||||||
|
# non-matching rows inspected during table scan - one that is used in
|
||||||
|
# case of filesort and one that used in rest of cases. Below we cover
|
||||||
|
# the latter (Bug #20390 "SELECT FOR UPDATE does not release locks of
|
||||||
|
# untouched rows in full table scans").
|
||||||
connection con1;
|
connection con1;
|
||||||
begin;
|
begin;
|
||||||
select * from t1 where y = 'one' or y = 'three' order by x for update;
|
# We can't use "order by x" here as it will cause filesort
|
||||||
|
--replace_column 1 # 2 # 3 #
|
||||||
|
select * from t1 where y = 'one' or y = 'three' for update;
|
||||||
|
|
||||||
connection con2;
|
connection con2;
|
||||||
begin;
|
begin;
|
||||||
# Have to check with pk access here since scans take locks on
|
# Have to check with pk access here since scans take locks on
|
||||||
# all rows and then release them in chunks
|
# all rows and then release them in chunks
|
||||||
# Bug #20390 SELECT FOR UPDATE does not release locks of untouched rows in full table scans
|
select * from t1 where x = 2 for update;
|
||||||
#select * from t1 where x = 2 for update;
|
--error 1205
|
||||||
|
select * from t1 where x = 1 for update;
|
||||||
|
rollback;
|
||||||
|
|
||||||
|
connection con1;
|
||||||
|
commit;
|
||||||
|
|
||||||
|
# And now the test for case with filesort
|
||||||
|
begin;
|
||||||
|
select * from t1 where y = 'one' or y = 'three' order by x for update;
|
||||||
|
connection con2;
|
||||||
|
begin;
|
||||||
|
select * from t1 where x = 2 for update;
|
||||||
--error 1205
|
--error 1205
|
||||||
select * from t1 where x = 1 for update;
|
select * from t1 where x = 1 for update;
|
||||||
rollback;
|
rollback;
|
||||||
@ -157,15 +177,32 @@ commit;
|
|||||||
# table scan
|
# table scan
|
||||||
connection con1;
|
connection con1;
|
||||||
begin;
|
begin;
|
||||||
select * from t1 where y = 'one' or y = 'three' order by x lock in share mode;
|
# We can't use "order by x" here as it will cause filesort
|
||||||
|
--replace_column 1 # 2 # 3 #
|
||||||
|
select * from t1 where y = 'one' or y = 'three' lock in share mode;
|
||||||
|
|
||||||
connection con2;
|
connection con2;
|
||||||
begin;
|
begin;
|
||||||
select * from t1 where y = 'one' lock in share mode;
|
select * from t1 where y = 'one' lock in share mode;
|
||||||
# Have to check with pk access here since scans take locks on
|
# Have to check with pk access here since scans take locks on
|
||||||
# all rows and then release them in chunks
|
# all rows and then release them in chunks
|
||||||
# Bug #20390 SELECT FOR UPDATE does not release locks of untouched rows in full table scans
|
select * from t1 where x = 2 for update;
|
||||||
#select * from t1 where x = 2 for update;
|
--error 1205
|
||||||
|
select * from t1 where x = 1 for update;
|
||||||
|
rollback;
|
||||||
|
|
||||||
|
connection con1;
|
||||||
|
commit;
|
||||||
|
|
||||||
|
# And the same test for case with filesort
|
||||||
|
connection con1;
|
||||||
|
begin;
|
||||||
|
select * from t1 where y = 'one' or y = 'three' order by x lock in share mode;
|
||||||
|
|
||||||
|
connection con2;
|
||||||
|
begin;
|
||||||
|
select * from t1 where y = 'one' lock in share mode;
|
||||||
|
select * from t1 where x = 2 for update;
|
||||||
--error 1205
|
--error 1205
|
||||||
select * from t1 where x = 1 for update;
|
select * from t1 where x = 1 for update;
|
||||||
rollback;
|
rollback;
|
||||||
|
@ -1106,11 +1106,95 @@ EXECUTE stmt USING @a;
|
|||||||
DEALLOCATE PREPARE stmt;
|
DEALLOCATE PREPARE stmt;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#19182: CREATE TABLE bar (m INT) SELECT n FROM foo; doesn't work
|
||||||
|
# from stored procedure.
|
||||||
|
#
|
||||||
|
# The cause of a bug was that cached LEX::create_list was modified,
|
||||||
|
# and then together with LEX::key_list was reset.
|
||||||
|
#
|
||||||
|
--disable_warnings
|
||||||
|
DROP TABLE IF EXISTS t1, t2;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
CREATE TABLE t1 (i INT);
|
||||||
|
|
||||||
|
PREPARE st_19182
|
||||||
|
FROM "CREATE TABLE t2 (i INT, j INT, KEY (i), KEY(j)) SELECT i FROM t1";
|
||||||
|
|
||||||
|
EXECUTE st_19182;
|
||||||
|
DESC t2;
|
||||||
|
|
||||||
|
DROP TABLE t2;
|
||||||
|
|
||||||
|
# Check that on second execution we don't loose 'j' column and the keys
|
||||||
|
# on 'i' and 'j' columns.
|
||||||
|
EXECUTE st_19182;
|
||||||
|
DESC t2;
|
||||||
|
|
||||||
|
DEALLOCATE PREPARE st_19182;
|
||||||
|
DROP TABLE t2, t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #22060 "ALTER TABLE x AUTO_INCREMENT=y in SP crashes server"
|
||||||
|
#
|
||||||
|
# Code which implemented CREATE/ALTER TABLE and CREATE DATABASE
|
||||||
|
# statement modified HA_CREATE_INFO structure in LEX, making these
|
||||||
|
# statements PS/SP-unsafe (their re-execution might have resulted
|
||||||
|
# in incorrect results).
|
||||||
|
#
|
||||||
|
--disable_warnings
|
||||||
|
drop database if exists mysqltest;
|
||||||
|
drop table if exists t1, t2;
|
||||||
|
--enable_warnings
|
||||||
|
# CREATE TABLE and CREATE TABLE ... SELECT
|
||||||
|
create database mysqltest character set utf8;
|
||||||
|
prepare stmt1 from "create table mysqltest.t1 (c char(10))";
|
||||||
|
prepare stmt2 from "create table mysqltest.t2 select 'test'";
|
||||||
|
execute stmt1;
|
||||||
|
execute stmt2;
|
||||||
|
show create table mysqltest.t1;
|
||||||
|
show create table mysqltest.t2;
|
||||||
|
drop table mysqltest.t1;
|
||||||
|
drop table mysqltest.t2;
|
||||||
|
alter database mysqltest character set latin1;
|
||||||
|
execute stmt1;
|
||||||
|
execute stmt2;
|
||||||
|
show create table mysqltest.t1;
|
||||||
|
show create table mysqltest.t2;
|
||||||
|
drop database mysqltest;
|
||||||
|
deallocate prepare stmt1;
|
||||||
|
deallocate prepare stmt2;
|
||||||
|
#
|
||||||
|
# CREATE TABLE with DATA DIRECTORY option
|
||||||
|
#
|
||||||
|
# Protect ourselves from data left in tmp/ by a previos possibly failed
|
||||||
|
# test
|
||||||
|
--system rm -f $MYSQLTEST_VARDIR/tmp/t1.*
|
||||||
|
--disable_query_log
|
||||||
|
eval prepare stmt from "create table t1 (c char(10)) data directory='$MYSQLTEST_VARDIR/tmp'";
|
||||||
|
--enable_query_log
|
||||||
|
execute stmt;
|
||||||
|
#
|
||||||
|
# DATA DIRECTORY option does not always work: if the operating
|
||||||
|
# system does not support symlinks, have_symlinks option is automatically
|
||||||
|
# disabled.
|
||||||
|
# In this case DATA DIRECTORY is silently ignored when
|
||||||
|
# creating a table, and is not output by SHOW CREATE TABLE.
|
||||||
|
#
|
||||||
|
--disable_result_log
|
||||||
|
show create table t1;
|
||||||
|
--enable_result_log
|
||||||
|
drop table t1;
|
||||||
|
execute stmt;
|
||||||
|
--disable_result_log
|
||||||
|
show create table t1;
|
||||||
|
--enable_result_log
|
||||||
|
drop table t1;
|
||||||
|
deallocate prepare stmt;
|
||||||
|
|
||||||
--echo End of 4.1 tests.
|
--echo End of 4.1 tests.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
############################# 5.0 tests start ################################
|
############################# 5.0 tests start ################################
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@ -1585,5 +1669,76 @@ EXECUTE stmt USING @arg;
|
|||||||
DEALLOCATE PREPARE stmt;
|
DEALLOCATE PREPARE stmt;
|
||||||
|
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
|
#
|
||||||
|
# Bug#4968 "Stored procedure crash if cursor opened on altered table"
|
||||||
|
# The bug is not repeatable any more after the fix for
|
||||||
|
# Bug#15217 "Bug #15217 Using a SP cursor on a table created with PREPARE
|
||||||
|
# fails with weird error", however ALTER TABLE is not re-execution friendly
|
||||||
|
# and that caused a valgrind warning. Check that the warning is gone.
|
||||||
|
#
|
||||||
|
--disable_warnings
|
||||||
|
drop table if exists t1;
|
||||||
|
--enable_warnings
|
||||||
|
create table t1 (s1 char(20));
|
||||||
|
prepare stmt from "alter table t1 modify s1 int";
|
||||||
|
execute stmt;
|
||||||
|
execute stmt;
|
||||||
|
drop table t1;
|
||||||
|
deallocate prepare stmt;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#6895 "Prepared Statements: ALTER TABLE DROP COLUMN does nothing"
|
||||||
|
#
|
||||||
|
--disable_warnings
|
||||||
|
drop table if exists t1;
|
||||||
|
--enable_warnings
|
||||||
|
create table t1 (a int, b int);
|
||||||
|
prepare s_6895 from "alter table t1 drop column b";
|
||||||
|
execute s_6895;
|
||||||
|
show columns from t1;
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (a int, b int);
|
||||||
|
execute s_6895;
|
||||||
|
show columns from t1;
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (a int, b int);
|
||||||
|
execute s_6895;
|
||||||
|
show columns from t1;
|
||||||
|
deallocate prepare s_6895;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #22060 "ALTER TABLE x AUTO_INCREMENT=y in SP crashes server"
|
||||||
|
#
|
||||||
|
# 5.0 part of the test.
|
||||||
|
#
|
||||||
|
|
||||||
|
# ALTER TABLE
|
||||||
|
create table t1 (i int primary key auto_increment) comment='comment for table t1';
|
||||||
|
create table t2 (i int, j int, k int);
|
||||||
|
prepare stmt from "alter table t1 auto_increment=100";
|
||||||
|
execute stmt;
|
||||||
|
show create table t1;
|
||||||
|
# Let us trash table-cache's memory
|
||||||
|
flush tables;
|
||||||
|
select * from t2;
|
||||||
|
execute stmt;
|
||||||
|
show create table t1;
|
||||||
|
deallocate prepare stmt;
|
||||||
|
drop table t1, t2;
|
||||||
|
# 5.1 part of the test.
|
||||||
|
# CREATE DATABASE
|
||||||
|
#set @old_character_set_server= @@character_set_server;
|
||||||
|
#set @@character_set_server= latin1;
|
||||||
|
#prepare stmt from "create database mysqltest";
|
||||||
|
#execute stmt;
|
||||||
|
#show create database mysqltest;
|
||||||
|
#drop database mysqltest;
|
||||||
|
#set @@character_set_server= utf8;
|
||||||
|
#execute stmt;
|
||||||
|
#show create database mysqltest;
|
||||||
|
#drop database mysqltest;
|
||||||
|
#deallocate prepare stmt;
|
||||||
|
#set @@character_set_server= @old_character_set_server;
|
||||||
|
|
||||||
--echo End of 5.0 tests.
|
--echo End of 5.0 tests.
|
||||||
|
25
mysql-test/t/rpl_charset_sjis.test
Normal file
25
mysql-test/t/rpl_charset_sjis.test
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
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;
|
|||||||
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';
|
||||||
|
24
mysql-test/t/rpl_locale.test
Normal file
24
mysql-test/t/rpl_locale.test
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# 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;
|
|||||||
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;
|
|||||||
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;
|
|||||||
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;
|
||||||
|
|
||||||
|
|
||||||
|
@ -3092,3 +3092,23 @@ SELECT t3.a FROM t1,t2,t3
|
|||||||
t3.c IN ('bb','ee');
|
t3.c IN ('bb','ee');
|
||||||
|
|
||||||
DROP TABLE t1,t2,t3;
|
DROP TABLE t1,t2,t3;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#6298: LIMIT #, -1 no longer works to set start with no end limit
|
||||||
|
#
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
DROP TABLE IF EXISTS t1;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
CREATE TABLE t1(a int);
|
||||||
|
INSERT into t1 values (1), (2), (3);
|
||||||
|
|
||||||
|
# LIMIT N, -1 was accepted by accident in 4.0, but was not intended.
|
||||||
|
# This test verifies that this illegal construct is now properly detected.
|
||||||
|
|
||||||
|
--error ER_PARSE_ERROR
|
||||||
|
SELECT * FROM t1 LIMIT 2, -1;
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
@ -6587,6 +6587,34 @@ call proc_21462_b(1)|
|
|||||||
drop procedure proc_21462_a|
|
drop procedure proc_21462_a|
|
||||||
drop procedure proc_21462_b|
|
drop procedure proc_21462_b|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#19733 "Repeated alter, or repeated create/drop, fails"
|
||||||
|
# Check that CREATE/DROP INDEX is re-execution friendly.
|
||||||
|
#
|
||||||
|
--disable_warnings
|
||||||
|
drop table if exists t3|
|
||||||
|
drop procedure if exists proc_bug19733|
|
||||||
|
--enable_warnings
|
||||||
|
create table t3 (s1 int)|
|
||||||
|
|
||||||
|
create procedure proc_bug19733()
|
||||||
|
begin
|
||||||
|
declare v int default 0;
|
||||||
|
while v < 100 do
|
||||||
|
create index i on t3 (s1);
|
||||||
|
drop index i on t3;
|
||||||
|
set v = v + 1;
|
||||||
|
end while;
|
||||||
|
end|
|
||||||
|
|
||||||
|
call proc_bug19733()|
|
||||||
|
call proc_bug19733()|
|
||||||
|
call proc_bug19733()|
|
||||||
|
|
||||||
|
drop procedure proc_bug19733|
|
||||||
|
drop table t3|
|
||||||
|
|
||||||
--echo End of 5.0 tests
|
--echo End of 5.0 tests
|
||||||
|
|
||||||
|
|
||||||
|
@ -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;
|
|||||||
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
|
||||||
|
|
||||||
@ -65,6 +82,28 @@ my_bool my_thread_global_init(void)
|
|||||||
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
|
||||||
/*
|
/*
|
||||||
Set mutex type to "fast" a.k.a "adaptive"
|
Set mutex type to "fast" a.k.a "adaptive"
|
||||||
|
@ -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('-');
|
||||||
@ -633,38 +627,34 @@ bool make_date_time(DATE_TIME_FORMAT *format, TIME *l_time,
|
|||||||
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)
|
||||||
@ -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()
|
|||||||
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)
|
|||||||
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,
|
||||||
|
162
sql/log_event.cc
162
sql/log_event.cc
@ -260,7 +260,7 @@ append_query_string(CHARSET_INFO *csinfo,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
*ptr++= '\'';
|
*ptr++= '\'';
|
||||||
ptr+= escape_string_for_mysql(from->charset(), ptr, 0,
|
ptr+= escape_string_for_mysql(csinfo, ptr, 0,
|
||||||
from->ptr(), from->length());
|
from->ptr(), from->length());
|
||||||
*ptr++='\'';
|
*ptr++='\'';
|
||||||
}
|
}
|
||||||
@ -1087,7 +1087,8 @@ bool Query_log_event::write(IO_CACHE* file)
|
|||||||
1+1+FN_REFLEN+ // code of catalog and catalog length and catalog
|
1+1+FN_REFLEN+ // code of catalog and catalog length and catalog
|
||||||
1+4+ // code of autoinc and the 2 autoinc variables
|
1+4+ // code of autoinc and the 2 autoinc variables
|
||||||
1+6+ // code of charset and charset
|
1+6+ // code of charset and charset
|
||||||
1+1+MAX_TIME_ZONE_NAME_LENGTH // code of tz and tz length and tz name
|
1+1+MAX_TIME_ZONE_NAME_LENGTH+ // code of tz and tz length and tz name
|
||||||
|
1+2 // code of lc_time_names and lc_time_names_number
|
||||||
], *start, *start_of_status;
|
], *start, *start_of_status;
|
||||||
ulong event_length;
|
ulong event_length;
|
||||||
|
|
||||||
@ -1199,6 +1200,13 @@ bool Query_log_event::write(IO_CACHE* file)
|
|||||||
memcpy(start, time_zone_str, time_zone_len);
|
memcpy(start, time_zone_str, time_zone_len);
|
||||||
start+= time_zone_len;
|
start+= time_zone_len;
|
||||||
}
|
}
|
||||||
|
if (lc_time_names_number)
|
||||||
|
{
|
||||||
|
DBUG_ASSERT(lc_time_names_number <= 0xFFFF);
|
||||||
|
*start++= Q_LC_TIME_NAMES_CODE;
|
||||||
|
int2store(start, lc_time_names_number);
|
||||||
|
start+= 2;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
Here there could be code like
|
Here there could be code like
|
||||||
if (command-line-option-which-says-"log_this_variable" && inited)
|
if (command-line-option-which-says-"log_this_variable" && inited)
|
||||||
@ -1263,7 +1271,8 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
|
|||||||
flags2_inited(1), sql_mode_inited(1), charset_inited(1),
|
flags2_inited(1), sql_mode_inited(1), charset_inited(1),
|
||||||
sql_mode(thd_arg->variables.sql_mode),
|
sql_mode(thd_arg->variables.sql_mode),
|
||||||
auto_increment_increment(thd_arg->variables.auto_increment_increment),
|
auto_increment_increment(thd_arg->variables.auto_increment_increment),
|
||||||
auto_increment_offset(thd_arg->variables.auto_increment_offset)
|
auto_increment_offset(thd_arg->variables.auto_increment_offset),
|
||||||
|
lc_time_names_number(thd_arg->variables.lc_time_names->number)
|
||||||
{
|
{
|
||||||
time_t end_time;
|
time_t end_time;
|
||||||
time(&end_time);
|
time(&end_time);
|
||||||
@ -1305,23 +1314,30 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
|
|||||||
|
|
||||||
/* 2 utility functions for the next method */
|
/* 2 utility functions for the next method */
|
||||||
|
|
||||||
static void get_str_len_and_pointer(const char **dst, const char **src, uint *len)
|
/*
|
||||||
|
Get the pointer for a string (src) that contains the length in
|
||||||
|
the first byte. Set the output string (dst) to the string value
|
||||||
|
and place the length of the string in the byte after the string.
|
||||||
|
*/
|
||||||
|
static void get_str_len_and_pointer(const Log_event::Byte **src,
|
||||||
|
const char **dst,
|
||||||
|
uint *len)
|
||||||
{
|
{
|
||||||
if ((*len= **src))
|
if ((*len= **src))
|
||||||
*dst= *src + 1; // Will be copied later
|
*dst= (char *)*src + 1; // Will be copied later
|
||||||
(*src)+= *len+1;
|
(*src)+= *len + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void copy_str_and_move(const char **src,
|
||||||
static void copy_str_and_move(char **dst, const char **src, uint len)
|
Log_event::Byte **dst,
|
||||||
|
uint len)
|
||||||
{
|
{
|
||||||
memcpy(*dst, *src, len);
|
memcpy(*dst, *src, len);
|
||||||
*src= *dst;
|
*src= (const char *)*dst;
|
||||||
(*dst)+= len;
|
(*dst)+= len;
|
||||||
*(*dst)++= 0;
|
*(*dst)++= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Query_log_event::Query_log_event()
|
Query_log_event::Query_log_event()
|
||||||
This is used by the SQL slave thread to prepare the event before execution.
|
This is used by the SQL slave thread to prepare the event before execution.
|
||||||
@ -1334,13 +1350,13 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
|
|||||||
db(NullS), catalog_len(0), status_vars_len(0),
|
db(NullS), catalog_len(0), status_vars_len(0),
|
||||||
flags2_inited(0), sql_mode_inited(0), charset_inited(0),
|
flags2_inited(0), sql_mode_inited(0), charset_inited(0),
|
||||||
auto_increment_increment(1), auto_increment_offset(1),
|
auto_increment_increment(1), auto_increment_offset(1),
|
||||||
time_zone_len(0)
|
time_zone_len(0), lc_time_names_number(0)
|
||||||
{
|
{
|
||||||
ulong data_len;
|
ulong data_len;
|
||||||
uint32 tmp;
|
uint32 tmp;
|
||||||
uint8 common_header_len, post_header_len;
|
uint8 common_header_len, post_header_len;
|
||||||
char *start;
|
Log_event::Byte *start;
|
||||||
const char *end;
|
const Log_event::Byte *end;
|
||||||
bool catalog_nz= 1;
|
bool catalog_nz= 1;
|
||||||
DBUG_ENTER("Query_log_event::Query_log_event(char*,...)");
|
DBUG_ENTER("Query_log_event::Query_log_event(char*,...)");
|
||||||
|
|
||||||
@ -1386,9 +1402,9 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
|
|||||||
|
|
||||||
/* variable-part: the status vars; only in MySQL 5.0 */
|
/* variable-part: the status vars; only in MySQL 5.0 */
|
||||||
|
|
||||||
start= (char*) (buf+post_header_len);
|
start= (Log_event::Byte*) (buf+post_header_len);
|
||||||
end= (const char*) (start+status_vars_len);
|
end= (const Log_event::Byte*) (start+status_vars_len);
|
||||||
for (const uchar* pos= (const uchar*) start; pos < (const uchar*) end;)
|
for (const Log_event::Byte* pos= start; pos < end;)
|
||||||
{
|
{
|
||||||
switch (*pos++) {
|
switch (*pos++) {
|
||||||
case Q_FLAGS2_CODE:
|
case Q_FLAGS2_CODE:
|
||||||
@ -1410,7 +1426,7 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Q_CATALOG_NZ_CODE:
|
case Q_CATALOG_NZ_CODE:
|
||||||
get_str_len_and_pointer(&catalog, (const char **)(&pos), &catalog_len);
|
get_str_len_and_pointer(&pos, &catalog, &catalog_len);
|
||||||
break;
|
break;
|
||||||
case Q_AUTO_INCREMENT:
|
case Q_AUTO_INCREMENT:
|
||||||
auto_increment_increment= uint2korr(pos);
|
auto_increment_increment= uint2korr(pos);
|
||||||
@ -1426,7 +1442,7 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
|
|||||||
}
|
}
|
||||||
case Q_TIME_ZONE_CODE:
|
case Q_TIME_ZONE_CODE:
|
||||||
{
|
{
|
||||||
get_str_len_and_pointer(&time_zone_str, (const char **)(&pos), &time_zone_len);
|
get_str_len_and_pointer(&pos, &time_zone_str, &time_zone_len);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Q_CATALOG_CODE: /* for 5.0.x where 0<=x<=3 masters */
|
case Q_CATALOG_CODE: /* for 5.0.x where 0<=x<=3 masters */
|
||||||
@ -1435,6 +1451,10 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
|
|||||||
pos+= catalog_len+2; // leap over end 0
|
pos+= catalog_len+2; // leap over end 0
|
||||||
catalog_nz= 0; // catalog has end 0 in event
|
catalog_nz= 0; // catalog has end 0 in event
|
||||||
break;
|
break;
|
||||||
|
case Q_LC_TIME_NAMES_CODE:
|
||||||
|
lc_time_names_number= uint2korr(pos);
|
||||||
|
pos+= 2;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
/* That's why you must write status vars in growing order of code */
|
/* That's why you must write status vars in growing order of code */
|
||||||
DBUG_PRINT("info",("Query_log_event has unknown status vars (first has\
|
DBUG_PRINT("info",("Query_log_event has unknown status vars (first has\
|
||||||
@ -1444,14 +1464,14 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(MYSQL_CLIENT) && defined(HAVE_QUERY_CACHE)
|
#if !defined(MYSQL_CLIENT) && defined(HAVE_QUERY_CACHE)
|
||||||
if (!(start= data_buf = (char*) my_malloc(catalog_len + 1 +
|
if (!(start= data_buf = (Log_event::Byte*) my_malloc(catalog_len + 1 +
|
||||||
time_zone_len + 1 +
|
time_zone_len + 1 +
|
||||||
data_len + 1 +
|
data_len + 1 +
|
||||||
QUERY_CACHE_FLAGS_SIZE +
|
QUERY_CACHE_FLAGS_SIZE +
|
||||||
db_len + 1,
|
db_len + 1,
|
||||||
MYF(MY_WME))))
|
MYF(MY_WME))))
|
||||||
#else
|
#else
|
||||||
if (!(start= data_buf = (char*) my_malloc(catalog_len + 1 +
|
if (!(start= data_buf = (Log_event::Byte*) my_malloc(catalog_len + 1 +
|
||||||
time_zone_len + 1 +
|
time_zone_len + 1 +
|
||||||
data_len + 1,
|
data_len + 1,
|
||||||
MYF(MY_WME))))
|
MYF(MY_WME))))
|
||||||
@ -1460,22 +1480,22 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
|
|||||||
if (catalog_len) // If catalog is given
|
if (catalog_len) // If catalog is given
|
||||||
{
|
{
|
||||||
if (likely(catalog_nz)) // true except if event comes from 5.0.0|1|2|3.
|
if (likely(catalog_nz)) // true except if event comes from 5.0.0|1|2|3.
|
||||||
copy_str_and_move(&start, &catalog, catalog_len);
|
copy_str_and_move(&catalog, &start, catalog_len);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memcpy(start, catalog, catalog_len+1); // copy end 0
|
memcpy(start, catalog, catalog_len+1); // copy end 0
|
||||||
catalog= start;
|
catalog= (const char *)start;
|
||||||
start+= catalog_len+1;
|
start+= catalog_len+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (time_zone_len)
|
if (time_zone_len)
|
||||||
copy_str_and_move(&start, &time_zone_str, time_zone_len);
|
copy_str_and_move(&time_zone_str, &start, time_zone_len);
|
||||||
|
|
||||||
/* A 2nd variable part; this is common to all versions */
|
/* A 2nd variable part; this is common to all versions */
|
||||||
memcpy((char*) start, end, data_len); // Copy db and query
|
memcpy((char*) start, end, data_len); // Copy db and query
|
||||||
start[data_len]= '\0'; // End query with \0 (For safetly)
|
start[data_len]= '\0'; // End query with \0 (For safetly)
|
||||||
db= start;
|
db= (char *)start;
|
||||||
query= start + db_len + 1;
|
query= (char *)(start + db_len + 1);
|
||||||
q_len= data_len - db_len -1;
|
q_len= data_len - db_len -1;
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
@ -1506,15 +1526,16 @@ void Query_log_event::print_query_header(FILE* file,
|
|||||||
if (different_db= memcmp(print_event_info->db, db, db_len + 1))
|
if (different_db= memcmp(print_event_info->db, db, db_len + 1))
|
||||||
memcpy(print_event_info->db, db, db_len + 1);
|
memcpy(print_event_info->db, db, db_len + 1);
|
||||||
if (db[0] && different_db)
|
if (db[0] && different_db)
|
||||||
fprintf(file, "use %s;\n", db);
|
fprintf(file, "use %s%s\n", db, print_event_info->delimiter);
|
||||||
}
|
}
|
||||||
|
|
||||||
end=int10_to_str((long) when, strmov(buff,"SET TIMESTAMP="),10);
|
end=int10_to_str((long) when, strmov(buff,"SET TIMESTAMP="),10);
|
||||||
*end++=';';
|
end= strmov(end, print_event_info->delimiter);
|
||||||
*end++='\n';
|
*end++='\n';
|
||||||
my_fwrite(file, (byte*) buff, (uint) (end-buff),MYF(MY_NABP | MY_WME));
|
my_fwrite(file, (byte*) buff, (uint) (end-buff),MYF(MY_NABP | MY_WME));
|
||||||
if (flags & LOG_EVENT_THREAD_SPECIFIC_F)
|
if (flags & LOG_EVENT_THREAD_SPECIFIC_F)
|
||||||
fprintf(file,"SET @@session.pseudo_thread_id=%lu;\n",(ulong)thread_id);
|
fprintf(file,"SET @@session.pseudo_thread_id=%lu%s\n",
|
||||||
|
(ulong)thread_id, print_event_info->delimiter);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
If flags2_inited==0, this is an event from 3.23 or 4.0; nothing to
|
If flags2_inited==0, this is an event from 3.23 or 4.0; nothing to
|
||||||
@ -1543,7 +1564,7 @@ void Query_log_event::print_query_header(FILE* file,
|
|||||||
"@@session.sql_auto_is_null", &need_comma);
|
"@@session.sql_auto_is_null", &need_comma);
|
||||||
print_set_option(file, tmp, OPTION_RELAXED_UNIQUE_CHECKS, ~flags2,
|
print_set_option(file, tmp, OPTION_RELAXED_UNIQUE_CHECKS, ~flags2,
|
||||||
"@@session.unique_checks", &need_comma);
|
"@@session.unique_checks", &need_comma);
|
||||||
fprintf(file,";\n");
|
fprintf(file,"%s\n", print_event_info->delimiter);
|
||||||
print_event_info->flags2= flags2;
|
print_event_info->flags2= flags2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1571,15 +1592,17 @@ void Query_log_event::print_query_header(FILE* file,
|
|||||||
}
|
}
|
||||||
if (unlikely(print_event_info->sql_mode != sql_mode))
|
if (unlikely(print_event_info->sql_mode != sql_mode))
|
||||||
{
|
{
|
||||||
fprintf(file,"SET @@session.sql_mode=%lu;\n",(ulong)sql_mode);
|
fprintf(file,"SET @@session.sql_mode=%lu%s\n",
|
||||||
|
(ulong)sql_mode, print_event_info->delimiter);
|
||||||
print_event_info->sql_mode= sql_mode;
|
print_event_info->sql_mode= sql_mode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (print_event_info->auto_increment_increment != auto_increment_increment ||
|
if (print_event_info->auto_increment_increment != auto_increment_increment ||
|
||||||
print_event_info->auto_increment_offset != auto_increment_offset)
|
print_event_info->auto_increment_offset != auto_increment_offset)
|
||||||
{
|
{
|
||||||
fprintf(file,"SET @@session.auto_increment_increment=%lu, @@session.auto_increment_offset=%lu;\n",
|
fprintf(file,"SET @@session.auto_increment_increment=%lu, @@session.auto_increment_offset=%lu%s\n",
|
||||||
auto_increment_increment,auto_increment_offset);
|
auto_increment_increment,auto_increment_offset,
|
||||||
|
print_event_info->delimiter);
|
||||||
print_event_info->auto_increment_increment= auto_increment_increment;
|
print_event_info->auto_increment_increment= auto_increment_increment;
|
||||||
print_event_info->auto_increment_offset= auto_increment_offset;
|
print_event_info->auto_increment_offset= auto_increment_offset;
|
||||||
}
|
}
|
||||||
@ -1598,16 +1621,19 @@ void Query_log_event::print_query_header(FILE* file,
|
|||||||
CHARSET_INFO *cs_info= get_charset(uint2korr(charset), MYF(MY_WME));
|
CHARSET_INFO *cs_info= get_charset(uint2korr(charset), MYF(MY_WME));
|
||||||
if (cs_info)
|
if (cs_info)
|
||||||
{
|
{
|
||||||
fprintf(file, "/*!\\C %s */;\n", cs_info->csname); /* for mysql client */
|
/* for mysql client */
|
||||||
|
fprintf(file, "/*!\\C %s */%s\n",
|
||||||
|
cs_info->csname, print_event_info->delimiter);
|
||||||
}
|
}
|
||||||
fprintf(file,"SET "
|
fprintf(file,"SET "
|
||||||
"@@session.character_set_client=%d,"
|
"@@session.character_set_client=%d,"
|
||||||
"@@session.collation_connection=%d,"
|
"@@session.collation_connection=%d,"
|
||||||
"@@session.collation_server=%d"
|
"@@session.collation_server=%d"
|
||||||
";\n",
|
"%s\n",
|
||||||
uint2korr(charset),
|
uint2korr(charset),
|
||||||
uint2korr(charset+2),
|
uint2korr(charset+2),
|
||||||
uint2korr(charset+4));
|
uint2korr(charset+4),
|
||||||
|
print_event_info->delimiter);
|
||||||
memcpy(print_event_info->charset, charset, 6);
|
memcpy(print_event_info->charset, charset, 6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1615,10 +1641,17 @@ void Query_log_event::print_query_header(FILE* file,
|
|||||||
{
|
{
|
||||||
if (bcmp(print_event_info->time_zone_str, time_zone_str, time_zone_len+1))
|
if (bcmp(print_event_info->time_zone_str, time_zone_str, time_zone_len+1))
|
||||||
{
|
{
|
||||||
fprintf(file,"SET @@session.time_zone='%s';\n", time_zone_str);
|
fprintf(file,"SET @@session.time_zone='%s'%s\n",
|
||||||
|
time_zone_str, print_event_info->delimiter);
|
||||||
memcpy(print_event_info->time_zone_str, time_zone_str, time_zone_len+1);
|
memcpy(print_event_info->time_zone_str, time_zone_str, time_zone_len+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (lc_time_names_number != print_event_info->lc_time_names_number)
|
||||||
|
{
|
||||||
|
fprintf(file, "SET @@session.lc_time_names=%d%s\n",
|
||||||
|
lc_time_names_number, print_event_info->delimiter);
|
||||||
|
print_event_info->lc_time_names_number= lc_time_names_number;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1626,7 +1659,7 @@ void Query_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
|
|||||||
{
|
{
|
||||||
print_query_header(file, print_event_info);
|
print_query_header(file, print_event_info);
|
||||||
my_fwrite(file, (byte*) query, q_len, MYF(MY_NABP | MY_WME));
|
my_fwrite(file, (byte*) query, q_len, MYF(MY_NABP | MY_WME));
|
||||||
fputs(";\n", file);
|
fprintf(file, "%s\n", print_event_info->delimiter);
|
||||||
}
|
}
|
||||||
#endif /* MYSQL_CLIENT */
|
#endif /* MYSQL_CLIENT */
|
||||||
|
|
||||||
@ -1771,6 +1804,19 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli,
|
|||||||
goto compare_errors;
|
goto compare_errors;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (lc_time_names_number)
|
||||||
|
{
|
||||||
|
if (!(thd->variables.lc_time_names=
|
||||||
|
my_locale_by_number(lc_time_names_number)))
|
||||||
|
{
|
||||||
|
my_printf_error(ER_UNKNOWN_ERROR,
|
||||||
|
"Unknown locale: '%d'", MYF(0), lc_time_names_number);
|
||||||
|
thd->variables.lc_time_names= &my_locale_en_US;
|
||||||
|
goto compare_errors;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
thd->variables.lc_time_names= &my_locale_en_US;
|
||||||
|
|
||||||
/* Execute the query (note that we bypass dispatch_command()) */
|
/* Execute the query (note that we bypass dispatch_command()) */
|
||||||
mysql_parse(thd, thd->query, thd->query_length);
|
mysql_parse(thd, thd->query, thd->query_length);
|
||||||
@ -1980,9 +2026,9 @@ void Start_log_event_v3::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
|
|||||||
and rollback unfinished transaction.
|
and rollback unfinished transaction.
|
||||||
Probably this can be done with RESET CONNECTION (syntax to be defined).
|
Probably this can be done with RESET CONNECTION (syntax to be defined).
|
||||||
*/
|
*/
|
||||||
fprintf(file,"RESET CONNECTION;\n");
|
fprintf(file,"RESET CONNECTION%s\n", print_event_info->delimiter);
|
||||||
#else
|
#else
|
||||||
fprintf(file,"ROLLBACK;\n");
|
fprintf(file,"ROLLBACK%s\n", print_event_info->delimiter);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
fflush(file);
|
fflush(file);
|
||||||
@ -2716,13 +2762,14 @@ void Load_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (db && db[0] && different_db)
|
if (db && db[0] && different_db)
|
||||||
fprintf(file, "%suse %s;\n",
|
fprintf(file, "%suse %s%s\n",
|
||||||
commented ? "# " : "",
|
commented ? "# " : "",
|
||||||
db);
|
db, print_event_info->delimiter);
|
||||||
|
|
||||||
if (flags & LOG_EVENT_THREAD_SPECIFIC_F)
|
if (flags & LOG_EVENT_THREAD_SPECIFIC_F)
|
||||||
fprintf(file,"%sSET @@session.pseudo_thread_id=%lu;\n",
|
fprintf(file,"%sSET @@session.pseudo_thread_id=%lu%s\n",
|
||||||
commented ? "# " : "", (ulong)thread_id);
|
commented ? "# " : "", (ulong)thread_id,
|
||||||
|
print_event_info->delimiter);
|
||||||
fprintf(file, "%sLOAD DATA ",
|
fprintf(file, "%sLOAD DATA ",
|
||||||
commented ? "# " : "");
|
commented ? "# " : "");
|
||||||
if (check_fname_outside_temp_buf())
|
if (check_fname_outside_temp_buf())
|
||||||
@ -2774,7 +2821,7 @@ void Load_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info,
|
|||||||
fputc(')', file);
|
fputc(')', file);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(file, ";\n");
|
fprintf(file, "%s\n", print_event_info->delimiter);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
#endif /* MYSQL_CLIENT */
|
#endif /* MYSQL_CLIENT */
|
||||||
@ -3351,7 +3398,8 @@ void Intvar_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
|
|||||||
msg="INVALID_INT";
|
msg="INVALID_INT";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fprintf(file, "%s=%s;\n", msg, llstr(val,llbuff));
|
fprintf(file, "%s=%s%s\n",
|
||||||
|
msg, llstr(val,llbuff), print_event_info->delimiter);
|
||||||
fflush(file);
|
fflush(file);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -3426,8 +3474,9 @@ void Rand_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
|
|||||||
print_header(file, print_event_info);
|
print_header(file, print_event_info);
|
||||||
fprintf(file, "\tRand\n");
|
fprintf(file, "\tRand\n");
|
||||||
}
|
}
|
||||||
fprintf(file, "SET @@RAND_SEED1=%s, @@RAND_SEED2=%s;\n",
|
fprintf(file, "SET @@RAND_SEED1=%s, @@RAND_SEED2=%s%s\n",
|
||||||
llstr(seed1, llbuff),llstr(seed2, llbuff2));
|
llstr(seed1, llbuff),llstr(seed2, llbuff2),
|
||||||
|
print_event_info->delimiter);
|
||||||
fflush(file);
|
fflush(file);
|
||||||
}
|
}
|
||||||
#endif /* MYSQL_CLIENT */
|
#endif /* MYSQL_CLIENT */
|
||||||
@ -3499,7 +3548,7 @@ void Xid_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
|
|||||||
fprintf(file, "\tXid = %s\n", buf);
|
fprintf(file, "\tXid = %s\n", buf);
|
||||||
fflush(file);
|
fflush(file);
|
||||||
}
|
}
|
||||||
fprintf(file, "COMMIT;\n");
|
fprintf(file, "COMMIT%s\n", print_event_info->delimiter);
|
||||||
}
|
}
|
||||||
#endif /* MYSQL_CLIENT */
|
#endif /* MYSQL_CLIENT */
|
||||||
|
|
||||||
@ -3700,7 +3749,7 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
|
|||||||
|
|
||||||
if (is_null)
|
if (is_null)
|
||||||
{
|
{
|
||||||
fprintf(file, ":=NULL;\n");
|
fprintf(file, ":=NULL%s\n", print_event_info->delimiter);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3708,12 +3757,12 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
|
|||||||
case REAL_RESULT:
|
case REAL_RESULT:
|
||||||
double real_val;
|
double real_val;
|
||||||
float8get(real_val, val);
|
float8get(real_val, val);
|
||||||
fprintf(file, ":=%.14g;\n", real_val);
|
fprintf(file, ":=%.14g%s\n", real_val, print_event_info->delimiter);
|
||||||
break;
|
break;
|
||||||
case INT_RESULT:
|
case INT_RESULT:
|
||||||
char int_buf[22];
|
char int_buf[22];
|
||||||
longlong10_to_str(uint8korr(val), int_buf, -10);
|
longlong10_to_str(uint8korr(val), int_buf, -10);
|
||||||
fprintf(file, ":=%s;\n", int_buf);
|
fprintf(file, ":=%s%s\n", int_buf, print_event_info->delimiter);
|
||||||
break;
|
break;
|
||||||
case DECIMAL_RESULT:
|
case DECIMAL_RESULT:
|
||||||
{
|
{
|
||||||
@ -3729,7 +3778,7 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
|
|||||||
bin2decimal(val+2, &dec, precision, scale);
|
bin2decimal(val+2, &dec, precision, scale);
|
||||||
decimal2string(&dec, str_buf, &str_len, 0, 0, 0);
|
decimal2string(&dec, str_buf, &str_len, 0, 0, 0);
|
||||||
str_buf[str_len]= 0;
|
str_buf[str_len]= 0;
|
||||||
fprintf(file, ":=%s;\n",str_buf);
|
fprintf(file, ":=%s%s\n",str_buf, print_event_info->delimiter);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case STRING_RESULT:
|
case STRING_RESULT:
|
||||||
@ -3765,9 +3814,10 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
|
|||||||
Generate an unusable command (=> syntax error) is probably the best
|
Generate an unusable command (=> syntax error) is probably the best
|
||||||
thing we can do here.
|
thing we can do here.
|
||||||
*/
|
*/
|
||||||
fprintf(file, ":=???;\n");
|
fprintf(file, ":=???%s\n", print_event_info->delimiter);
|
||||||
else
|
else
|
||||||
fprintf(file, ":=_%s %s COLLATE `%s`;\n", cs->csname, hex_str, cs->name);
|
fprintf(file, ":=_%s %s COLLATE `%s`%s\n",
|
||||||
|
cs->csname, hex_str, cs->name, print_event_info->delimiter);
|
||||||
my_afree(hex_str);
|
my_afree(hex_str);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -4866,12 +4916,12 @@ void Execute_load_query_log_event::print(FILE* file,
|
|||||||
fprintf(file, " INTO");
|
fprintf(file, " INTO");
|
||||||
my_fwrite(file, (byte*) query + fn_pos_end, q_len-fn_pos_end,
|
my_fwrite(file, (byte*) query + fn_pos_end, q_len-fn_pos_end,
|
||||||
MYF(MY_NABP | MY_WME));
|
MYF(MY_NABP | MY_WME));
|
||||||
fprintf(file, ";\n");
|
fprintf(file, "%s\n", print_event_info->delimiter);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
my_fwrite(file, (byte*) query, q_len, MYF(MY_NABP | MY_WME));
|
my_fwrite(file, (byte*) query, q_len, MYF(MY_NABP | MY_WME));
|
||||||
fprintf(file, ";\n");
|
fprintf(file, "%s\n", print_event_info->delimiter);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!print_event_info->short_form)
|
if (!print_event_info->short_form)
|
||||||
|
@ -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
|
|||||||
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
|
|||||||
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
|
|||||||
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 @@ public:
|
|||||||
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 @@ public:
|
|||||||
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
|
|||||||
|
|
||||||
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
|
|||||||
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;
|
|||||||
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
|
||||||
@ -773,17 +777,15 @@ int prepare_create_field(create_field *sql_field,
|
|||||||
uint table_flags);
|
uint table_flags);
|
||||||
bool mysql_create_table(THD *thd,const char *db, const char *table_name,
|
bool mysql_create_table(THD *thd,const char *db, const char *table_name,
|
||||||
HA_CREATE_INFO *create_info,
|
HA_CREATE_INFO *create_info,
|
||||||
List<create_field> &fields, List<Key> &keys,
|
Alter_info *alter_info,
|
||||||
bool tmp_table, uint select_field_count);
|
bool tmp_table, uint select_field_count);
|
||||||
|
|
||||||
bool mysql_alter_table(THD *thd, char *new_db, char *new_name,
|
bool mysql_alter_table(THD *thd, char *new_db, char *new_name,
|
||||||
HA_CREATE_INFO *create_info,
|
HA_CREATE_INFO *create_info,
|
||||||
TABLE_LIST *table_list,
|
TABLE_LIST *table_list,
|
||||||
List<create_field> &fields,
|
Alter_info *alter_info,
|
||||||
List<Key> &keys,
|
uint order_num, ORDER *order, bool ignore);
|
||||||
uint order_num, ORDER *order, bool ignore,
|
bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list);
|
||||||
ALTER_INFO *alter_info, bool do_send_ok);
|
|
||||||
bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list, bool do_send_ok);
|
|
||||||
bool mysql_create_like_table(THD *thd, TABLE_LIST *table,
|
bool mysql_create_like_table(THD *thd, TABLE_LIST *table,
|
||||||
HA_CREATE_INFO *create_info,
|
HA_CREATE_INFO *create_info,
|
||||||
Table_ident *src_table);
|
Table_ident *src_table);
|
||||||
@ -792,9 +794,6 @@ bool mysql_rename_table(enum db_type base,
|
|||||||
const char * old_name,
|
const char * old_name,
|
||||||
const char *new_db,
|
const char *new_db,
|
||||||
const char * new_name);
|
const char * new_name);
|
||||||
bool mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys);
|
|
||||||
bool mysql_drop_index(THD *thd, TABLE_LIST *table_list,
|
|
||||||
ALTER_INFO *alter_info);
|
|
||||||
bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
|
bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
|
||||||
Item **conds, uint order_num, ORDER *order);
|
Item **conds, uint order_num, ORDER *order);
|
||||||
int mysql_update(THD *thd,TABLE_LIST *tables,List<Item> &fields,
|
int mysql_update(THD *thd,TABLE_LIST *tables,List<Item> &fields,
|
||||||
@ -896,7 +895,8 @@ int get_quote_char_for_identifier(THD *thd, const char *name, uint length);
|
|||||||
void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild);
|
void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild);
|
||||||
int mysqld_dump_create_info(THD *thd, TABLE_LIST *table_list, int fd);
|
int mysqld_dump_create_info(THD *thd, TABLE_LIST *table_list, int fd);
|
||||||
bool mysqld_show_create(THD *thd, TABLE_LIST *table_list);
|
bool mysqld_show_create(THD *thd, TABLE_LIST *table_list);
|
||||||
bool mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create);
|
bool mysqld_show_create_db(THD *thd, char *dbname,
|
||||||
|
const HA_CREATE_INFO *create);
|
||||||
|
|
||||||
void mysqld_list_processes(THD *thd,const char *user,bool verbose);
|
void mysqld_list_processes(THD *thd,const char *user,bool verbose);
|
||||||
int mysqld_show_status(THD *thd);
|
int mysqld_show_status(THD *thd);
|
||||||
|
@ -5468,6 +5468,11 @@ log and this option does nothing anymore.",
|
|||||||
0, 0, 0, 0, 0},
|
0, 0, 0, 0, 0},
|
||||||
{"use-symbolic-links", 's', "Enable symbolic link support. Deprecated option; use --symbolic-links instead.",
|
{"use-symbolic-links", 's', "Enable symbolic link support. Deprecated option; use --symbolic-links instead.",
|
||||||
(gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG,
|
(gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG,
|
||||||
|
/*
|
||||||
|
The system call realpath() produces warnings under valgrind and
|
||||||
|
purify. These are not suppressed: instead we disable symlinks
|
||||||
|
option if compiled with valgrind support.
|
||||||
|
*/
|
||||||
IF_PURIFY(0,1), 0, 0, 0, 0, 0},
|
IF_PURIFY(0,1), 0, 0, 0, 0, 0},
|
||||||
{"user", 'u', "Run mysqld daemon as user.", 0, 0, 0, GET_STR, REQUIRED_ARG,
|
{"user", 'u', "Run mysqld daemon as user.", 0, 0, 0, GET_STR, REQUIRED_ARG,
|
||||||
0, 0, 0, 0, 0, 0},
|
0, 0, 0, 0, 0, 0},
|
||||||
|
@ -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)
|
||||||
|
{
|
||||||
|
if (!(locale_match= my_locale_by_number((uint) var->value->val_int())))
|
||||||
|
{
|
||||||
|
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,
|
my_printf_error(ER_UNKNOWN_ERROR,
|
||||||
"Unknown locale: '%s'", MYF(0), locale_str);
|
"Unknown locale: '%s'", MYF(0), locale_str);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var->save_result.locale_value= locale_match;
|
var->save_result.locale_value= locale_match;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -819,12 +819,16 @@ 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)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
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)
|
|||||||
{
|
{
|
||||||
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;
|
||||||
@ -843,7 +844,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
|
||||||
@ -1427,6 +1428,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++)
|
||||||
@ -1437,7 +1440,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,
|
|||||||
{
|
{
|
||||||
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));
|
||||||
|
@ -1839,19 +1839,20 @@ class select_insert :public select_result_interceptor {
|
|||||||
class select_create: public select_insert {
|
class select_create: public select_insert {
|
||||||
ORDER *group;
|
ORDER *group;
|
||||||
TABLE_LIST *create_table;
|
TABLE_LIST *create_table;
|
||||||
List<create_field> *extra_fields;
|
|
||||||
List<Key> *keys;
|
|
||||||
HA_CREATE_INFO *create_info;
|
HA_CREATE_INFO *create_info;
|
||||||
|
Alter_info *alter_info;
|
||||||
MYSQL_LOCK *lock;
|
MYSQL_LOCK *lock;
|
||||||
Field **field;
|
Field **field;
|
||||||
public:
|
public:
|
||||||
select_create (TABLE_LIST *table,
|
select_create(TABLE_LIST *table,
|
||||||
HA_CREATE_INFO *create_info_par,
|
HA_CREATE_INFO *create_info_arg,
|
||||||
List<create_field> &fields_par,
|
Alter_info *alter_info_arg,
|
||||||
List<Key> &keys_par,
|
List<Item> &select_fields,
|
||||||
List<Item> &select_fields,enum_duplicates duplic, bool ignore)
|
enum_duplicates duplic, bool ignore)
|
||||||
:select_insert (NULL, NULL, &select_fields, 0, 0, duplic, ignore), create_table(table),
|
:select_insert(NULL, NULL, &select_fields, 0, 0, duplic, ignore),
|
||||||
extra_fields(&fields_par),keys(&keys_par), create_info(create_info_par),
|
create_table(table),
|
||||||
|
create_info(create_info_arg),
|
||||||
|
alter_info(alter_info_arg),
|
||||||
lock(0)
|
lock(0)
|
||||||
{}
|
{}
|
||||||
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
||||||
|
@ -2616,11 +2616,11 @@ bool select_insert::send_eof()
|
|||||||
temporary table flag)
|
temporary table flag)
|
||||||
create_table in Pointer to TABLE_LIST object providing database
|
create_table in Pointer to TABLE_LIST object providing database
|
||||||
and name for table to be created or to be open
|
and name for table to be created or to be open
|
||||||
extra_fields in/out Initial list of fields for table to be created
|
alter_info in/out Initial list of columns and indexes for the table
|
||||||
keys in List of keys for table to be created
|
to be created
|
||||||
items in List of items which should be used to produce rest
|
items in List of items which should be used to produce rest
|
||||||
of fields for the table (corresponding fields will
|
of fields for the table (corresponding fields will
|
||||||
be added to the end of 'extra_fields' list)
|
be added to the end of alter_info->create_list)
|
||||||
lock out Pointer to the MYSQL_LOCK object for table created
|
lock out Pointer to the MYSQL_LOCK object for table created
|
||||||
(open) will be returned in this parameter. Since
|
(open) will be returned in this parameter. Since
|
||||||
this table is not included in THD::lock caller is
|
this table is not included in THD::lock caller is
|
||||||
@ -2642,8 +2642,8 @@ bool select_insert::send_eof()
|
|||||||
|
|
||||||
static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
|
static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
|
||||||
TABLE_LIST *create_table,
|
TABLE_LIST *create_table,
|
||||||
List<create_field> *extra_fields,
|
Alter_info *alter_info,
|
||||||
List<Key> *keys, List<Item> *items,
|
List<Item> *items,
|
||||||
MYSQL_LOCK **lock)
|
MYSQL_LOCK **lock)
|
||||||
{
|
{
|
||||||
TABLE tmp_table; // Used during 'create_field()'
|
TABLE tmp_table; // Used during 'create_field()'
|
||||||
@ -2682,7 +2682,7 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
if (item->maybe_null)
|
if (item->maybe_null)
|
||||||
cr_field->flags &= ~NOT_NULL_FLAG;
|
cr_field->flags &= ~NOT_NULL_FLAG;
|
||||||
extra_fields->push_back(cr_field);
|
alter_info->create_list.push_back(cr_field);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
create and lock table
|
create and lock table
|
||||||
@ -2703,8 +2703,7 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
{
|
{
|
||||||
tmp_disable_binlog(thd);
|
tmp_disable_binlog(thd);
|
||||||
if (!mysql_create_table(thd, create_table->db, create_table->table_name,
|
if (!mysql_create_table(thd, create_table->db, create_table->table_name,
|
||||||
create_info, *extra_fields, *keys, 0,
|
create_info, alter_info, 0, select_field_count))
|
||||||
select_field_count))
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
If we are here in prelocked mode we either create temporary table
|
If we are here in prelocked mode we either create temporary table
|
||||||
@ -2760,7 +2759,7 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
|
|||||||
|
|
||||||
unit= u;
|
unit= u;
|
||||||
table= create_table_from_items(thd, create_info, create_table,
|
table= create_table_from_items(thd, create_info, create_table,
|
||||||
extra_fields, keys, &values, &lock);
|
alter_info, &values, &lock);
|
||||||
if (!table)
|
if (!table)
|
||||||
DBUG_RETURN(-1); // abort() deletes table
|
DBUG_RETURN(-1); // abort() deletes table
|
||||||
|
|
||||||
|
@ -1054,6 +1054,17 @@ int MYSQLlex(void *arg, void *yythd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Alter_info::Alter_info(const Alter_info &rhs, MEM_ROOT *mem_root)
|
||||||
|
:drop_list(rhs.drop_list, mem_root),
|
||||||
|
alter_list(rhs.alter_list, mem_root),
|
||||||
|
key_list(rhs.key_list, mem_root),
|
||||||
|
create_list(rhs.create_list, mem_root),
|
||||||
|
flags(rhs.flags),
|
||||||
|
keys_onoff(rhs.keys_onoff),
|
||||||
|
tablespace_op(rhs.tablespace_op)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Skip comment in the end of statement.
|
Skip comment in the end of statement.
|
||||||
|
|
||||||
|
@ -686,18 +686,58 @@ typedef class st_select_lex SELECT_LEX;
|
|||||||
#define ALTER_CONVERT 1024
|
#define ALTER_CONVERT 1024
|
||||||
#define ALTER_FORCE 2048
|
#define ALTER_FORCE 2048
|
||||||
|
|
||||||
typedef struct st_alter_info
|
/**
|
||||||
|
@brief Parsing data for CREATE or ALTER TABLE.
|
||||||
|
|
||||||
|
This structure contains a list of columns or indexes to be created,
|
||||||
|
altered or dropped.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Alter_info
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
List<Alter_drop> drop_list;
|
List<Alter_drop> drop_list;
|
||||||
List<Alter_column> alter_list;
|
List<Alter_column> alter_list;
|
||||||
|
List<Key> key_list;
|
||||||
|
List<create_field> create_list;
|
||||||
uint flags;
|
uint flags;
|
||||||
enum enum_enable_or_disable keys_onoff;
|
enum enum_enable_or_disable keys_onoff;
|
||||||
enum tablespace_op_type tablespace_op;
|
enum tablespace_op_type tablespace_op;
|
||||||
|
|
||||||
st_alter_info(){clear();}
|
Alter_info() :
|
||||||
void clear(){keys_onoff= LEAVE_AS_IS;tablespace_op= NO_TABLESPACE_OP;}
|
flags(0),
|
||||||
void reset(){drop_list.empty();alter_list.empty();clear();}
|
keys_onoff(LEAVE_AS_IS),
|
||||||
} ALTER_INFO;
|
tablespace_op(NO_TABLESPACE_OP)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void reset()
|
||||||
|
{
|
||||||
|
drop_list.empty();
|
||||||
|
alter_list.empty();
|
||||||
|
key_list.empty();
|
||||||
|
create_list.empty();
|
||||||
|
flags= 0;
|
||||||
|
keys_onoff= LEAVE_AS_IS;
|
||||||
|
tablespace_op= NO_TABLESPACE_OP;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
Construct a copy of this object to be used for mysql_alter_table
|
||||||
|
and mysql_create_table. Historically, these two functions modify
|
||||||
|
their Alter_info arguments. This behaviour breaks re-execution of
|
||||||
|
prepared statements and stored procedures and is compensated by
|
||||||
|
always supplying a copy of Alter_info to these functions.
|
||||||
|
The constructed copy still shares key Key, Alter_drop, create_field
|
||||||
|
and Alter_column elements of the lists - these structures are not
|
||||||
|
modified and thus are not copied.
|
||||||
|
|
||||||
|
@note You need to use check thd->is_fatal_error for out
|
||||||
|
of memory condition after calling this function.
|
||||||
|
*/
|
||||||
|
Alter_info(const Alter_info &rhs, MEM_ROOT *mem_root);
|
||||||
|
private:
|
||||||
|
Alter_info &operator=(const Alter_info &rhs); // not implemented
|
||||||
|
Alter_info(const Alter_info &rhs); // not implemented
|
||||||
|
};
|
||||||
|
|
||||||
struct st_sp_chistics
|
struct st_sp_chistics
|
||||||
{
|
{
|
||||||
@ -883,8 +923,6 @@ typedef struct st_lex : public Query_tables_list
|
|||||||
List<String> interval_list;
|
List<String> interval_list;
|
||||||
List<LEX_USER> users_list;
|
List<LEX_USER> users_list;
|
||||||
List<LEX_COLUMN> columns;
|
List<LEX_COLUMN> columns;
|
||||||
List<Key> key_list;
|
|
||||||
List<create_field> create_list;
|
|
||||||
List<Item> *insert_list,field_list,value_list,update_list;
|
List<Item> *insert_list,field_list,value_list,update_list;
|
||||||
List<List_item> many_values;
|
List<List_item> many_values;
|
||||||
List<set_var_base> var_list;
|
List<set_var_base> var_list;
|
||||||
@ -977,7 +1015,7 @@ typedef struct st_lex : public Query_tables_list
|
|||||||
bool safe_to_cache_query;
|
bool safe_to_cache_query;
|
||||||
bool subqueries, ignore;
|
bool subqueries, ignore;
|
||||||
st_parsing_options parsing_options;
|
st_parsing_options parsing_options;
|
||||||
ALTER_INFO alter_info;
|
Alter_info alter_info;
|
||||||
/* Prepared statements SQL syntax:*/
|
/* Prepared statements SQL syntax:*/
|
||||||
LEX_STRING prepared_stmt_name; /* Statement name (in all queries) */
|
LEX_STRING prepared_stmt_name; /* Statement name (in all queries) */
|
||||||
/*
|
/*
|
||||||
|
@ -61,9 +61,14 @@ public:
|
|||||||
pointer.
|
pointer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class list_node :public Sql_alloc
|
|
||||||
|
/**
|
||||||
|
list_node - a node of a single-linked list.
|
||||||
|
@note We never call a destructor for instances of this class.
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct list_node :public Sql_alloc
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
list_node *next;
|
list_node *next;
|
||||||
void *info;
|
void *info;
|
||||||
list_node(void *info_par,list_node *next_par)
|
list_node(void *info_par,list_node *next_par)
|
||||||
@ -71,11 +76,9 @@ public:
|
|||||||
{}
|
{}
|
||||||
list_node() /* For end_of_list */
|
list_node() /* For end_of_list */
|
||||||
{
|
{
|
||||||
info=0;
|
info= 0;
|
||||||
next= this;
|
next= this;
|
||||||
}
|
}
|
||||||
friend class base_list;
|
|
||||||
friend class base_list_iterator;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -91,12 +94,57 @@ public:
|
|||||||
|
|
||||||
inline void empty() { elements=0; first= &end_of_list; last=&first;}
|
inline void empty() { elements=0; first= &end_of_list; last=&first;}
|
||||||
inline base_list() { empty(); }
|
inline base_list() { empty(); }
|
||||||
|
/**
|
||||||
|
This is a shallow copy constructor that implicitly passes the ownership
|
||||||
|
from the source list to the new instance. The old instance is not
|
||||||
|
updated, so both objects end up sharing the same nodes. If one of
|
||||||
|
the instances then adds or removes a node, the other becomes out of
|
||||||
|
sync ('last' pointer), while still operational. Some old code uses and
|
||||||
|
relies on this behaviour. This logic is quite tricky: please do not use
|
||||||
|
it in any new code.
|
||||||
|
*/
|
||||||
inline base_list(const base_list &tmp) :Sql_alloc()
|
inline base_list(const base_list &tmp) :Sql_alloc()
|
||||||
{
|
{
|
||||||
elements= tmp.elements;
|
elements= tmp.elements;
|
||||||
first= tmp.first;
|
first= tmp.first;
|
||||||
last= elements ? tmp.last : &first;
|
last= elements ? tmp.last : &first;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
Construct a deep copy of the argument in memory root mem_root.
|
||||||
|
The elements themselves are copied by pointer.
|
||||||
|
*/
|
||||||
|
inline base_list(const base_list &rhs, MEM_ROOT *mem_root)
|
||||||
|
{
|
||||||
|
if (rhs.elements)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
It's okay to allocate an array of nodes at once: we never
|
||||||
|
call a destructor for list_node objects anyway.
|
||||||
|
*/
|
||||||
|
first= (list_node*) alloc_root(mem_root,
|
||||||
|
sizeof(list_node) * rhs.elements);
|
||||||
|
if (first)
|
||||||
|
{
|
||||||
|
elements= rhs.elements;
|
||||||
|
list_node *dst= first;
|
||||||
|
list_node *src= rhs.first;
|
||||||
|
for (; dst < first + elements - 1; dst++, src= src->next)
|
||||||
|
{
|
||||||
|
dst->info= src->info;
|
||||||
|
dst->next= dst + 1;
|
||||||
|
}
|
||||||
|
/* Copy the last node */
|
||||||
|
dst->info= src->info;
|
||||||
|
dst->next= &end_of_list;
|
||||||
|
/* Setup 'last' member */
|
||||||
|
last= &dst->next;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elements= 0;
|
||||||
|
first= &end_of_list;
|
||||||
|
last= &first;
|
||||||
|
}
|
||||||
inline base_list(bool error) { }
|
inline base_list(bool error) { }
|
||||||
inline bool push_back(void *info)
|
inline bool push_back(void *info)
|
||||||
{
|
{
|
||||||
@ -347,6 +395,8 @@ template <class T> class List :public base_list
|
|||||||
public:
|
public:
|
||||||
inline List() :base_list() {}
|
inline List() :base_list() {}
|
||||||
inline List(const List<T> &tmp) :base_list(tmp) {}
|
inline List(const List<T> &tmp) :base_list(tmp) {}
|
||||||
|
inline List(const List<T> &tmp, MEM_ROOT *mem_root) :
|
||||||
|
base_list(tmp, mem_root) {}
|
||||||
inline bool push_back(T *a) { return base_list::push_back(a); }
|
inline bool push_back(T *a) { return base_list::push_back(a); }
|
||||||
inline bool push_back(T *a, MEM_ROOT *mem_root)
|
inline bool push_back(T *a, MEM_ROOT *mem_root)
|
||||||
{ return base_list::push_back(a, mem_root); }
|
{ return base_list::push_back(a, mem_root); }
|
||||||
|
1354
sql/sql_locale.cc
1354
sql/sql_locale.cc
File diff suppressed because it is too large
Load Diff
223
sql/sql_parse.cc
223
sql/sql_parse.cc
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2894,23 +2895,41 @@ mysql_execute_command(THD *thd)
|
|||||||
// Skip first table, which is the table we are creating
|
// Skip first table, which is the table we are creating
|
||||||
TABLE_LIST *create_table= lex->unlink_first_table(&link_to_local);
|
TABLE_LIST *create_table= lex->unlink_first_table(&link_to_local);
|
||||||
TABLE_LIST *select_tables= lex->query_tables;
|
TABLE_LIST *select_tables= lex->query_tables;
|
||||||
|
/*
|
||||||
|
Code below (especially in mysql_create_table() and select_create
|
||||||
|
methods) may modify HA_CREATE_INFO structure in LEX, so we have to
|
||||||
|
use a copy of this structure to make execution prepared statement-
|
||||||
|
safe. A shallow copy is enough as this code won't modify any memory
|
||||||
|
referenced from this structure.
|
||||||
|
*/
|
||||||
|
HA_CREATE_INFO create_info(lex->create_info);
|
||||||
|
Alter_info alter_info(lex->alter_info, thd->mem_root);
|
||||||
|
|
||||||
|
if (thd->is_fatal_error)
|
||||||
|
{
|
||||||
|
/* out of memory when creating a copy of alter_info */
|
||||||
|
res= 1;
|
||||||
|
goto end_with_restore_list;
|
||||||
|
}
|
||||||
|
|
||||||
if ((res= create_table_precheck(thd, select_tables, create_table)))
|
if ((res= create_table_precheck(thd, select_tables, create_table)))
|
||||||
goto end_with_restore_list;
|
goto end_with_restore_list;
|
||||||
|
|
||||||
|
create_info.alias= create_table->alias;
|
||||||
|
|
||||||
#ifndef HAVE_READLINK
|
#ifndef HAVE_READLINK
|
||||||
if (lex->create_info.data_file_name)
|
if (create_info.data_file_name)
|
||||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
|
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
|
||||||
"DATA DIRECTORY option ignored");
|
"DATA DIRECTORY option ignored");
|
||||||
if (lex->create_info.index_file_name)
|
if (create_info.index_file_name)
|
||||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
|
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
|
||||||
"INDEX DIRECTORY option ignored");
|
"INDEX DIRECTORY option ignored");
|
||||||
lex->create_info.data_file_name=lex->create_info.index_file_name=0;
|
create_info.data_file_name= create_info.index_file_name= NULL;
|
||||||
#else
|
#else
|
||||||
/* Fix names if symlinked tables */
|
/* Fix names if symlinked tables */
|
||||||
if (append_file_to_dir(thd, &lex->create_info.data_file_name,
|
if (append_file_to_dir(thd, &create_info.data_file_name,
|
||||||
create_table->table_name) ||
|
create_table->table_name) ||
|
||||||
append_file_to_dir(thd, &lex->create_info.index_file_name,
|
append_file_to_dir(thd, &create_info.index_file_name,
|
||||||
create_table->table_name))
|
create_table->table_name))
|
||||||
goto end_with_restore_list;
|
goto end_with_restore_list;
|
||||||
#endif
|
#endif
|
||||||
@ -2918,14 +2937,14 @@ mysql_execute_command(THD *thd)
|
|||||||
If we are using SET CHARSET without DEFAULT, add an implicit
|
If we are using SET CHARSET without DEFAULT, add an implicit
|
||||||
DEFAULT to not confuse old users. (This may change).
|
DEFAULT to not confuse old users. (This may change).
|
||||||
*/
|
*/
|
||||||
if ((lex->create_info.used_fields &
|
if ((create_info.used_fields &
|
||||||
(HA_CREATE_USED_DEFAULT_CHARSET | HA_CREATE_USED_CHARSET)) ==
|
(HA_CREATE_USED_DEFAULT_CHARSET | HA_CREATE_USED_CHARSET)) ==
|
||||||
HA_CREATE_USED_CHARSET)
|
HA_CREATE_USED_CHARSET)
|
||||||
{
|
{
|
||||||
lex->create_info.used_fields&= ~HA_CREATE_USED_CHARSET;
|
create_info.used_fields&= ~HA_CREATE_USED_CHARSET;
|
||||||
lex->create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
|
create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
|
||||||
lex->create_info.default_table_charset= lex->create_info.table_charset;
|
create_info.default_table_charset= create_info.table_charset;
|
||||||
lex->create_info.table_charset= 0;
|
create_info.table_charset= 0;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
The create-select command will open and read-lock the select table
|
The create-select command will open and read-lock the select table
|
||||||
@ -2959,7 +2978,7 @@ mysql_execute_command(THD *thd)
|
|||||||
Is table which we are changing used somewhere in other parts
|
Is table which we are changing used somewhere in other parts
|
||||||
of query
|
of query
|
||||||
*/
|
*/
|
||||||
if (!(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE))
|
if (!(create_info.options & HA_LEX_CREATE_TMP_TABLE))
|
||||||
{
|
{
|
||||||
TABLE_LIST *duplicate;
|
TABLE_LIST *duplicate;
|
||||||
if ((duplicate= unique_table(thd, create_table, select_tables)))
|
if ((duplicate= unique_table(thd, create_table, select_tables)))
|
||||||
@ -2970,10 +2989,10 @@ mysql_execute_command(THD *thd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* If we create merge table, we have to test tables in merge, too */
|
/* If we create merge table, we have to test tables in merge, too */
|
||||||
if (lex->create_info.used_fields & HA_CREATE_USED_UNION)
|
if (create_info.used_fields & HA_CREATE_USED_UNION)
|
||||||
{
|
{
|
||||||
TABLE_LIST *tab;
|
TABLE_LIST *tab;
|
||||||
for (tab= (TABLE_LIST*) lex->create_info.merge_list.first;
|
for (tab= (TABLE_LIST*) create_info.merge_list.first;
|
||||||
tab;
|
tab;
|
||||||
tab= tab->next_local)
|
tab= tab->next_local)
|
||||||
{
|
{
|
||||||
@ -2986,11 +3005,13 @@ mysql_execute_command(THD *thd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
select_create is currently not re-execution friendly and
|
||||||
|
needs to be created for every execution of a PS/SP.
|
||||||
|
*/
|
||||||
if ((result= new select_create(create_table,
|
if ((result= new select_create(create_table,
|
||||||
&lex->create_info,
|
&create_info,
|
||||||
lex->create_list,
|
&alter_info,
|
||||||
lex->key_list,
|
|
||||||
select_lex->item_list,
|
select_lex->item_list,
|
||||||
lex->duplicates,
|
lex->duplicates,
|
||||||
lex->ignore)))
|
lex->ignore)))
|
||||||
@ -3002,23 +3023,19 @@ mysql_execute_command(THD *thd)
|
|||||||
res= handle_select(thd, lex, result, 0);
|
res= handle_select(thd, lex, result, 0);
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
/* reset for PS */
|
|
||||||
lex->create_list.empty();
|
|
||||||
lex->key_list.empty();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* regular create */
|
/* regular create */
|
||||||
if (lex->name)
|
if (lex->name)
|
||||||
res= mysql_create_like_table(thd, create_table, &lex->create_info,
|
res= mysql_create_like_table(thd, create_table, &create_info,
|
||||||
(Table_ident *)lex->name);
|
(Table_ident *)lex->name);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res= mysql_create_table(thd, create_table->db,
|
res= mysql_create_table(thd, create_table->db,
|
||||||
create_table->table_name, &lex->create_info,
|
create_table->table_name, &create_info,
|
||||||
lex->create_list,
|
&alter_info, 0, 0);
|
||||||
lex->key_list, 0, 0);
|
|
||||||
}
|
}
|
||||||
if (!res)
|
if (!res)
|
||||||
send_ok(thd);
|
send_ok(thd);
|
||||||
@ -3030,16 +3047,49 @@ end_with_restore_list:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SQLCOM_CREATE_INDEX:
|
case SQLCOM_CREATE_INDEX:
|
||||||
|
/* Fall through */
|
||||||
|
case SQLCOM_DROP_INDEX:
|
||||||
|
/*
|
||||||
|
CREATE INDEX and DROP INDEX are implemented by calling ALTER
|
||||||
|
TABLE with proper arguments. This isn't very fast but it
|
||||||
|
should work for most cases.
|
||||||
|
|
||||||
|
In the future ALTER TABLE will notice that only added
|
||||||
|
indexes and create these one by one for the existing table
|
||||||
|
without having to do a full rebuild.
|
||||||
|
|
||||||
|
One should normally create all indexes with CREATE TABLE or
|
||||||
|
ALTER TABLE.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
Alter_info alter_info(lex->alter_info, thd->mem_root);
|
||||||
|
HA_CREATE_INFO create_info;
|
||||||
|
|
||||||
|
if (thd->is_fatal_error) /* out of memory creating a copy of alter_info*/
|
||||||
|
goto error;
|
||||||
|
|
||||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||||
if (check_one_table_access(thd, INDEX_ACL, all_tables))
|
if (check_one_table_access(thd, INDEX_ACL, first_table))
|
||||||
goto error; /* purecov: inspected */
|
goto error; /* purecov: inspected */
|
||||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
|
||||||
if (end_active_trans(thd))
|
if (end_active_trans(thd))
|
||||||
goto error;
|
goto error;
|
||||||
else
|
/*
|
||||||
res = mysql_create_index(thd, first_table, lex->key_list);
|
Currently CREATE INDEX or DROP INDEX cause a full table rebuild
|
||||||
break;
|
and thus classify as slow administrative statements just like
|
||||||
|
ALTER TABLE.
|
||||||
|
*/
|
||||||
|
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||||
|
|
||||||
|
bzero((char*) &create_info, sizeof(create_info));
|
||||||
|
create_info.db_type= DB_TYPE_DEFAULT;
|
||||||
|
create_info.row_type= ROW_TYPE_NOT_USED;
|
||||||
|
create_info.default_table_charset= thd->variables.collation_database;
|
||||||
|
|
||||||
|
res= mysql_alter_table(thd, first_table->db, first_table->table_name,
|
||||||
|
&create_info, first_table, &alter_info,
|
||||||
|
0, (ORDER*) 0, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
#ifdef HAVE_REPLICATION
|
#ifdef HAVE_REPLICATION
|
||||||
case SQLCOM_SLAVE_START:
|
case SQLCOM_SLAVE_START:
|
||||||
{
|
{
|
||||||
@ -3080,6 +3130,17 @@ end_with_restore_list:
|
|||||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||||
{
|
{
|
||||||
ulong priv=0;
|
ulong priv=0;
|
||||||
|
/*
|
||||||
|
Code in mysql_alter_table() may modify its HA_CREATE_INFO argument,
|
||||||
|
so we have to use a copy of this structure to make execution
|
||||||
|
prepared statement- safe. A shallow copy is enough as no memory
|
||||||
|
referenced from this structure will be modified.
|
||||||
|
*/
|
||||||
|
HA_CREATE_INFO create_info(lex->create_info);
|
||||||
|
Alter_info alter_info(lex->alter_info, thd->mem_root);
|
||||||
|
|
||||||
|
if (thd->is_fatal_error) /* out of memory creating a copy of alter_info */
|
||||||
|
goto error;
|
||||||
if (lex->name && (!lex->name[0] || strlen(lex->name) > NAME_LEN))
|
if (lex->name && (!lex->name[0] || strlen(lex->name) > NAME_LEN))
|
||||||
{
|
{
|
||||||
my_error(ER_WRONG_TABLE_NAME, MYF(0), lex->name);
|
my_error(ER_WRONG_TABLE_NAME, MYF(0), lex->name);
|
||||||
@ -3094,7 +3155,7 @@ end_with_restore_list:
|
|||||||
is_schema_db(select_lex->db))||
|
is_schema_db(select_lex->db))||
|
||||||
check_merge_table_access(thd, first_table->db,
|
check_merge_table_access(thd, first_table->db,
|
||||||
(TABLE_LIST *)
|
(TABLE_LIST *)
|
||||||
lex->create_info.merge_list.first))
|
create_info.merge_list.first))
|
||||||
goto error; /* purecov: inspected */
|
goto error; /* purecov: inspected */
|
||||||
if (grant_option)
|
if (grant_option)
|
||||||
{
|
{
|
||||||
@ -3113,13 +3174,13 @@ end_with_restore_list:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Don't yet allow changing of symlinks with ALTER TABLE */
|
/* Don't yet allow changing of symlinks with ALTER TABLE */
|
||||||
if (lex->create_info.data_file_name)
|
if (create_info.data_file_name)
|
||||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
|
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
|
||||||
"DATA DIRECTORY option ignored");
|
"DATA DIRECTORY option ignored");
|
||||||
if (lex->create_info.index_file_name)
|
if (create_info.index_file_name)
|
||||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
|
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
|
||||||
"INDEX DIRECTORY option ignored");
|
"INDEX DIRECTORY option ignored");
|
||||||
lex->create_info.data_file_name=lex->create_info.index_file_name=0;
|
create_info.data_file_name= create_info.index_file_name= NULL;
|
||||||
/* ALTER TABLE ends previous transaction */
|
/* ALTER TABLE ends previous transaction */
|
||||||
if (end_active_trans(thd))
|
if (end_active_trans(thd))
|
||||||
goto error;
|
goto error;
|
||||||
@ -3134,12 +3195,12 @@ end_with_restore_list:
|
|||||||
|
|
||||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||||
res= mysql_alter_table(thd, select_lex->db, lex->name,
|
res= mysql_alter_table(thd, select_lex->db, lex->name,
|
||||||
&lex->create_info,
|
&create_info,
|
||||||
first_table, lex->create_list,
|
first_table,
|
||||||
lex->key_list,
|
&alter_info,
|
||||||
select_lex->order_list.elements,
|
select_lex->order_list.elements,
|
||||||
(ORDER *) select_lex->order_list.first,
|
(ORDER *) select_lex->order_list.first,
|
||||||
lex->ignore, &lex->alter_info, 1);
|
lex->ignore);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3292,7 +3353,7 @@ end_with_restore_list:
|
|||||||
goto error; /* purecov: inspected */
|
goto error; /* purecov: inspected */
|
||||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||||
res= (specialflag & (SPECIAL_SAFE_MODE | SPECIAL_NO_NEW_FUNC)) ?
|
res= (specialflag & (SPECIAL_SAFE_MODE | SPECIAL_NO_NEW_FUNC)) ?
|
||||||
mysql_recreate_table(thd, first_table, 1) :
|
mysql_recreate_table(thd, first_table) :
|
||||||
mysql_optimize_table(thd, first_table, &lex->check_opt);
|
mysql_optimize_table(thd, first_table, &lex->check_opt);
|
||||||
/* ! we write after unlocking the table */
|
/* ! we write after unlocking the table */
|
||||||
if (!res && !lex->no_write_to_binlog)
|
if (!res && !lex->no_write_to_binlog)
|
||||||
@ -3608,15 +3669,6 @@ end_with_restore_list:
|
|||||||
lex->drop_temporary);
|
lex->drop_temporary);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SQLCOM_DROP_INDEX:
|
|
||||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
|
||||||
if (check_one_table_access(thd, INDEX_ACL, all_tables))
|
|
||||||
goto error; /* purecov: inspected */
|
|
||||||
if (end_active_trans(thd))
|
|
||||||
goto error;
|
|
||||||
else
|
|
||||||
res = mysql_drop_index(thd, first_table, &lex->alter_info);
|
|
||||||
break;
|
|
||||||
case SQLCOM_SHOW_PROCESSLIST:
|
case SQLCOM_SHOW_PROCESSLIST:
|
||||||
if (!thd->security_ctx->priv_user[0] &&
|
if (!thd->security_ctx->priv_user[0] &&
|
||||||
check_global_access(thd,PROCESS_ACL))
|
check_global_access(thd,PROCESS_ACL))
|
||||||
@ -3745,6 +3797,12 @@ end_with_restore_list:
|
|||||||
break;
|
break;
|
||||||
case SQLCOM_CREATE_DB:
|
case SQLCOM_CREATE_DB:
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
As mysql_create_db() may modify HA_CREATE_INFO structure passed to
|
||||||
|
it, we need to use a copy of LEX::create_info to make execution
|
||||||
|
prepared statement- safe.
|
||||||
|
*/
|
||||||
|
HA_CREATE_INFO create_info(lex->create_info);
|
||||||
if (end_active_trans(thd))
|
if (end_active_trans(thd))
|
||||||
{
|
{
|
||||||
res= -1;
|
res= -1;
|
||||||
@ -3772,10 +3830,11 @@ end_with_restore_list:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (check_access(thd,CREATE_ACL,lex->name,0,1,0,is_schema_db(lex->name)))
|
if (check_access(thd,CREATE_ACL,lex->name,0,1,0,is_schema_db(lex->name)))
|
||||||
break;
|
break;
|
||||||
res= mysql_create_db(thd,(lower_case_table_names == 2 ? alias : lex->name),
|
res= mysql_create_db(thd,(lower_case_table_names == 2 ? alias : lex->name),
|
||||||
&lex->create_info, 0);
|
&create_info, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SQLCOM_DROP_DB:
|
case SQLCOM_DROP_DB:
|
||||||
@ -4462,7 +4521,7 @@ create_sp_error:
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
my_bool nsok= thd->net.no_send_ok;
|
my_bool save_no_send_ok= thd->net.no_send_ok;
|
||||||
thd->net.no_send_ok= TRUE;
|
thd->net.no_send_ok= TRUE;
|
||||||
if (sp->m_flags & sp_head::MULTI_RESULTS)
|
if (sp->m_flags & sp_head::MULTI_RESULTS)
|
||||||
{
|
{
|
||||||
@ -4473,7 +4532,7 @@ create_sp_error:
|
|||||||
back
|
back
|
||||||
*/
|
*/
|
||||||
my_error(ER_SP_BADSELECT, MYF(0), sp->m_qname.str);
|
my_error(ER_SP_BADSELECT, MYF(0), sp->m_qname.str);
|
||||||
thd->net.no_send_ok= nsok;
|
thd->net.no_send_ok= save_no_send_ok;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -4489,7 +4548,7 @@ create_sp_error:
|
|||||||
if (check_routine_access(thd, EXECUTE_ACL,
|
if (check_routine_access(thd, EXECUTE_ACL,
|
||||||
sp->m_db.str, sp->m_name.str, TRUE, FALSE))
|
sp->m_db.str, sp->m_name.str, TRUE, FALSE))
|
||||||
{
|
{
|
||||||
thd->net.no_send_ok= nsok;
|
thd->net.no_send_ok= save_no_send_ok;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -4514,7 +4573,7 @@ create_sp_error:
|
|||||||
|
|
||||||
thd->variables.select_limit= select_limit;
|
thd->variables.select_limit= select_limit;
|
||||||
|
|
||||||
thd->net.no_send_ok= nsok;
|
thd->net.no_send_ok= save_no_send_ok;
|
||||||
thd->server_status&= ~bits_to_be_cleared;
|
thd->server_status&= ~bits_to_be_cleared;
|
||||||
|
|
||||||
if (!res)
|
if (!res)
|
||||||
@ -5923,14 +5982,16 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
|
|||||||
if (type_modifier & PRI_KEY_FLAG)
|
if (type_modifier & PRI_KEY_FLAG)
|
||||||
{
|
{
|
||||||
lex->col_list.push_back(new key_part_spec(field_name,0));
|
lex->col_list.push_back(new key_part_spec(field_name,0));
|
||||||
lex->key_list.push_back(new Key(Key::PRIMARY, NullS, HA_KEY_ALG_UNDEF,
|
lex->alter_info.key_list.push_back(new Key(Key::PRIMARY, NullS,
|
||||||
0, lex->col_list));
|
HA_KEY_ALG_UNDEF, 0,
|
||||||
|
lex->col_list));
|
||||||
lex->col_list.empty();
|
lex->col_list.empty();
|
||||||
}
|
}
|
||||||
if (type_modifier & (UNIQUE_FLAG | UNIQUE_KEY_FLAG))
|
if (type_modifier & (UNIQUE_FLAG | UNIQUE_KEY_FLAG))
|
||||||
{
|
{
|
||||||
lex->col_list.push_back(new key_part_spec(field_name,0));
|
lex->col_list.push_back(new key_part_spec(field_name,0));
|
||||||
lex->key_list.push_back(new Key(Key::UNIQUE, NullS, HA_KEY_ALG_UNDEF, 0,
|
lex->alter_info.key_list.push_back(new Key(Key::UNIQUE, NullS,
|
||||||
|
HA_KEY_ALG_UNDEF, 0,
|
||||||
lex->col_list));
|
lex->col_list));
|
||||||
lex->col_list.empty();
|
lex->col_list.empty();
|
||||||
}
|
}
|
||||||
@ -5994,7 +6055,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
|
|||||||
interval_list, cs, uint_geom_type))
|
interval_list, cs, uint_geom_type))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
|
|
||||||
lex->create_list.push_back(new_field);
|
lex->alter_info.create_list.push_back(new_field);
|
||||||
lex->last_field=new_field;
|
lex->last_field=new_field;
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
@ -7022,55 +7083,6 @@ Item * all_any_subquery_creator(Item *left_expr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
CREATE INDEX and DROP INDEX are implemented by calling ALTER TABLE with
|
|
||||||
the proper arguments. This isn't very fast but it should work for most
|
|
||||||
cases.
|
|
||||||
|
|
||||||
In the future ALTER TABLE will notice that only added indexes
|
|
||||||
and create these one by one for the existing table without having to do
|
|
||||||
a full rebuild.
|
|
||||||
|
|
||||||
One should normally create all indexes with CREATE TABLE or ALTER TABLE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
bool mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys)
|
|
||||||
{
|
|
||||||
List<create_field> fields;
|
|
||||||
ALTER_INFO alter_info;
|
|
||||||
alter_info.flags= ALTER_ADD_INDEX;
|
|
||||||
HA_CREATE_INFO create_info;
|
|
||||||
DBUG_ENTER("mysql_create_index");
|
|
||||||
bzero((char*) &create_info,sizeof(create_info));
|
|
||||||
create_info.db_type=DB_TYPE_DEFAULT;
|
|
||||||
create_info.default_table_charset= thd->variables.collation_database;
|
|
||||||
create_info.row_type= ROW_TYPE_NOT_USED;
|
|
||||||
DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->table_name,
|
|
||||||
&create_info, table_list,
|
|
||||||
fields, keys, 0, (ORDER*)0,
|
|
||||||
0, &alter_info, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool mysql_drop_index(THD *thd, TABLE_LIST *table_list, ALTER_INFO *alter_info)
|
|
||||||
{
|
|
||||||
List<create_field> fields;
|
|
||||||
List<Key> keys;
|
|
||||||
HA_CREATE_INFO create_info;
|
|
||||||
DBUG_ENTER("mysql_drop_index");
|
|
||||||
bzero((char*) &create_info,sizeof(create_info));
|
|
||||||
create_info.db_type=DB_TYPE_DEFAULT;
|
|
||||||
create_info.default_table_charset= thd->variables.collation_database;
|
|
||||||
create_info.row_type= ROW_TYPE_NOT_USED;
|
|
||||||
alter_info->clear();
|
|
||||||
alter_info->flags= ALTER_DROP_INDEX;
|
|
||||||
DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->table_name,
|
|
||||||
&create_info, table_list,
|
|
||||||
fields, keys, 0, (ORDER*)0,
|
|
||||||
0, alter_info, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Multi update query pre-check
|
Multi update query pre-check
|
||||||
|
|
||||||
@ -7369,7 +7381,6 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables,
|
|||||||
|
|
||||||
want_priv= ((lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) ?
|
want_priv= ((lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) ?
|
||||||
CREATE_TMP_ACL : CREATE_ACL);
|
CREATE_TMP_ACL : CREATE_ACL);
|
||||||
lex->create_info.alias= create_table->alias;
|
|
||||||
if (check_access(thd, want_priv, create_table->db,
|
if (check_access(thd, want_priv, create_table->db,
|
||||||
&create_table->grant.privilege, 0, 0,
|
&create_table->grant.privilege, 0, 0,
|
||||||
test(create_table->schema_table)) ||
|
test(create_table->schema_table)) ||
|
||||||
|
@ -10434,6 +10434,7 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
|
|||||||
*/
|
*/
|
||||||
join->examined_rows++;
|
join->examined_rows++;
|
||||||
join->thd->row_count++;
|
join->thd->row_count++;
|
||||||
|
join_tab->read_record.file->unlock_row();
|
||||||
}
|
}
|
||||||
return NESTED_LOOP_OK;
|
return NESTED_LOOP_OK;
|
||||||
}
|
}
|
||||||
|
@ -460,7 +460,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool mysqld_show_create_db(THD *thd, char *dbname,
|
bool mysqld_show_create_db(THD *thd, char *dbname,
|
||||||
HA_CREATE_INFO *create_info)
|
const HA_CREATE_INFO *create_info)
|
||||||
{
|
{
|
||||||
Security_context *sctx= thd->security_ctx;
|
Security_context *sctx= thd->security_ctx;
|
||||||
char buff[2048];
|
char buff[2048];
|
||||||
|
150
sql/sql_table.cc
150
sql/sql_table.cc
@ -645,8 +645,7 @@ int prepare_create_field(create_field *sql_field,
|
|||||||
mysql_prepare_table()
|
mysql_prepare_table()
|
||||||
thd Thread object
|
thd Thread object
|
||||||
create_info Create information (like MAX_ROWS)
|
create_info Create information (like MAX_ROWS)
|
||||||
fields List of fields to create
|
alter_info List of columns and indexes to create
|
||||||
keys List of keys to create
|
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
Prepares the table and key structures for table creation.
|
Prepares the table and key structures for table creation.
|
||||||
@ -660,8 +659,8 @@ int prepare_create_field(create_field *sql_field,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
||||||
List<create_field> *fields,
|
Alter_info *alter_info,
|
||||||
List<Key> *keys, bool tmp_table,
|
bool tmp_table,
|
||||||
uint *db_options,
|
uint *db_options,
|
||||||
handler *file, KEY **key_info_buffer,
|
handler *file, KEY **key_info_buffer,
|
||||||
uint *key_count, int select_field_count)
|
uint *key_count, int select_field_count)
|
||||||
@ -675,11 +674,12 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
int timestamps= 0, timestamps_with_niladic= 0;
|
int timestamps= 0, timestamps_with_niladic= 0;
|
||||||
int field_no,dup_no;
|
int field_no,dup_no;
|
||||||
int select_field_pos,auto_increment=0;
|
int select_field_pos,auto_increment=0;
|
||||||
List_iterator<create_field> it(*fields),it2(*fields);
|
List_iterator<create_field> it(alter_info->create_list);
|
||||||
|
List_iterator<create_field> it2(alter_info->create_list);
|
||||||
uint total_uneven_bit_length= 0;
|
uint total_uneven_bit_length= 0;
|
||||||
DBUG_ENTER("mysql_prepare_table");
|
DBUG_ENTER("mysql_prepare_table");
|
||||||
|
|
||||||
select_field_pos= fields->elements - select_field_count;
|
select_field_pos= alter_info->create_list.elements - select_field_count;
|
||||||
null_fields=blob_columns=0;
|
null_fields=blob_columns=0;
|
||||||
create_info->varchar= 0;
|
create_info->varchar= 0;
|
||||||
max_key_length= file->max_key_length();
|
max_key_length= file->max_key_length();
|
||||||
@ -1004,7 +1004,8 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
|
|
||||||
/* Create keys */
|
/* Create keys */
|
||||||
|
|
||||||
List_iterator<Key> key_iterator(*keys), key_iterator2(*keys);
|
List_iterator<Key> key_iterator(alter_info->key_list);
|
||||||
|
List_iterator<Key> key_iterator2(alter_info->key_list);
|
||||||
uint key_parts=0, fk_key_count=0;
|
uint key_parts=0, fk_key_count=0;
|
||||||
bool primary_key=0,unique_key=0;
|
bool primary_key=0,unique_key=0;
|
||||||
Key *key, *key2;
|
Key *key, *key2;
|
||||||
@ -1566,9 +1567,8 @@ void sp_prepare_create_field(THD *thd, create_field *sql_field)
|
|||||||
thd Thread object
|
thd Thread object
|
||||||
db Database
|
db Database
|
||||||
table_name Table name
|
table_name Table name
|
||||||
create_info Create information (like MAX_ROWS)
|
create_info [in/out] Create information (like MAX_ROWS)
|
||||||
fields List of fields to create
|
alter_info [in/out] List of columns and indexes to create
|
||||||
keys List of keys to create
|
|
||||||
internal_tmp_table Set to 1 if this is an internal temporary table
|
internal_tmp_table Set to 1 if this is an internal temporary table
|
||||||
(From ALTER TABLE)
|
(From ALTER TABLE)
|
||||||
|
|
||||||
@ -1580,6 +1580,11 @@ void sp_prepare_create_field(THD *thd, create_field *sql_field)
|
|||||||
select_field_count is also used for CREATE ... SELECT,
|
select_field_count is also used for CREATE ... SELECT,
|
||||||
and must be zero for standard create of table.
|
and must be zero for standard create of table.
|
||||||
|
|
||||||
|
Note that structures passed as 'create_info' and 'alter_info' parameters
|
||||||
|
may be modified by this function. It is responsibility of the caller to
|
||||||
|
make a copy of create_info in order to provide correct execution in
|
||||||
|
prepared statements/stored routines.
|
||||||
|
|
||||||
RETURN VALUES
|
RETURN VALUES
|
||||||
FALSE OK
|
FALSE OK
|
||||||
TRUE error
|
TRUE error
|
||||||
@ -1587,8 +1592,8 @@ void sp_prepare_create_field(THD *thd, create_field *sql_field)
|
|||||||
|
|
||||||
bool mysql_create_table(THD *thd,const char *db, const char *table_name,
|
bool mysql_create_table(THD *thd,const char *db, const char *table_name,
|
||||||
HA_CREATE_INFO *create_info,
|
HA_CREATE_INFO *create_info,
|
||||||
List<create_field> &fields,
|
Alter_info *alter_info,
|
||||||
List<Key> &keys,bool internal_tmp_table,
|
bool internal_tmp_table,
|
||||||
uint select_field_count)
|
uint select_field_count)
|
||||||
{
|
{
|
||||||
char path[FN_REFLEN];
|
char path[FN_REFLEN];
|
||||||
@ -1600,7 +1605,7 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name,
|
|||||||
DBUG_ENTER("mysql_create_table");
|
DBUG_ENTER("mysql_create_table");
|
||||||
|
|
||||||
/* Check for duplicate fields and check type of table to create */
|
/* Check for duplicate fields and check type of table to create */
|
||||||
if (!fields.elements)
|
if (!alter_info->create_list.elements)
|
||||||
{
|
{
|
||||||
my_message(ER_TABLE_MUST_HAVE_COLUMNS, ER(ER_TABLE_MUST_HAVE_COLUMNS),
|
my_message(ER_TABLE_MUST_HAVE_COLUMNS, ER(ER_TABLE_MUST_HAVE_COLUMNS),
|
||||||
MYF(0));
|
MYF(0));
|
||||||
@ -1644,8 +1649,8 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name,
|
|||||||
create_info->default_table_charset= db_info.default_table_charset;
|
create_info->default_table_charset= db_info.default_table_charset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mysql_prepare_table(thd, create_info, &fields,
|
if (mysql_prepare_table(thd, create_info, alter_info, internal_tmp_table,
|
||||||
&keys, internal_tmp_table, &db_options, file,
|
&db_options, file,
|
||||||
&key_info_buffer, &key_count,
|
&key_info_buffer, &key_count,
|
||||||
select_field_count))
|
select_field_count))
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
@ -1737,8 +1742,8 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name,
|
|||||||
create_info->table_options=db_options;
|
create_info->table_options=db_options;
|
||||||
|
|
||||||
if (rea_create_table(thd, path, db, table_name,
|
if (rea_create_table(thd, path, db, table_name,
|
||||||
create_info, fields, key_count,
|
create_info, alter_info->create_list,
|
||||||
key_info_buffer))
|
key_count, key_info_buffer))
|
||||||
goto end;
|
goto end;
|
||||||
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
|
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
|
||||||
{
|
{
|
||||||
@ -2323,9 +2328,12 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||||||
(table->table->file->ha_check_for_upgrade(check_opt) ==
|
(table->table->file->ha_check_for_upgrade(check_opt) ==
|
||||||
HA_ADMIN_NEEDS_ALTER))
|
HA_ADMIN_NEEDS_ALTER))
|
||||||
{
|
{
|
||||||
|
my_bool save_no_send_ok= thd->net.no_send_ok;
|
||||||
close_thread_tables(thd);
|
close_thread_tables(thd);
|
||||||
tmp_disable_binlog(thd); // binlogging is done by caller if wanted
|
tmp_disable_binlog(thd); // binlogging is done by caller if wanted
|
||||||
result_code= mysql_recreate_table(thd, table, 0);
|
thd->net.no_send_ok= TRUE;
|
||||||
|
result_code= mysql_recreate_table(thd, table);
|
||||||
|
thd->net.no_send_ok= save_no_send_ok;
|
||||||
reenable_binlog(thd);
|
reenable_binlog(thd);
|
||||||
goto send_result;
|
goto send_result;
|
||||||
}
|
}
|
||||||
@ -2404,6 +2412,7 @@ send_result_message:
|
|||||||
|
|
||||||
case HA_ADMIN_TRY_ALTER:
|
case HA_ADMIN_TRY_ALTER:
|
||||||
{
|
{
|
||||||
|
my_bool save_no_send_ok= thd->net.no_send_ok;
|
||||||
/*
|
/*
|
||||||
This is currently used only by InnoDB. ha_innobase::optimize() answers
|
This is currently used only by InnoDB. ha_innobase::optimize() answers
|
||||||
"try with alter", so here we close the table, do an ALTER TABLE,
|
"try with alter", so here we close the table, do an ALTER TABLE,
|
||||||
@ -2414,7 +2423,9 @@ send_result_message:
|
|||||||
*save_next_global= table->next_global;
|
*save_next_global= table->next_global;
|
||||||
table->next_local= table->next_global= 0;
|
table->next_local= table->next_global= 0;
|
||||||
tmp_disable_binlog(thd); // binlogging is done by caller if wanted
|
tmp_disable_binlog(thd); // binlogging is done by caller if wanted
|
||||||
result_code= mysql_recreate_table(thd, table, 0);
|
thd->net.no_send_ok= TRUE;
|
||||||
|
result_code= mysql_recreate_table(thd, table);
|
||||||
|
thd->net.no_send_ok= save_no_send_ok;
|
||||||
reenable_binlog(thd);
|
reenable_binlog(thd);
|
||||||
close_thread_tables(thd);
|
close_thread_tables(thd);
|
||||||
if (!result_code) // recreation went ok
|
if (!result_code) // recreation went ok
|
||||||
@ -2984,14 +2995,20 @@ bool alter_table_manage_keys(TABLE *table, int indexes_were_disabled,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Alter table
|
Alter table
|
||||||
|
|
||||||
|
|
||||||
|
NOTE
|
||||||
|
The structures passed as 'create_info' and 'alter_info' parameters may
|
||||||
|
be modified by this function. It is responsibility of the caller to make
|
||||||
|
a copy of create_info in order to provide correct execution in prepared
|
||||||
|
statements/stored routines.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||||
HA_CREATE_INFO *create_info,
|
HA_CREATE_INFO *create_info,
|
||||||
TABLE_LIST *table_list,
|
TABLE_LIST *table_list,
|
||||||
List<create_field> &fields, List<Key> &keys,
|
Alter_info *alter_info,
|
||||||
uint order_num, ORDER *order, bool ignore,
|
uint order_num, ORDER *order, bool ignore)
|
||||||
ALTER_INFO *alter_info, bool do_send_ok)
|
|
||||||
{
|
{
|
||||||
TABLE *table,*new_table=0;
|
TABLE *table,*new_table=0;
|
||||||
int error;
|
int error;
|
||||||
@ -3212,7 +3229,6 @@ view_err:
|
|||||||
Query_log_event qinfo(thd, thd->query, thd->query_length, FALSE, FALSE);
|
Query_log_event qinfo(thd, thd->query, thd->query_length, FALSE, FALSE);
|
||||||
mysql_bin_log.write(&qinfo);
|
mysql_bin_log.write(&qinfo);
|
||||||
}
|
}
|
||||||
if (do_send_ok)
|
|
||||||
send_ok(thd);
|
send_ok(thd);
|
||||||
}
|
}
|
||||||
else if (error > 0)
|
else if (error > 0)
|
||||||
@ -3240,10 +3256,9 @@ view_err:
|
|||||||
|
|
||||||
restore_record(table, s->default_values); // Empty record for DEFAULT
|
restore_record(table, s->default_values); // Empty record for DEFAULT
|
||||||
List_iterator<Alter_drop> drop_it(alter_info->drop_list);
|
List_iterator<Alter_drop> drop_it(alter_info->drop_list);
|
||||||
List_iterator<create_field> def_it(fields);
|
List_iterator<create_field> def_it(alter_info->create_list);
|
||||||
List_iterator<Alter_column> alter_it(alter_info->alter_list);
|
List_iterator<Alter_column> alter_it(alter_info->alter_list);
|
||||||
List<create_field> create_list; // Add new fields here
|
Alter_info new_info; // Add new columns and indexes here
|
||||||
List<Key> key_list; // Add new keys here
|
|
||||||
create_field *def;
|
create_field *def;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3291,13 +3306,13 @@ view_err:
|
|||||||
def->field=field;
|
def->field=field;
|
||||||
if (!def->after)
|
if (!def->after)
|
||||||
{
|
{
|
||||||
create_list.push_back(def);
|
new_info.create_list.push_back(def);
|
||||||
def_it.remove();
|
def_it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Use old field value
|
{ // Use old field value
|
||||||
create_list.push_back(def=new create_field(field,field));
|
new_info.create_list.push_back(def= new create_field(field, field));
|
||||||
alter_it.rewind(); // Change default if ALTER
|
alter_it.rewind(); // Change default if ALTER
|
||||||
Alter_column *alter;
|
Alter_column *alter;
|
||||||
while ((alter=alter_it++))
|
while ((alter=alter_it++))
|
||||||
@ -3321,7 +3336,7 @@ view_err:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
def_it.rewind();
|
def_it.rewind();
|
||||||
List_iterator<create_field> find_it(create_list);
|
List_iterator<create_field> find_it(new_info.create_list);
|
||||||
while ((def=def_it++)) // Add new columns
|
while ((def=def_it++)) // Add new columns
|
||||||
{
|
{
|
||||||
if (def->change && ! def->field)
|
if (def->change && ! def->field)
|
||||||
@ -3330,9 +3345,9 @@ view_err:
|
|||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
if (!def->after)
|
if (!def->after)
|
||||||
create_list.push_back(def);
|
new_info.create_list.push_back(def);
|
||||||
else if (def->after == first_keyword)
|
else if (def->after == first_keyword)
|
||||||
create_list.push_front(def);
|
new_info.create_list.push_front(def);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
create_field *find;
|
create_field *find;
|
||||||
@ -3356,7 +3371,7 @@ view_err:
|
|||||||
alter_info->alter_list.head()->name, table_name);
|
alter_info->alter_list.head()->name, table_name);
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
if (!create_list.elements)
|
if (!new_info.create_list.elements)
|
||||||
{
|
{
|
||||||
my_message(ER_CANT_REMOVE_ALL_FIELDS, ER(ER_CANT_REMOVE_ALL_FIELDS),
|
my_message(ER_CANT_REMOVE_ALL_FIELDS, ER(ER_CANT_REMOVE_ALL_FIELDS),
|
||||||
MYF(0));
|
MYF(0));
|
||||||
@ -3368,8 +3383,8 @@ view_err:
|
|||||||
for which some fields exists.
|
for which some fields exists.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
List_iterator<Key> key_it(keys);
|
List_iterator<Key> key_it(alter_info->key_list);
|
||||||
List_iterator<create_field> field_it(create_list);
|
List_iterator<create_field> field_it(new_info.create_list);
|
||||||
List<key_part_spec> key_parts;
|
List<key_part_spec> key_parts;
|
||||||
|
|
||||||
KEY *key_info=table->key_info;
|
KEY *key_info=table->key_info;
|
||||||
@ -3441,24 +3456,37 @@ view_err:
|
|||||||
key_part_length));
|
key_part_length));
|
||||||
}
|
}
|
||||||
if (key_parts.elements)
|
if (key_parts.elements)
|
||||||
key_list.push_back(new Key(key_info->flags & HA_SPATIAL ? Key::SPATIAL :
|
{
|
||||||
(key_info->flags & HA_NOSAME ?
|
Key *key;
|
||||||
(!my_strcasecmp(system_charset_info,
|
enum Key::Keytype key_type;
|
||||||
key_name, primary_key_name) ?
|
|
||||||
Key::PRIMARY : Key::UNIQUE) :
|
if (key_info->flags & HA_SPATIAL)
|
||||||
(key_info->flags & HA_FULLTEXT ?
|
key_type= Key::SPATIAL;
|
||||||
Key::FULLTEXT : Key::MULTIPLE)),
|
else if (key_info->flags & HA_NOSAME)
|
||||||
key_name,
|
{
|
||||||
|
if (! my_strcasecmp(system_charset_info, key_name, primary_key_name))
|
||||||
|
key_type= Key::PRIMARY;
|
||||||
|
else
|
||||||
|
key_type= Key::UNIQUE;
|
||||||
|
}
|
||||||
|
else if (key_info->flags & HA_FULLTEXT)
|
||||||
|
key_type= Key::FULLTEXT;
|
||||||
|
else
|
||||||
|
key_type= Key::MULTIPLE;
|
||||||
|
|
||||||
|
key= new Key(key_type, key_name,
|
||||||
key_info->algorithm,
|
key_info->algorithm,
|
||||||
test(key_info->flags & HA_GENERATED_KEY),
|
test(key_info->flags & HA_GENERATED_KEY),
|
||||||
key_parts));
|
key_parts);
|
||||||
|
new_info.key_list.push_back(key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Key *key;
|
Key *key;
|
||||||
while ((key=key_it++)) // Add new keys
|
while ((key=key_it++)) // Add new keys
|
||||||
{
|
{
|
||||||
if (key->type != Key::FOREIGN_KEY)
|
if (key->type != Key::FOREIGN_KEY)
|
||||||
key_list.push_back(key);
|
new_info.key_list.push_back(key);
|
||||||
if (key->name &&
|
if (key->name &&
|
||||||
!my_strcasecmp(system_charset_info,key->name,primary_key_name))
|
!my_strcasecmp(system_charset_info,key->name,primary_key_name))
|
||||||
{
|
{
|
||||||
@ -3593,7 +3621,7 @@ view_err:
|
|||||||
{
|
{
|
||||||
tmp_disable_binlog(thd);
|
tmp_disable_binlog(thd);
|
||||||
error= mysql_create_table(thd, new_db, tmp_name,
|
error= mysql_create_table(thd, new_db, tmp_name,
|
||||||
create_info,create_list,key_list,1,0);
|
create_info, &new_info, 1, 0);
|
||||||
reenable_binlog(thd);
|
reenable_binlog(thd);
|
||||||
if (error)
|
if (error)
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
@ -3634,9 +3662,9 @@ view_err:
|
|||||||
{
|
{
|
||||||
new_table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET;
|
new_table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET;
|
||||||
new_table->next_number_field=new_table->found_next_number_field;
|
new_table->next_number_field=new_table->found_next_number_field;
|
||||||
error=copy_data_between_tables(table, new_table, create_list, ignore,
|
error= copy_data_between_tables(table, new_table, new_info.create_list,
|
||||||
order_num, order, &copied, &deleted,
|
ignore, order_num, order,
|
||||||
alter_info->keys_onoff);
|
&copied, &deleted, alter_info->keys_onoff);
|
||||||
}
|
}
|
||||||
else if (!new_table)
|
else if (!new_table)
|
||||||
{
|
{
|
||||||
@ -3860,8 +3888,7 @@ end_temporary:
|
|||||||
my_snprintf(tmp_name, sizeof(tmp_name), ER(ER_INSERT_INFO),
|
my_snprintf(tmp_name, sizeof(tmp_name), ER(ER_INSERT_INFO),
|
||||||
(ulong) (copied + deleted), (ulong) deleted,
|
(ulong) (copied + deleted), (ulong) deleted,
|
||||||
(ulong) thd->cuted_fields);
|
(ulong) thd->cuted_fields);
|
||||||
if (do_send_ok)
|
send_ok(thd, copied + deleted, 0L, tmp_name);
|
||||||
send_ok(thd,copied+deleted,0L,tmp_name);
|
|
||||||
thd->some_tables_deleted=0;
|
thd->some_tables_deleted=0;
|
||||||
DBUG_RETURN(FALSE);
|
DBUG_RETURN(FALSE);
|
||||||
|
|
||||||
@ -4060,31 +4087,26 @@ copy_data_between_tables(TABLE *from,TABLE *to,
|
|||||||
mysql_recreate_table()
|
mysql_recreate_table()
|
||||||
thd Thread handler
|
thd Thread handler
|
||||||
tables Tables to recreate
|
tables Tables to recreate
|
||||||
do_send_ok If we should send_ok() or leave it to caller
|
|
||||||
|
|
||||||
RETURN
|
RETURN
|
||||||
Like mysql_alter_table().
|
Like mysql_alter_table().
|
||||||
*/
|
*/
|
||||||
bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list,
|
bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list)
|
||||||
bool do_send_ok)
|
|
||||||
{
|
{
|
||||||
DBUG_ENTER("mysql_recreate_table");
|
|
||||||
LEX *lex= thd->lex;
|
|
||||||
HA_CREATE_INFO create_info;
|
HA_CREATE_INFO create_info;
|
||||||
lex->create_list.empty();
|
Alter_info alter_info;
|
||||||
lex->key_list.empty();
|
|
||||||
lex->col_list.empty();
|
DBUG_ENTER("mysql_recreate_table");
|
||||||
lex->alter_info.reset();
|
|
||||||
bzero((char*) &create_info,sizeof(create_info));
|
bzero((char*) &create_info, sizeof(create_info));
|
||||||
create_info.db_type=DB_TYPE_DEFAULT;
|
create_info.db_type=DB_TYPE_DEFAULT;
|
||||||
create_info.row_type=ROW_TYPE_NOT_USED;
|
create_info.row_type=ROW_TYPE_NOT_USED;
|
||||||
create_info.default_table_charset=default_charset_info;
|
create_info.default_table_charset=default_charset_info;
|
||||||
/* Force alter table to recreate table */
|
/* Force alter table to recreate table */
|
||||||
lex->alter_info.flags= ALTER_CHANGE_COLUMN;
|
alter_info.flags= ALTER_CHANGE_COLUMN;
|
||||||
DBUG_RETURN(mysql_alter_table(thd, NullS, NullS, &create_info,
|
DBUG_RETURN(mysql_alter_table(thd, NullS, NullS, &create_info,
|
||||||
table_list, lex->create_list,
|
table_list, &alter_info,
|
||||||
lex->key_list, 0, (ORDER *) 0,
|
0, (ORDER *) 0, 0));
|
||||||
0, &lex->alter_info, do_send_ok));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1352,8 +1352,7 @@ create:
|
|||||||
TL_READ_NO_INSERT:
|
TL_READ_NO_INSERT:
|
||||||
TL_READ)))
|
TL_READ)))
|
||||||
YYABORT;
|
YYABORT;
|
||||||
lex->create_list.empty();
|
lex->alter_info.reset();
|
||||||
lex->key_list.empty();
|
|
||||||
lex->col_list.empty();
|
lex->col_list.empty();
|
||||||
lex->change=NullS;
|
lex->change=NullS;
|
||||||
bzero((char*) &lex->create_info,sizeof(lex->create_info));
|
bzero((char*) &lex->create_info,sizeof(lex->create_info));
|
||||||
@ -1371,16 +1370,17 @@ create:
|
|||||||
if (!lex->current_select->add_table_to_list(lex->thd, $7, NULL,
|
if (!lex->current_select->add_table_to_list(lex->thd, $7, NULL,
|
||||||
TL_OPTION_UPDATING))
|
TL_OPTION_UPDATING))
|
||||||
YYABORT;
|
YYABORT;
|
||||||
lex->create_list.empty();
|
lex->alter_info.reset();
|
||||||
lex->key_list.empty();
|
lex->alter_info.flags= ALTER_ADD_INDEX;
|
||||||
lex->col_list.empty();
|
lex->col_list.empty();
|
||||||
lex->change=NullS;
|
lex->change=NullS;
|
||||||
}
|
}
|
||||||
'(' key_list ')'
|
'(' key_list ')'
|
||||||
{
|
{
|
||||||
LEX *lex=Lex;
|
LEX *lex=Lex;
|
||||||
|
Key *key= new Key($2, $4.str, $5, 0, lex->col_list);
|
||||||
|
|
||||||
lex->key_list.push_back(new Key($2,$4.str, $5, 0, lex->col_list));
|
lex->alter_info.key_list.push_back(key);
|
||||||
lex->col_list.empty();
|
lex->col_list.empty();
|
||||||
}
|
}
|
||||||
| CREATE DATABASE opt_if_not_exists ident
|
| CREATE DATABASE opt_if_not_exists ident
|
||||||
@ -2920,29 +2920,34 @@ key_def:
|
|||||||
key_type opt_ident key_alg '(' key_list ')'
|
key_type opt_ident key_alg '(' key_list ')'
|
||||||
{
|
{
|
||||||
LEX *lex=Lex;
|
LEX *lex=Lex;
|
||||||
lex->key_list.push_back(new Key($1,$2, $3, 0, lex->col_list));
|
Key *key= new Key($1, $2, $3, 0, lex->col_list);
|
||||||
|
lex->alter_info.key_list.push_back(key);
|
||||||
|
|
||||||
lex->col_list.empty(); /* Alloced by sql_alloc */
|
lex->col_list.empty(); /* Alloced by sql_alloc */
|
||||||
}
|
}
|
||||||
| opt_constraint constraint_key_type opt_ident key_alg '(' key_list ')'
|
| opt_constraint constraint_key_type opt_ident key_alg '(' key_list ')'
|
||||||
{
|
{
|
||||||
LEX *lex=Lex;
|
LEX *lex=Lex;
|
||||||
const char *key_name= $3 ? $3:$1;
|
const char *key_name= $3 ? $3:$1;
|
||||||
lex->key_list.push_back(new Key($2, key_name, $4, 0,
|
Key *key= new Key($2, key_name, $4, 0, lex->col_list);
|
||||||
lex->col_list));
|
lex->alter_info.key_list.push_back(key);
|
||||||
lex->col_list.empty(); /* Alloced by sql_alloc */
|
lex->col_list.empty(); /* Alloced by sql_alloc */
|
||||||
}
|
}
|
||||||
| opt_constraint FOREIGN KEY_SYM opt_ident '(' key_list ')' references
|
| opt_constraint FOREIGN KEY_SYM opt_ident '(' key_list ')' references
|
||||||
{
|
{
|
||||||
LEX *lex=Lex;
|
LEX *lex=Lex;
|
||||||
lex->key_list.push_back(new foreign_key($4 ? $4:$1, lex->col_list,
|
const char *key_name= $4 ? $4 : $1;
|
||||||
|
Key *key= new foreign_key(key_name, lex->col_list,
|
||||||
$8,
|
$8,
|
||||||
lex->ref_list,
|
lex->ref_list,
|
||||||
lex->fk_delete_opt,
|
lex->fk_delete_opt,
|
||||||
lex->fk_update_opt,
|
lex->fk_update_opt,
|
||||||
lex->fk_match_option));
|
lex->fk_match_option);
|
||||||
lex->key_list.push_back(new Key(Key::MULTIPLE, $4 ? $4 : $1,
|
lex->alter_info.key_list.push_back(key);
|
||||||
|
key= new Key(Key::MULTIPLE, key_name,
|
||||||
HA_KEY_ALG_UNDEF, 1,
|
HA_KEY_ALG_UNDEF, 1,
|
||||||
lex->col_list));
|
lex->col_list);
|
||||||
|
lex->alter_info.key_list.push_back(key);
|
||||||
lex->col_list.empty(); /* Alloced by sql_alloc */
|
lex->col_list.empty(); /* Alloced by sql_alloc */
|
||||||
}
|
}
|
||||||
| constraint opt_check_constraint
|
| constraint opt_check_constraint
|
||||||
@ -3484,8 +3489,6 @@ alter:
|
|||||||
if (!lex->select_lex.add_table_to_list(thd, $4, NULL,
|
if (!lex->select_lex.add_table_to_list(thd, $4, NULL,
|
||||||
TL_OPTION_UPDATING))
|
TL_OPTION_UPDATING))
|
||||||
YYABORT;
|
YYABORT;
|
||||||
lex->create_list.empty();
|
|
||||||
lex->key_list.empty();
|
|
||||||
lex->col_list.empty();
|
lex->col_list.empty();
|
||||||
lex->select_lex.init_order();
|
lex->select_lex.init_order();
|
||||||
lex->select_lex.db=
|
lex->select_lex.db=
|
||||||
@ -3496,7 +3499,6 @@ alter:
|
|||||||
lex->create_info.default_table_charset= NULL;
|
lex->create_info.default_table_charset= NULL;
|
||||||
lex->create_info.row_type= ROW_TYPE_NOT_USED;
|
lex->create_info.row_type= ROW_TYPE_NOT_USED;
|
||||||
lex->alter_info.reset();
|
lex->alter_info.reset();
|
||||||
lex->alter_info.flags= 0;
|
|
||||||
}
|
}
|
||||||
alter_list
|
alter_list
|
||||||
{}
|
{}
|
||||||
@ -6254,7 +6256,8 @@ drop:
|
|||||||
{
|
{
|
||||||
LEX *lex=Lex;
|
LEX *lex=Lex;
|
||||||
lex->sql_command= SQLCOM_DROP_INDEX;
|
lex->sql_command= SQLCOM_DROP_INDEX;
|
||||||
lex->alter_info.drop_list.empty();
|
lex->alter_info.reset();
|
||||||
|
lex->alter_info.flags= ALTER_DROP_INDEX;
|
||||||
lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY,
|
lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY,
|
||||||
$3.str));
|
$3.str));
|
||||||
if (!lex->current_select->add_table_to_list(lex->thd, $5, NULL,
|
if (!lex->current_select->add_table_to_list(lex->thd, $5, NULL,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user