Fixes during review of new pushed code
Change bool in C code to my_bool Added to mysqltest --enable_parsning and --disable_parsing to avoid to have to comment parts of tests Added comparison of LEX_STRING's and use this to compare file types for view and trigger files.
This commit is contained in:
parent
e60d786dde
commit
8437e9c1be
@ -49,5 +49,6 @@ enum options_client
|
||||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING,
|
||||
#endif
|
||||
OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE
|
||||
OPT_TRIGGERS,
|
||||
OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE,
|
||||
};
|
||||
|
@ -432,7 +432,7 @@ int main(int argc,char *argv[])
|
||||
put_info((char*) glob_buffer.ptr(),INFO_INFO);
|
||||
|
||||
#ifdef HAVE_READLINE
|
||||
initialize_readline(my_progname);
|
||||
initialize_readline((char*) my_progname);
|
||||
if (!status.batch && !quick && !opt_html && !opt_xml)
|
||||
{
|
||||
/* read-history from file, default ~/.mysql_history*/
|
||||
|
@ -372,7 +372,7 @@ static struct my_option my_long_options[] =
|
||||
(gptr*) &path, (gptr*) &path, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"tables", OPT_TABLES, "Overrides option --databases (-B).",
|
||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"triggers", '/0', "Dump triggers for each dumped table",
|
||||
{"triggers", OPT_TRIGGERS, "Dump triggers for each dumped table",
|
||||
(gptr*) &opt_dump_triggers, (gptr*) &opt_dump_triggers, 0, GET_BOOL,
|
||||
NO_ARG, 1, 0, 0, 0, 0, 0},
|
||||
#ifndef DONT_ALLOW_USER_CHANGE
|
||||
@ -424,6 +424,7 @@ void check_io(FILE *file)
|
||||
if (ferror(file))
|
||||
{
|
||||
fprintf(stderr, "%s: Got errno %d on write\n", my_progname, errno);
|
||||
ignore_errors= 0; /* We can't ignore this error */
|
||||
safe_exit(EX_EOF);
|
||||
}
|
||||
}
|
||||
@ -2610,7 +2611,7 @@ static int do_show_master_status(MYSQL *mysql_con)
|
||||
{
|
||||
/* SHOW MASTER STATUS reports nothing and --force is not enabled */
|
||||
my_printf_error(0, "Error: Binlogging on server not active",
|
||||
MYF(0), mysql_error(mysql_con));
|
||||
MYF(0));
|
||||
mysql_free_result(master);
|
||||
return 1;
|
||||
}
|
||||
@ -2979,11 +2980,12 @@ static my_bool get_view_structure(char *table, char* db)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
MY_INIT("mysqldump");
|
||||
|
||||
compatible_mode_normal_str[0]= 0;
|
||||
default_charset= (char *)mysql_universal_client_charset;
|
||||
bzero((char*) &ignore_table, sizeof(ignore_table));
|
||||
|
||||
MY_INIT("mysqldump");
|
||||
if (get_options(&argc, &argv))
|
||||
{
|
||||
my_end(0);
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#define MTEST_VERSION "2.4"
|
||||
#define MTEST_VERSION "2.5"
|
||||
|
||||
#include <my_global.h>
|
||||
#include <mysql_embed.h>
|
||||
@ -151,6 +151,7 @@ const char* user = 0, *host = 0, *unix_sock = 0, *opt_basedir="./";
|
||||
static int port = 0;
|
||||
static my_bool opt_big_test= 0, opt_compress= 0, silent= 0, verbose = 0;
|
||||
static my_bool tty_password= 0, ps_protocol= 0, ps_protocol_enabled= 0;
|
||||
static int parsing_disabled= 0;
|
||||
static uint start_lineno, *lineno;
|
||||
const char* manager_user="root",*manager_host=0;
|
||||
char *manager_pass=0;
|
||||
@ -308,6 +309,7 @@ Q_CHARACTER_SET, Q_DISABLE_PS_PROTOCOL, Q_ENABLE_PS_PROTOCOL,
|
||||
Q_EXIT,
|
||||
Q_DISABLE_RECONNECT, Q_ENABLE_RECONNECT,
|
||||
Q_IF,
|
||||
Q_DISABLE_PARSING, Q_ENABLE_PARSING,
|
||||
|
||||
Q_UNKNOWN, /* Unknown command. */
|
||||
Q_COMMENT, /* Comments, ignored. */
|
||||
@ -399,6 +401,8 @@ const char *command_names[]=
|
||||
"disable_reconnect",
|
||||
"enable_reconnect",
|
||||
"if",
|
||||
"disable_parsing",
|
||||
"enable_parsing",
|
||||
0
|
||||
};
|
||||
|
||||
@ -2141,7 +2145,7 @@ int read_line(char* buf, int size)
|
||||
}
|
||||
break;
|
||||
case R_LINE_START:
|
||||
if (c == '#' || c == '-')
|
||||
if (c == '#' || c == '-' || parsing_disabled)
|
||||
{
|
||||
state = R_COMMENT;
|
||||
}
|
||||
@ -2268,18 +2272,22 @@ int read_query(struct st_query** q_ptr)
|
||||
/* This goto is to avoid losing the "expected error" info. */
|
||||
goto end;
|
||||
}
|
||||
memcpy((gptr) q->expected_errno, (gptr) global_expected_errno,
|
||||
sizeof(global_expected_errno));
|
||||
q->expected_errors= global_expected_errors;
|
||||
q->abort_on_error= (global_expected_errors == 0 && abort_on_error);
|
||||
bzero((gptr) global_expected_errno, sizeof(global_expected_errno));
|
||||
global_expected_errors=0;
|
||||
if (!parsing_disabled)
|
||||
{
|
||||
memcpy((gptr) q->expected_errno, (gptr) global_expected_errno,
|
||||
sizeof(global_expected_errno));
|
||||
q->expected_errors= global_expected_errors;
|
||||
q->abort_on_error= (global_expected_errors == 0 && abort_on_error);
|
||||
bzero((gptr) global_expected_errno, sizeof(global_expected_errno));
|
||||
global_expected_errors=0;
|
||||
}
|
||||
|
||||
if (p[0] == '-' && p[1] == '-')
|
||||
{
|
||||
q->type= Q_COMMENT_WITH_COMMAND;
|
||||
p+= 2; /* To calculate first word */
|
||||
}
|
||||
else
|
||||
else if (!parsing_disabled)
|
||||
{
|
||||
if (*p == '!')
|
||||
{
|
||||
@ -3586,20 +3594,29 @@ void get_query_type(struct st_query* q)
|
||||
uint type;
|
||||
DBUG_ENTER("get_query_type");
|
||||
|
||||
if (*q->query == '}')
|
||||
if (!parsing_disabled && *q->query == '}')
|
||||
{
|
||||
q->type = Q_END_BLOCK;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
if (q->type != Q_COMMENT_WITH_COMMAND)
|
||||
q->type = Q_QUERY;
|
||||
q->type= parsing_disabled ? Q_COMMENT : Q_QUERY;
|
||||
|
||||
save=q->query[q->first_word_len];
|
||||
q->query[q->first_word_len]=0;
|
||||
type=find_type(q->query, &command_typelib, 1+2);
|
||||
q->query[q->first_word_len]=save;
|
||||
if (type > 0)
|
||||
{
|
||||
q->type=(enum enum_commands) type; /* Found command */
|
||||
/*
|
||||
If queries are disabled, only recognize
|
||||
--enable-queries and --disable-queries
|
||||
*/
|
||||
if (parsing_disabled && q->type != Q_ENABLE_PARSING &&
|
||||
q->type != Q_DISABLE_PARSING)
|
||||
q->type= Q_COMMENT;
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
@ -3963,6 +3980,17 @@ int main(int argc, char **argv)
|
||||
case Q_ENABLE_RECONNECT:
|
||||
cur_con->mysql.reconnect= 1;
|
||||
break;
|
||||
case Q_DISABLE_PARSING:
|
||||
parsing_disabled++;
|
||||
break;
|
||||
case Q_ENABLE_PARSING:
|
||||
/*
|
||||
Ensure we don't get parsing_disabled < 0 as this would accidently
|
||||
disable code we don't want to have disabled
|
||||
*/
|
||||
if (parsing_disabled > 0)
|
||||
parsing_disabled--;
|
||||
break;
|
||||
|
||||
case Q_EXIT:
|
||||
abort_flag= 1;
|
||||
|
@ -218,7 +218,7 @@ extern int errno; /* declare errno */
|
||||
#endif /* #ifndef errno */
|
||||
extern char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE];
|
||||
extern char *home_dir; /* Home directory for user */
|
||||
extern char *my_progname; /* program-name (printed in errors) */
|
||||
extern const char *my_progname; /* program-name (printed in errors) */
|
||||
extern char NEAR curr_dir[]; /* Current directory for user */
|
||||
extern int (*error_handler_hook)(uint my_err, const char *str,myf MyFlags);
|
||||
extern int (*fatal_error_handler_hook)(uint my_err, const char *str,
|
||||
|
@ -60,8 +60,8 @@ ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *time);
|
||||
ulonglong TIME_to_ulonglong(const MYSQL_TIME *time);
|
||||
|
||||
|
||||
bool str_to_time(const char *str,uint length, MYSQL_TIME *l_time,
|
||||
int *was_cut);
|
||||
my_bool str_to_time(const char *str,uint length, MYSQL_TIME *l_time,
|
||||
int *was_cut);
|
||||
|
||||
long calc_daynr(uint year,uint month,uint day);
|
||||
uint calc_days_in_year(uint year);
|
||||
@ -69,7 +69,8 @@ uint calc_days_in_year(uint year);
|
||||
void init_time(void);
|
||||
|
||||
my_time_t
|
||||
my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, bool *in_dst_time_gap);
|
||||
my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone,
|
||||
my_bool *in_dst_time_gap);
|
||||
|
||||
void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type);
|
||||
|
||||
|
@ -504,7 +504,7 @@ comment='Procedure privileges';
|
||||
|
||||
|
||||
CREATE TABLE proc (
|
||||
db char(64) binary DEFAULT '' NOT NULL,
|
||||
db char(64) collate utf8_bin DEFAULT '' NOT NULL,
|
||||
name char(64) DEFAULT '' NOT NULL,
|
||||
type enum('FUNCTION','PROCEDURE') NOT NULL,
|
||||
specific_name char(64) DEFAULT '' NOT NULL,
|
||||
@ -519,7 +519,7 @@ CREATE TABLE proc (
|
||||
param_list blob DEFAULT '' NOT NULL,
|
||||
returns char(64) DEFAULT '' NOT NULL,
|
||||
body blob DEFAULT '' NOT NULL,
|
||||
definer char(77) binary DEFAULT '' NOT NULL,
|
||||
definer char(77) collate utf8_bin DEFAULT '' NOT NULL,
|
||||
created timestamp,
|
||||
modified timestamp,
|
||||
sql_mode set(
|
||||
@ -554,6 +554,6 @@ CREATE TABLE proc (
|
||||
'NO_AUTO_CREATE_USER',
|
||||
'HIGH_NOT_PRECEDENCE'
|
||||
) DEFAULT '' NOT NULL,
|
||||
comment char(64) binary DEFAULT '' NOT NULL,
|
||||
comment char(64) collate utf8_bin DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY (db,name,type)
|
||||
) comment='Stored Procedures';
|
||||
) character set utf8 comment='Stored Procedures';
|
||||
|
@ -164,3 +164,5 @@ root@localhost
|
||||
. - is longer then 80 characters and
|
||||
. - consists of several lines
|
||||
--------------------------------------------------------------------------------
|
||||
this will be executed
|
||||
this will be executed
|
||||
|
@ -526,14 +526,14 @@ ERROR HY000: Variable 'warning_count' is a read only variable
|
||||
set @@global.error_count=1;
|
||||
ERROR HY000: Variable 'error_count' is a read only variable
|
||||
set @@max_heap_table_size= 4294967296;
|
||||
select @@max_heap_table_size;
|
||||
@@max_heap_table_size
|
||||
4294967296
|
||||
select @@max_heap_table_size > 0;
|
||||
@@max_heap_table_size > 0
|
||||
1
|
||||
set global max_heap_table_size= 4294967296;
|
||||
select @@max_heap_table_size;
|
||||
@@max_heap_table_size
|
||||
4294967296
|
||||
select @@max_heap_table_size > 0;
|
||||
@@max_heap_table_size > 0
|
||||
1
|
||||
set @@max_heap_table_size= 4294967296;
|
||||
select @@max_heap_table_size;
|
||||
@@max_heap_table_size
|
||||
4294967296
|
||||
select @@max_heap_table_size > 0;
|
||||
@@max_heap_table_size > 0
|
||||
1
|
||||
|
@ -249,25 +249,27 @@ flush privileges;
|
||||
|
||||
# QQ This results in NULLs instead of the version numbers when
|
||||
# QQ a LOCK TABLES is in effect when selecting from
|
||||
# QQ information_schema.tables. Until this bug has been fixed,
|
||||
# QQ this test is disabled /pem
|
||||
#delimiter //;
|
||||
#create procedure px5 ()
|
||||
#begin
|
||||
#declare v int;
|
||||
#declare c cursor for select version from
|
||||
#information_schema.tables where table_schema <> 'information_schema';
|
||||
#open c;
|
||||
#fetch c into v;
|
||||
#select v;
|
||||
#close c;
|
||||
#end;//
|
||||
#
|
||||
#call px5()//
|
||||
#call px5()//
|
||||
#delimiter ;//
|
||||
#select sql_mode from information_schema.ROUTINES;
|
||||
#drop procedure px5;
|
||||
# QQ information_schema.tables.
|
||||
|
||||
--disable_parsing until bug is fixes
|
||||
delimiter //;
|
||||
create procedure px5 ()
|
||||
begin
|
||||
declare v int;
|
||||
declare c cursor for select version from
|
||||
information_schema.tables where table_schema <> 'information_schema';
|
||||
open c;
|
||||
fetch c into v;
|
||||
select v;
|
||||
close c;
|
||||
end;//
|
||||
|
||||
call px5()//
|
||||
call px5()//
|
||||
delimiter ;//
|
||||
select sql_mode from information_schema.ROUTINES;
|
||||
drop procedure px5;
|
||||
--enable_parsing
|
||||
|
||||
create table t1 (a int not null auto_increment,b int, primary key (a));
|
||||
insert into t1 values (1,1),(NULL,3),(NULL,4);
|
||||
|
@ -324,3 +324,14 @@ let $message= . Here comes a very very long message that
|
||||
. - consists of several lines;
|
||||
--source include/show_msg80.inc
|
||||
|
||||
#
|
||||
# Test --enable_parsning / disable_parsning
|
||||
#
|
||||
--disable_query_log
|
||||
--disable_parsing
|
||||
# The following will not enable query logging
|
||||
--enable_query_log
|
||||
select "this will not be executed";
|
||||
--enable_parsing
|
||||
select "this will be executed";
|
||||
--enable_query_log
|
||||
|
@ -1232,12 +1232,14 @@ begin
|
||||
end|
|
||||
select f5(1)|
|
||||
# This should generate an error about insuficient number of tables locked
|
||||
# Nuw this crash server, comented until bug#11394 fix
|
||||
#--error 1100
|
||||
#select f5(2)|
|
||||
# Now this crash server
|
||||
--disable_parsing until bug#11394 fix
|
||||
--error 1100
|
||||
select f5(2)|
|
||||
# But now it simply miserably fails because we are trying to use the same
|
||||
# lex on the next iteration :/ It should generate some error too...
|
||||
# select f5(3)|
|
||||
select f5(3)|
|
||||
--enable_parsing
|
||||
|
||||
# OTOH this should work
|
||||
create function f6() returns int
|
||||
@ -1285,9 +1287,11 @@ create function f1() returns int
|
||||
return (select sum(data) from t1) + (select sum(data) from v1)|
|
||||
# This queries will crash server because we can't use LEX in
|
||||
# reenterable fashion yet. Patch disabling recursion will heal this.
|
||||
#select f1()|
|
||||
#select * from v1|
|
||||
#select * from v2|
|
||||
--disable_parsing
|
||||
select f1()|
|
||||
select * from v1|
|
||||
select * from v2|
|
||||
--enable_parsing
|
||||
# Back to the normal cases
|
||||
drop function f1|
|
||||
create function f1() returns int
|
||||
@ -1499,54 +1503,55 @@ show procedure status like '%p%'|
|
||||
#
|
||||
# This part of test is disabled until we implement support for
|
||||
# recursive stored procedures.
|
||||
#--disable_warnings
|
||||
#drop table if exists fib|
|
||||
#--enable_warnings
|
||||
#create table fib ( f bigint unsigned not null )|
|
||||
#
|
||||
## We deliberately do it the awkward way, fetching the last two
|
||||
## values from the table, in order to exercise various statements
|
||||
## and table accesses at each turn.
|
||||
#--disable_warnings
|
||||
#drop procedure if exists fib|
|
||||
#--enable_warnings
|
||||
#create procedure fib(n int unsigned)
|
||||
#begin
|
||||
# if n > 1 then
|
||||
# begin
|
||||
# declare x, y bigint unsigned;
|
||||
# declare c cursor for select f from fib order by f desc limit 2;
|
||||
#
|
||||
# open c;
|
||||
# fetch c into y;
|
||||
# fetch c into x;
|
||||
# close c;
|
||||
# insert into fib values (x+y);
|
||||
# call fib(n-1);
|
||||
# end;
|
||||
# end if;
|
||||
#end|
|
||||
#
|
||||
## Minimum test: recursion of 3 levels
|
||||
#
|
||||
#insert into fib values (0), (1)|
|
||||
#
|
||||
#call fib(3)|
|
||||
#
|
||||
#select * from fib order by f asc|
|
||||
#
|
||||
#delete from fib|
|
||||
#
|
||||
## Original test: 20 levels (may run into memory limits!)
|
||||
#
|
||||
#insert into fib values (0), (1)|
|
||||
#
|
||||
#call fib(20)|
|
||||
#
|
||||
#select * from fib order by f asc|
|
||||
#drop table fib|
|
||||
#drop procedure fib|
|
||||
--disable_parsing
|
||||
--disable_warnings
|
||||
drop table if exists fib|
|
||||
--enable_warnings
|
||||
create table fib ( f bigint unsigned not null )|
|
||||
|
||||
# We deliberately do it the awkward way, fetching the last two
|
||||
# values from the table, in order to exercise various statements
|
||||
# and table accesses at each turn.
|
||||
--disable_warnings
|
||||
drop procedure if exists fib|
|
||||
--enable_warnings
|
||||
create procedure fib(n int unsigned)
|
||||
begin
|
||||
if n > 1 then
|
||||
begin
|
||||
declare x, y bigint unsigned;
|
||||
declare c cursor for select f from fib order by f desc limit 2;
|
||||
|
||||
open c;
|
||||
fetch c into y;
|
||||
fetch c into x;
|
||||
close c;
|
||||
insert into fib values (x+y);
|
||||
call fib(n-1);
|
||||
end;
|
||||
end if;
|
||||
end|
|
||||
|
||||
# Minimum test: recursion of 3 levels
|
||||
|
||||
insert into fib values (0), (1)|
|
||||
|
||||
call fib(3)|
|
||||
|
||||
select * from fib order by f asc|
|
||||
|
||||
delete from fib|
|
||||
|
||||
# Original test: 20 levels (may run into memory limits!)
|
||||
|
||||
insert into fib values (0), (1)|
|
||||
|
||||
call fib(20)|
|
||||
|
||||
select * from fib order by f asc|
|
||||
drop table fib|
|
||||
drop procedure fib|
|
||||
--enable_parsing
|
||||
|
||||
#
|
||||
# Comment & suid
|
||||
@ -1830,49 +1835,51 @@ drop procedure bug2260|
|
||||
# FIXME: Other solution would be to use preopened proc table
|
||||
# instead of opening it anew.
|
||||
#
|
||||
#--disable_warnings
|
||||
#drop procedure if exists bug2267_1|
|
||||
#--enable_warnings
|
||||
#create procedure bug2267_1()
|
||||
#begin
|
||||
# show procedure status;
|
||||
#end|
|
||||
#
|
||||
#--disable_warnings
|
||||
#drop procedure if exists bug2267_2|
|
||||
#--enable_warnings
|
||||
#create procedure bug2267_2()
|
||||
#begin
|
||||
# show function status;
|
||||
#end|
|
||||
#
|
||||
#--disable_warnings
|
||||
#drop procedure if exists bug2267_3|
|
||||
#--enable_warnings
|
||||
#create procedure bug2267_3()
|
||||
#begin
|
||||
# show create procedure bug2267_1;
|
||||
#end|
|
||||
#
|
||||
#--disable_warnings
|
||||
#drop procedure if exists bug2267_4|
|
||||
#--enable_warnings
|
||||
#create procedure bug2267_4()
|
||||
#begin
|
||||
# show create function fac;
|
||||
#end|
|
||||
#
|
||||
#--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
|
||||
#call bug2267_1()|
|
||||
#--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
|
||||
#call bug2267_2()|
|
||||
#call bug2267_3()|
|
||||
#call bug2267_4()|
|
||||
#
|
||||
#drop procedure bug2267_1|
|
||||
#drop procedure bug2267_2|
|
||||
#drop procedure bug2267_3|
|
||||
#drop procedure bug2267_4|
|
||||
--disable_parsing
|
||||
--disable_warnings
|
||||
drop procedure if exists bug2267_1|
|
||||
--enable_warnings
|
||||
create procedure bug2267_1()
|
||||
begin
|
||||
show procedure status;
|
||||
end|
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists bug2267_2|
|
||||
--enable_warnings
|
||||
create procedure bug2267_2()
|
||||
begin
|
||||
show function status;
|
||||
end|
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists bug2267_3|
|
||||
--enable_warnings
|
||||
create procedure bug2267_3()
|
||||
begin
|
||||
show create procedure bug2267_1;
|
||||
end|
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists bug2267_4|
|
||||
--enable_warnings
|
||||
create procedure bug2267_4()
|
||||
begin
|
||||
show create function fac;
|
||||
end|
|
||||
|
||||
--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
|
||||
call bug2267_1()|
|
||||
--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
|
||||
call bug2267_2()|
|
||||
call bug2267_3()|
|
||||
call bug2267_4()|
|
||||
|
||||
drop procedure bug2267_1|
|
||||
drop procedure bug2267_2|
|
||||
drop procedure bug2267_3|
|
||||
drop procedure bug2267_4|
|
||||
--enable_parsing
|
||||
|
||||
#
|
||||
# BUG#2227
|
||||
@ -1901,23 +1908,25 @@ drop procedure bug2227|
|
||||
# QQ For this reason we can't run this test any more (i.e., if we modify
|
||||
# QQ it, it's no longer a test case for the bug), but we keep it here
|
||||
# QQ anyway, for tracability.
|
||||
#--disable_warnings
|
||||
#drop procedure if exists bug2614|
|
||||
#--enable_warnings
|
||||
#create procedure bug2614()
|
||||
#begin
|
||||
# drop temporary table if exists t3;
|
||||
# create temporary table t3 (id int default '0' not null);
|
||||
# insert into t3 select 12;
|
||||
# insert into t3 select * from t3;
|
||||
#end|
|
||||
#
|
||||
#--disable_warnings
|
||||
#call bug2614()|
|
||||
#--enable_warnings
|
||||
#call bug2614()|
|
||||
#drop temporary table t3|
|
||||
#drop procedure bug2614|
|
||||
--disable_parsing
|
||||
--disable_warnings
|
||||
drop procedure if exists bug2614|
|
||||
--enable_warnings
|
||||
create procedure bug2614()
|
||||
begin
|
||||
drop temporary table if exists t3;
|
||||
create temporary table t3 (id int default '0' not null);
|
||||
insert into t3 select 12;
|
||||
insert into t3 select * from t3;
|
||||
end|
|
||||
|
||||
--disable_warnings
|
||||
call bug2614()|
|
||||
--enable_warnings
|
||||
call bug2614()|
|
||||
drop temporary table t3|
|
||||
drop procedure bug2614|
|
||||
--enable_parsing
|
||||
|
||||
#
|
||||
# BUG#2674
|
||||
@ -2508,27 +2517,29 @@ drop table t3|
|
||||
# BUG#4318
|
||||
#
|
||||
#QQ Don't know if HANDLER commands can work with SPs, or at all...
|
||||
#--disable_warnings
|
||||
#drop table if exists t3|
|
||||
#--enable_warnings
|
||||
#
|
||||
#create table t3 (s1 int)|
|
||||
#insert into t3 values (3), (4)|
|
||||
#
|
||||
#--disable_warnings
|
||||
#drop procedure if exists bug4318|
|
||||
#--enable_warnings
|
||||
#create procedure bug4318()
|
||||
# handler t3 read next|
|
||||
#
|
||||
#handler t3 open|
|
||||
## Expect no results, as tables are closed, but there shouldn't be any errors
|
||||
#call bug4318()|
|
||||
#call bug4318()|
|
||||
#handler t3 close|
|
||||
#
|
||||
#drop procedure bug4318|
|
||||
#drop table t3|
|
||||
--disable_parsing
|
||||
--disable_warnings
|
||||
drop table if exists t3|
|
||||
--enable_warnings
|
||||
|
||||
create table t3 (s1 int)|
|
||||
insert into t3 values (3), (4)|
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists bug4318|
|
||||
--enable_warnings
|
||||
create procedure bug4318()
|
||||
handler t3 read next|
|
||||
|
||||
handler t3 open|
|
||||
# Expect no results, as tables are closed, but there shouldn't be any errors
|
||||
call bug4318()|
|
||||
call bug4318()|
|
||||
handler t3 close|
|
||||
|
||||
drop procedure bug4318|
|
||||
drop table t3|
|
||||
--enable_parsing
|
||||
|
||||
#
|
||||
# BUG#4902: Stored procedure with SHOW WARNINGS leads to packet error
|
||||
@ -2563,11 +2574,13 @@ begin
|
||||
show variables like 'foo';
|
||||
show warnings;
|
||||
end|
|
||||
#show binlog events;
|
||||
#show storage engines;
|
||||
#show master status;
|
||||
#show slave hosts;
|
||||
#show slave status;
|
||||
--disable_parsing
|
||||
show binlog events;
|
||||
show storage engines;
|
||||
show master status;
|
||||
show slave hosts;
|
||||
show slave status;
|
||||
--enable_parsing
|
||||
|
||||
call bug4902()|
|
||||
call bug4902()|
|
||||
@ -3912,7 +3925,6 @@ drop table t3|
|
||||
#--enable_warnings
|
||||
#create procedure bugNNNN...
|
||||
|
||||
|
||||
# Add bugs above this line. Use existing tables t1 and t2 when
|
||||
# practical, or create table t3, t4 etc temporarily (and drop them).
|
||||
delimiter ;|
|
||||
|
@ -413,8 +413,9 @@ set @@global.error_count=1;
|
||||
# Bug #10351: Setting max_heap_table_size to 4G fails
|
||||
#
|
||||
set @@max_heap_table_size= 4294967296;
|
||||
select @@max_heap_table_size;
|
||||
select @@max_heap_table_size > 0;
|
||||
set global max_heap_table_size= 4294967296;
|
||||
select @@max_heap_table_size;
|
||||
select @@max_heap_table_size > 0;
|
||||
set @@max_heap_table_size= 4294967296;
|
||||
select @@max_heap_table_size;
|
||||
select @@max_heap_table_size > 0;
|
||||
|
||||
|
@ -147,10 +147,11 @@ insert into t1 values (1), (2), (3);
|
||||
create view v1 (a) as select a+1 from t1;
|
||||
create view v2 (a) as select a-1 from t1;
|
||||
|
||||
# WL #2486 should enable these tests
|
||||
#select * from t1 natural left join v1;
|
||||
#select * from v2 natural left join t1;
|
||||
#select * from v2 natural left join v1;
|
||||
--disable_parsing WL #2486 should enable these tests
|
||||
select * from t1 natural left join v1;
|
||||
select * from v2 natural left join t1;
|
||||
select * from v2 natural left join v1;
|
||||
--enable_parsing
|
||||
|
||||
drop view v1, v2;
|
||||
drop table t1;
|
||||
|
@ -96,7 +96,7 @@ my_bool my_init(void)
|
||||
#endif
|
||||
{
|
||||
DBUG_ENTER("my_init");
|
||||
DBUG_PROCESS(my_progname ? my_progname : (char*) "unknown");
|
||||
DBUG_PROCESS((char*) (my_progname ? my_progname : "unknown"));
|
||||
if (!home_dir)
|
||||
{ /* Don't initialize twice */
|
||||
my_win_init();
|
||||
|
@ -28,7 +28,8 @@
|
||||
my_bool timed_mutexes= 0;
|
||||
|
||||
/* from my_init */
|
||||
my_string home_dir=0,my_progname=0;
|
||||
my_string home_dir=0;
|
||||
const char *my_progname=0;
|
||||
char NEAR curr_dir[FN_REFLEN]= {0},
|
||||
NEAR home_dir_buff[FN_REFLEN]= {0};
|
||||
ulong my_stream_opened=0,my_file_opened=0, my_tmp_file_created=0;
|
||||
|
@ -509,7 +509,7 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_OWNER *owner,
|
||||
(*lock->read.last)=data; /* Add to running FIFO */
|
||||
data->prev=lock->read.last;
|
||||
lock->read.last= &data->next;
|
||||
if ((int) lock_type == (int) TL_READ_NO_INSERT)
|
||||
if (lock_type == TL_READ_NO_INSERT)
|
||||
lock->read_no_write_count++;
|
||||
check_locks(lock,"read lock with old write lock",0);
|
||||
if (lock->get_status)
|
||||
@ -535,14 +535,14 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_OWNER *owner,
|
||||
lock->read.last= &data->next;
|
||||
if (lock->get_status)
|
||||
(*lock->get_status)(data->status_param, 0);
|
||||
if ((int) lock_type == (int) TL_READ_NO_INSERT)
|
||||
if (lock_type == TL_READ_NO_INSERT)
|
||||
lock->read_no_write_count++;
|
||||
check_locks(lock,"read lock with no write locks",0);
|
||||
statistic_increment(locks_immediate,&THR_LOCK_lock);
|
||||
goto end;
|
||||
}
|
||||
/*
|
||||
We're here if there is an active write lock or no write
|
||||
We're here if there is an active write lock or no write
|
||||
lock but a high priority write waiting in the write_wait queue.
|
||||
In the latter case we should yield the lock to the writer.
|
||||
*/
|
||||
|
@ -60,11 +60,11 @@ uint calc_days_in_year(uint year)
|
||||
|
||||
SYNOPSIS
|
||||
check_date()
|
||||
ltime - Date to check.
|
||||
not_zero_date - ltime is not the zero date
|
||||
flags - flags to check
|
||||
was_cut - set to whether the value was truncated
|
||||
|
||||
ltime Date to check.
|
||||
not_zero_date ltime is not the zero date
|
||||
flags flags to check
|
||||
was_cut set to 2 if value was truncated.
|
||||
NOTE: This is not touched if value was not truncated
|
||||
NOTES
|
||||
Here we assume that year and month is ok !
|
||||
If month is 0 we allow any date. (This only happens if we allow zero
|
||||
@ -75,10 +75,9 @@ uint calc_days_in_year(uint year)
|
||||
1 error
|
||||
*/
|
||||
|
||||
bool check_date(const MYSQL_TIME *ltime, bool not_zero_date, ulong flags,
|
||||
int *was_cut)
|
||||
static my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date,
|
||||
ulong flags, int *was_cut)
|
||||
{
|
||||
|
||||
if (not_zero_date)
|
||||
{
|
||||
if ((((flags & TIME_NO_ZERO_IN_DATE) || !(flags & TIME_FUZZY_DATE)) &&
|
||||
@ -165,11 +164,11 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
|
||||
uint date[MAX_DATE_PARTS], date_len[MAX_DATE_PARTS];
|
||||
uint add_hours= 0, start_loop;
|
||||
ulong not_zero_date, allow_space;
|
||||
bool is_internal_format;
|
||||
my_bool is_internal_format;
|
||||
const char *pos, *last_field_pos;
|
||||
const char *end=str+length;
|
||||
const uchar *format_position;
|
||||
bool found_delimitier= 0, found_space= 0;
|
||||
my_bool found_delimitier= 0, found_space= 0;
|
||||
uint frac_pos, frac_len;
|
||||
DBUG_ENTER("str_to_datetime");
|
||||
DBUG_PRINT("ENTER",("str: %.*s",length,str));
|
||||
@ -472,12 +471,12 @@ err:
|
||||
1 error
|
||||
*/
|
||||
|
||||
bool str_to_time(const char *str, uint length, MYSQL_TIME *l_time,
|
||||
int *was_cut)
|
||||
my_bool str_to_time(const char *str, uint length, MYSQL_TIME *l_time,
|
||||
int *was_cut)
|
||||
{
|
||||
long date[5],value;
|
||||
const char *end=str+length, *end_of_days;
|
||||
bool found_days,found_hours;
|
||||
my_bool found_days,found_hours;
|
||||
uint state;
|
||||
|
||||
l_time->neg=0;
|
||||
@ -644,7 +643,7 @@ void init_time(void)
|
||||
time_t seconds;
|
||||
struct tm *l_time,tm_tmp;
|
||||
MYSQL_TIME my_time;
|
||||
bool not_used;
|
||||
my_bool not_used;
|
||||
|
||||
seconds= (time_t) time((time_t*) 0);
|
||||
localtime_r(&seconds,&tm_tmp);
|
||||
@ -710,7 +709,8 @@ long calc_daynr(uint year,uint month,uint day)
|
||||
Time in UTC seconds since Unix Epoch representation.
|
||||
*/
|
||||
my_time_t
|
||||
my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, bool *in_dst_time_gap)
|
||||
my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone,
|
||||
my_bool *in_dst_time_gap)
|
||||
{
|
||||
uint loop;
|
||||
time_t tmp;
|
||||
@ -961,11 +961,10 @@ longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
|
||||
return nr;
|
||||
|
||||
/* Don't want to have was_cut get set if NO_ZERO_DATE was violated. */
|
||||
if (!nr && flags & TIME_NO_ZERO_DATE)
|
||||
if (!nr && (flags & TIME_NO_ZERO_DATE))
|
||||
return LL(-1);
|
||||
|
||||
err:
|
||||
|
||||
*was_cut= 1;
|
||||
return LL(-1);
|
||||
}
|
||||
|
22
sql/field.cc
22
sql/field.cc
@ -4468,7 +4468,7 @@ int Field_timestamp::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||
my_time_t tmp= 0;
|
||||
int error;
|
||||
bool have_smth_to_conv;
|
||||
bool in_dst_time_gap;
|
||||
my_bool in_dst_time_gap;
|
||||
THD *thd= table->in_use;
|
||||
|
||||
/* We don't want to store invalid or fuzzy datetime values in TIMESTAMP */
|
||||
@ -4539,14 +4539,14 @@ int Field_timestamp::store(longlong nr)
|
||||
TIME l_time;
|
||||
my_time_t timestamp= 0;
|
||||
int error;
|
||||
bool in_dst_time_gap;
|
||||
my_bool in_dst_time_gap;
|
||||
THD *thd= table->in_use;
|
||||
|
||||
/* We don't want to store invalid or fuzzy datetime values in TIMESTAMP */
|
||||
longlong tmp= number_to_datetime(nr, &l_time, (thd->variables.sql_mode &
|
||||
MODE_NO_ZERO_DATE) |
|
||||
MODE_NO_ZERO_IN_DATE, &error);
|
||||
if (tmp < 0)
|
||||
if (tmp == LL(-1))
|
||||
{
|
||||
error= 2;
|
||||
}
|
||||
@ -5215,7 +5215,7 @@ int Field_date::store(longlong nr)
|
||||
MODE_NO_ZERO_DATE |
|
||||
MODE_INVALID_DATES))), &error);
|
||||
|
||||
if (nr < 0)
|
||||
if (nr == LL(-1))
|
||||
{
|
||||
nr= 0;
|
||||
error= 2;
|
||||
@ -5391,12 +5391,12 @@ int Field_newdate::store(longlong nr)
|
||||
TIME l_time;
|
||||
longlong tmp;
|
||||
int error;
|
||||
if ((tmp= number_to_datetime(nr, &l_time,
|
||||
(TIME_FUZZY_DATE |
|
||||
(table->in_use->variables.sql_mode &
|
||||
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
|
||||
MODE_INVALID_DATES))),
|
||||
&error) < 0))
|
||||
if (number_to_datetime(nr, &l_time,
|
||||
(TIME_FUZZY_DATE |
|
||||
(table->in_use->variables.sql_mode &
|
||||
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
|
||||
MODE_INVALID_DATES))),
|
||||
&error) == LL(-1))
|
||||
{
|
||||
tmp= 0L;
|
||||
error= 2;
|
||||
@ -5593,7 +5593,7 @@ int Field_datetime::store(longlong nr)
|
||||
MODE_NO_ZERO_DATE |
|
||||
MODE_INVALID_DATES))), &error);
|
||||
|
||||
if (nr < 0)
|
||||
if (nr == LL(-1))
|
||||
{
|
||||
nr= 0;
|
||||
error= 2;
|
||||
|
@ -1150,8 +1150,7 @@ class Item_uint :public Item_int
|
||||
{
|
||||
public:
|
||||
Item_uint(const char *str_arg, uint length);
|
||||
Item_uint(uint32 i) :Item_int((ulonglong) i, 10) {}
|
||||
Item_uint(ulong i) :Item_int((ulonglong) i, 10) {}
|
||||
Item_uint(ulonglong i) :Item_int((ulonglong) i, 10) {}
|
||||
Item_uint(const char *str_arg, longlong i, uint length);
|
||||
double val_real()
|
||||
{ DBUG_ASSERT(fixed == 1); return ulonglong2double((ulonglong)value); }
|
||||
|
@ -1070,7 +1070,7 @@ longlong Item_func_year::val_int()
|
||||
longlong Item_func_unix_timestamp::val_int()
|
||||
{
|
||||
TIME ltime;
|
||||
bool not_used;
|
||||
my_bool not_used;
|
||||
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
if (arg_count == 0)
|
||||
@ -1798,7 +1798,6 @@ bool Item_func_convert_tz::get_date(TIME *ltime,
|
||||
uint fuzzy_date __attribute__((unused)))
|
||||
{
|
||||
my_time_t my_time_tmp;
|
||||
bool not_used;
|
||||
String str;
|
||||
|
||||
if (!from_tz_cached)
|
||||
@ -1824,6 +1823,7 @@ bool Item_func_convert_tz::get_date(TIME *ltime,
|
||||
ltime->year==TIMESTAMP_MAX_YEAR && ltime->month==1 && ltime->day==1 ||
|
||||
ltime->year==TIMESTAMP_MIN_YEAR && ltime->month==12 && ltime->day==31)
|
||||
{
|
||||
my_bool not_used;
|
||||
my_time_tmp= from_tz->TIME_to_gmt_sec(ltime, ¬_used);
|
||||
if (my_time_tmp >= TIMESTAMP_MIN_VALUE && my_time_tmp <= TIMESTAMP_MAX_VALUE)
|
||||
to_tz->gmt_sec_to_TIME(ltime, my_time_tmp);
|
||||
|
@ -58,7 +58,11 @@ static handlerton binlog_hton = {
|
||||
binlog_prepare,
|
||||
NULL, /* recover */
|
||||
NULL, /* commit_by_xid */
|
||||
NULL /* rollback_by_xid */
|
||||
NULL, /* rollback_by_xid */
|
||||
NULL, /* create_cursor_read_view */
|
||||
NULL, /* set_cursor_read_view */
|
||||
NULL, /* close_cursor_read_view */
|
||||
HTON_NO_FLAGS
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -823,8 +823,6 @@ bool mysqld_show_column_types(THD *thd);
|
||||
bool mysqld_help (THD *thd, const char *text);
|
||||
void calc_sum_of_all_status(STATUS_VAR *to);
|
||||
|
||||
|
||||
|
||||
/* information schema */
|
||||
extern LEX_STRING information_schema_name;
|
||||
LEX_STRING *make_lex_string(THD *thd, LEX_STRING *lex_str,
|
||||
@ -952,6 +950,7 @@ bool rename_temporary_table(THD* thd, TABLE *table, const char *new_db,
|
||||
const char *table_name);
|
||||
void remove_db_from_cache(const char *db);
|
||||
void flush_tables();
|
||||
bool is_equal(const LEX_STRING *a, const LEX_STRING *b);
|
||||
|
||||
/* bits for last argument to remove_table_from_cache() */
|
||||
#define RTFC_NO_FLAG 0x0000
|
||||
@ -1191,6 +1190,7 @@ extern TABLE *unused_tables;
|
||||
extern I_List<i_string> binlog_do_db, binlog_ignore_db;
|
||||
extern const char* any_db;
|
||||
extern struct my_option my_long_options[];
|
||||
extern const LEX_STRING view_type;
|
||||
|
||||
/* optional things, have_* variables */
|
||||
|
||||
@ -1273,7 +1273,7 @@ ulong convert_period_to_month(ulong period);
|
||||
ulong convert_month_to_period(ulong month);
|
||||
void get_date_from_daynr(long daynr,uint *year, uint *month,
|
||||
uint *day);
|
||||
my_time_t TIME_to_timestamp(THD *thd, const TIME *t, bool *not_exist);
|
||||
my_time_t TIME_to_timestamp(THD *thd, const TIME *t, my_bool *not_exist);
|
||||
bool str_to_time_with_warn(const char *str,uint length,TIME *l_time);
|
||||
timestamp_type str_to_datetime_with_warn(const char *str, uint length,
|
||||
TIME *l_time, uint flags);
|
||||
|
@ -1426,6 +1426,12 @@ bool sys_var_thd_ulong::update(THD *thd, set_var *var)
|
||||
if ((ulong) tmp > max_system_variables.*offset)
|
||||
tmp= max_system_variables.*offset;
|
||||
|
||||
#if SIZEOF_LONG == 4
|
||||
/* Avoid overflows on 32 bit systems */
|
||||
if (tmp > (ulonglong) ~(ulong) 0)
|
||||
tmp= ((ulonglong) ~(ulong) 0);
|
||||
#endif
|
||||
|
||||
if (option_limits)
|
||||
tmp= (ulong) getopt_ull_limit_value(tmp, option_limits);
|
||||
if (var->type == OPT_GLOBAL)
|
||||
@ -1679,7 +1685,7 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
|
||||
pthread_mutex_lock(&LOCK_global_system_variables);
|
||||
value= *(uint*) value_ptr(thd, var_type, base);
|
||||
pthread_mutex_unlock(&LOCK_global_system_variables);
|
||||
return new Item_uint((uint32) value);
|
||||
return new Item_uint((ulonglong) value);
|
||||
}
|
||||
case SHOW_LONG:
|
||||
{
|
||||
@ -1687,7 +1693,7 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
|
||||
pthread_mutex_lock(&LOCK_global_system_variables);
|
||||
value= *(ulong*) value_ptr(thd, var_type, base);
|
||||
pthread_mutex_unlock(&LOCK_global_system_variables);
|
||||
return new Item_uint(value);
|
||||
return new Item_uint((ulonglong) value);
|
||||
}
|
||||
case SHOW_LONGLONG:
|
||||
{
|
||||
|
@ -4258,7 +4258,7 @@ open_new_frm(const char *path, const char *alias,
|
||||
|
||||
if ((parser= sql_parse_prepare(&pathstr, mem_root, 1)))
|
||||
{
|
||||
if (!strncmp("VIEW", parser->type()->str, parser->type()->length))
|
||||
if (is_equal(&view_type, parser->type()))
|
||||
{
|
||||
if (table_desc == 0 || table_desc->required_type == FRMTYPE_TABLE)
|
||||
{
|
||||
@ -4281,3 +4281,9 @@ err:
|
||||
bzero(outparam, sizeof(TABLE)); // do not run repair
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
|
||||
bool is_equal(const LEX_STRING *a, const LEX_STRING *b)
|
||||
{
|
||||
return a->length == b->length && !strncmp(a->str, b->str, a->length);
|
||||
}
|
||||
|
@ -523,6 +523,10 @@ bool THD::store_globals()
|
||||
if this is the slave SQL thread.
|
||||
*/
|
||||
variables.pseudo_thread_id= thread_id;
|
||||
/*
|
||||
We have to call thr_lock_info_init() again here as THD may have been
|
||||
created in another thread
|
||||
*/
|
||||
thr_lock_info_init(&lock_info);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1762,7 +1762,7 @@ Cursor::init_from_thd(THD *thd)
|
||||
for (handlerton **pht= thd->transaction.stmt.ht; *pht; pht++)
|
||||
{
|
||||
const handlerton *ht= *pht;
|
||||
close_at_commit|= (ht->flags & HTON_CLOSE_CURSORS_AT_COMMIT);
|
||||
close_at_commit|= test(ht->flags & HTON_CLOSE_CURSORS_AT_COMMIT);
|
||||
if (ht->create_cursor_read_view)
|
||||
{
|
||||
info->ht= ht;
|
||||
@ -8033,11 +8033,13 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
|
||||
bool table_cant_handle_bit_fields,
|
||||
uint convert_blob_length)
|
||||
{
|
||||
Item *org_item= item;
|
||||
if (item->real_item()->type() == Item::FIELD_ITEM)
|
||||
if (type != Item::FIELD_ITEM &&
|
||||
item->real_item()->type() == Item::FIELD_ITEM &&
|
||||
(item->type() != Item::REF_ITEM ||
|
||||
!((Item_ref *) item)->depended_from))
|
||||
{
|
||||
item= item->real_item();
|
||||
type= item->type();
|
||||
type= Item::FIELD_ITEM;
|
||||
}
|
||||
switch (type) {
|
||||
case Item::SUM_FUNC_ITEM:
|
||||
@ -8051,23 +8053,18 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
|
||||
case Item::FIELD_ITEM:
|
||||
case Item::DEFAULT_VALUE_ITEM:
|
||||
{
|
||||
if (org_item->type() != Item::REF_ITEM ||
|
||||
!((Item_ref *)org_item)->depended_from)
|
||||
{
|
||||
Item_field *field= (Item_field*) item;
|
||||
if (table_cant_handle_bit_fields &&
|
||||
field->field->type() == FIELD_TYPE_BIT)
|
||||
return create_tmp_field_from_item(thd, item, table, copy_func,
|
||||
modify_item, convert_blob_length);
|
||||
return create_tmp_field_from_field(thd, (*from_field= field->field),
|
||||
item->name, table,
|
||||
modify_item ? (Item_field*) item :
|
||||
NULL,
|
||||
convert_blob_length);
|
||||
}
|
||||
else
|
||||
item= org_item;
|
||||
Item_field *field= (Item_field*) item;
|
||||
if (table_cant_handle_bit_fields &&
|
||||
field->field->type() == FIELD_TYPE_BIT)
|
||||
return create_tmp_field_from_item(thd, item, table, copy_func,
|
||||
modify_item, convert_blob_length);
|
||||
return create_tmp_field_from_field(thd, (*from_field= field->field),
|
||||
item->name, table,
|
||||
modify_item ? (Item_field*) item :
|
||||
NULL,
|
||||
convert_blob_length);
|
||||
}
|
||||
/* Fall through */
|
||||
case Item::FUNC_ITEM:
|
||||
case Item::COND_ITEM:
|
||||
case Item::FIELD_AVG_ITEM:
|
||||
@ -10910,13 +10907,13 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
|
||||
usable_keys.set_all();
|
||||
for (ORDER *tmp_order=order; tmp_order ; tmp_order=tmp_order->next)
|
||||
{
|
||||
if ((*tmp_order->item)->real_item()->type() != Item::FIELD_ITEM)
|
||||
Item *item= (*tmp_order->item)->real_item();
|
||||
if (item->type() != Item::FIELD_ITEM)
|
||||
{
|
||||
usable_keys.clear_all();
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
usable_keys.intersect(((Item_field*) (*tmp_order->item)->real_item())->
|
||||
field->part_of_sortkey);
|
||||
usable_keys.intersect(((Item_field*) item)->field->part_of_sortkey);
|
||||
if (usable_keys.is_clear_all())
|
||||
DBUG_RETURN(0); // No usable keys
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables)
|
||||
|
||||
|
||||
/* Trigger must be in the same schema as target table. */
|
||||
if (my_strcasecmp(system_charset_info, table->s->db,
|
||||
if (my_strcasecmp(table_alias_charset, table->s->db,
|
||||
lex->spname->m_db.str ? lex->spname->m_db.str :
|
||||
thd->db))
|
||||
{
|
||||
@ -396,7 +396,7 @@ bool Table_triggers_list::drop_trigger(THD *thd, TABLE_LIST *tables)
|
||||
{
|
||||
it_def++;
|
||||
|
||||
if (my_strcasecmp(system_charset_info, lex->spname->m_name.str,
|
||||
if (my_strcasecmp(table_alias_charset, lex->spname->m_name.str,
|
||||
name->str) == 0)
|
||||
{
|
||||
/*
|
||||
@ -541,8 +541,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
|
||||
|
||||
if ((parser= sql_parse_prepare(&path, &table->mem_root, 1)))
|
||||
{
|
||||
if (!strncmp(triggers_file_type.str, parser->type()->str,
|
||||
parser->type()->length))
|
||||
if (is_equal(&triggers_file_type, parser->type()))
|
||||
{
|
||||
Table_triggers_list *triggers=
|
||||
new (&table->mem_root) Table_triggers_list(table);
|
||||
@ -601,7 +600,8 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
|
||||
|
||||
triggers->bodies[lex.trg_chistics.event]
|
||||
[lex.trg_chistics.action_time]= lex.sphead;
|
||||
if (triggers->names_list.push_back(&lex.sphead->m_name, &table->mem_root))
|
||||
if (triggers->names_list.push_back(&lex.sphead->m_name,
|
||||
&table->mem_root))
|
||||
goto err_with_lex_cleanup;
|
||||
|
||||
if (names_only)
|
||||
@ -615,8 +615,9 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
|
||||
in old/new versions of row in trigger to Field objects in table being
|
||||
opened.
|
||||
|
||||
We ignore errors here, because if even something is wrong we still will
|
||||
be willing to open table to perform some operations (e.g. SELECT)...
|
||||
We ignore errors here, because if even something is wrong we still
|
||||
will be willing to open table to perform some operations
|
||||
(e.g. SELECT)...
|
||||
Anyway some things can be checked only during trigger execution.
|
||||
*/
|
||||
for (Item_trigger_field *trg_field=
|
||||
@ -647,7 +648,7 @@ err_with_lex_cleanup:
|
||||
be merged into .FRM anyway.
|
||||
*/
|
||||
my_error(ER_WRONG_OBJECT, MYF(0),
|
||||
table_name, triggers_file_ext, "TRIGGER");
|
||||
table_name, triggers_file_ext+1, "TRIGGER");
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
@ -726,10 +727,9 @@ static TABLE_LIST *add_table_for_trigger(THD *thd, sp_name *trig)
|
||||
if (!(parser= sql_parse_prepare(&path, thd->mem_root, 1)))
|
||||
DBUG_RETURN(0);
|
||||
|
||||
if (strncmp(trigname_file_type.str, parser->type()->str,
|
||||
parser->type()->length))
|
||||
if (!is_equal(&trigname_file_type, parser->type()))
|
||||
{
|
||||
my_error(ER_WRONG_OBJECT, MYF(0), trig->m_name.str, trigname_file_ext,
|
||||
my_error(ER_WRONG_OBJECT, MYF(0), trig->m_name.str, trigname_file_ext+1,
|
||||
"TRIGGERNAME");
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
@ -24,6 +24,8 @@
|
||||
|
||||
#define MD5_BUFF_LENGTH 33
|
||||
|
||||
const LEX_STRING view_type= { (char*) STRING_WITH_LEN("VIEW") };
|
||||
|
||||
static int mysql_register_view(THD *thd, TABLE_LIST *view,
|
||||
enum_view_create_mode mode);
|
||||
|
||||
@ -431,7 +433,7 @@ static File_option view_parameters[]=
|
||||
FILE_OPTIONS_STRING}
|
||||
};
|
||||
|
||||
static LEX_STRING view_file_type[]= {{(char*)"VIEW", 4}};
|
||||
static LEX_STRING view_file_type[]= {{(char*) STRING_WITH_LEN("VIEW") }};
|
||||
|
||||
|
||||
/*
|
||||
@ -470,7 +472,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
|
||||
thd->variables.sql_mode|= sql_mode;
|
||||
}
|
||||
str.append('\0');
|
||||
DBUG_PRINT("VIEW", ("View: %s", str.ptr()));
|
||||
DBUG_PRINT("info", ("View: %s", str.ptr()));
|
||||
|
||||
/* print file name */
|
||||
(void) my_snprintf(dir_buff, FN_REFLEN, "%s/%s/",
|
||||
@ -507,8 +509,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
|
||||
if (!(parser= sql_parse_prepare(&path, thd->mem_root, 0)))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
if (!parser->ok() ||
|
||||
strncmp("VIEW", parser->type()->str, parser->type()->length))
|
||||
if (!parser->ok() || !is_equal(&view_type, parser->type()))
|
||||
{
|
||||
my_error(ER_WRONG_OBJECT, MYF(0),
|
||||
(view->db ? view->db : thd->db), view->table_name, "VIEW");
|
||||
|
@ -223,7 +223,7 @@ str_to_datetime_with_warn(const char *str, uint length, TIME *l_time,
|
||||
0 - t contains datetime value which is out of TIMESTAMP range.
|
||||
|
||||
*/
|
||||
my_time_t TIME_to_timestamp(THD *thd, const TIME *t, bool *in_dst_time_gap)
|
||||
my_time_t TIME_to_timestamp(THD *thd, const TIME *t, my_bool *in_dst_time_gap)
|
||||
{
|
||||
my_time_t timestamp;
|
||||
|
||||
|
@ -880,12 +880,12 @@ sec_since_epoch(int year, int mon, int mday, int hour, int min ,int sec)
|
||||
0 in case of error.
|
||||
*/
|
||||
static my_time_t
|
||||
TIME_to_gmt_sec(const TIME *t, const TIME_ZONE_INFO *sp, bool *in_dst_time_gap)
|
||||
TIME_to_gmt_sec(const TIME *t, const TIME_ZONE_INFO *sp,
|
||||
my_bool *in_dst_time_gap)
|
||||
{
|
||||
my_time_t local_t;
|
||||
uint saved_seconds;
|
||||
uint i;
|
||||
|
||||
DBUG_ENTER("TIME_to_gmt_sec");
|
||||
|
||||
/* We need this for correct leap seconds handling */
|
||||
@ -962,7 +962,7 @@ class Time_zone_system : public Time_zone
|
||||
{
|
||||
public:
|
||||
virtual my_time_t TIME_to_gmt_sec(const TIME *t,
|
||||
bool *in_dst_time_gap) const;
|
||||
my_bool *in_dst_time_gap) const;
|
||||
virtual void gmt_sec_to_TIME(TIME *tmp, my_time_t t) const;
|
||||
virtual const String * get_name() const;
|
||||
};
|
||||
@ -994,7 +994,7 @@ public:
|
||||
Corresponding my_time_t value or 0 in case of error
|
||||
*/
|
||||
my_time_t
|
||||
Time_zone_system::TIME_to_gmt_sec(const TIME *t, bool *in_dst_time_gap) const
|
||||
Time_zone_system::TIME_to_gmt_sec(const TIME *t, my_bool *in_dst_time_gap) const
|
||||
{
|
||||
long not_used;
|
||||
return my_system_gmt_sec(t, ¬_used, in_dst_time_gap);
|
||||
@ -1055,7 +1055,7 @@ class Time_zone_utc : public Time_zone
|
||||
{
|
||||
public:
|
||||
virtual my_time_t TIME_to_gmt_sec(const TIME *t,
|
||||
bool *in_dst_time_gap) const;
|
||||
my_bool *in_dst_time_gap) const;
|
||||
virtual void gmt_sec_to_TIME(TIME *tmp, my_time_t t) const;
|
||||
virtual const String * get_name() const;
|
||||
};
|
||||
@ -1081,7 +1081,7 @@ public:
|
||||
0
|
||||
*/
|
||||
my_time_t
|
||||
Time_zone_utc::TIME_to_gmt_sec(const TIME *t, bool *in_dst_time_gap) const
|
||||
Time_zone_utc::TIME_to_gmt_sec(const TIME *t, my_bool *in_dst_time_gap) const
|
||||
{
|
||||
/* Should be never called */
|
||||
DBUG_ASSERT(0);
|
||||
@ -1144,7 +1144,7 @@ class Time_zone_db : public Time_zone
|
||||
public:
|
||||
Time_zone_db(TIME_ZONE_INFO *tz_info_arg, const String * tz_name_arg);
|
||||
virtual my_time_t TIME_to_gmt_sec(const TIME *t,
|
||||
bool *in_dst_time_gap) const;
|
||||
my_bool *in_dst_time_gap) const;
|
||||
virtual void gmt_sec_to_TIME(TIME *tmp, my_time_t t) const;
|
||||
virtual const String * get_name() const;
|
||||
private:
|
||||
@ -1193,7 +1193,7 @@ Time_zone_db::Time_zone_db(TIME_ZONE_INFO *tz_info_arg,
|
||||
Corresponding my_time_t value or 0 in case of error
|
||||
*/
|
||||
my_time_t
|
||||
Time_zone_db::TIME_to_gmt_sec(const TIME *t, bool *in_dst_time_gap) const
|
||||
Time_zone_db::TIME_to_gmt_sec(const TIME *t, my_bool *in_dst_time_gap) const
|
||||
{
|
||||
return ::TIME_to_gmt_sec(t, tz_info, in_dst_time_gap);
|
||||
}
|
||||
@ -1240,7 +1240,7 @@ class Time_zone_offset : public Time_zone
|
||||
public:
|
||||
Time_zone_offset(long tz_offset_arg);
|
||||
virtual my_time_t TIME_to_gmt_sec(const TIME *t,
|
||||
bool *in_dst_time_gap) const;
|
||||
my_bool *in_dst_time_gap) const;
|
||||
virtual void gmt_sec_to_TIME(TIME *tmp, my_time_t t) const;
|
||||
virtual const String * get_name() const;
|
||||
/*
|
||||
@ -1292,7 +1292,7 @@ Time_zone_offset::Time_zone_offset(long tz_offset_arg):
|
||||
Corresponding my_time_t value or 0 in case of error
|
||||
*/
|
||||
my_time_t
|
||||
Time_zone_offset::TIME_to_gmt_sec(const TIME *t, bool *in_dst_time_gap) const
|
||||
Time_zone_offset::TIME_to_gmt_sec(const TIME *t, my_bool *in_dst_time_gap) const
|
||||
{
|
||||
return sec_since_epoch(t->year, t->month, t->day,
|
||||
t->hour, t->minute, t->second) -
|
||||
@ -2549,8 +2549,6 @@ main(int argc, char **argv)
|
||||
time_t t, t1, t2;
|
||||
char fullname[FN_REFLEN+1];
|
||||
char *str_end;
|
||||
long not_used;
|
||||
bool not_used_2;
|
||||
MEM_ROOT tz_storage;
|
||||
|
||||
MY_INIT(argv[0]);
|
||||
@ -2660,14 +2658,21 @@ main(int argc, char **argv)
|
||||
dates.
|
||||
*/
|
||||
for (time_tmp.year= 1980; time_tmp.year < 2010; time_tmp.year++)
|
||||
{
|
||||
for (time_tmp.month= 1; time_tmp.month < 13; time_tmp.month++)
|
||||
{
|
||||
for (time_tmp.day= 1;
|
||||
time_tmp.day < mon_lengths[isleap(time_tmp.year)][time_tmp.month-1];
|
||||
time_tmp.day++)
|
||||
{
|
||||
for (time_tmp.hour= 0; time_tmp.hour < 24; time_tmp.hour++)
|
||||
{
|
||||
for (time_tmp.minute= 0; time_tmp.minute < 60; time_tmp.minute+= 5)
|
||||
{
|
||||
for (time_tmp.second=0; time_tmp.second<60; time_tmp.second+=25)
|
||||
{
|
||||
long not_used;
|
||||
my_bool not_used_2;
|
||||
t= (time_t)my_system_gmt_sec(&time_tmp, ¬_used, ¬_used_2);
|
||||
t1= (time_t)TIME_to_gmt_sec(&time_tmp, &tz_info, ¬_used_2);
|
||||
if (t != t1)
|
||||
@ -2699,6 +2704,11 @@ main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("TIME_to_gmt_sec = my_system_gmt_sec for test range\n");
|
||||
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
falls into spring time-gap (or lefts it untouched otherwise).
|
||||
*/
|
||||
virtual my_time_t TIME_to_gmt_sec(const TIME *t,
|
||||
bool *in_dst_time_gap) const = 0;
|
||||
my_bool *in_dst_time_gap) const = 0;
|
||||
/*
|
||||
Converts time in my_time_t representation to local time in
|
||||
broken down TIME representation.
|
||||
|
Loading…
x
Reference in New Issue
Block a user