Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1
into ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.1-marvel mysql-test/t/sp.test: Auto merged mysys/typelib.c: Auto merged sql/event_data_objects.cc: Auto merged sql/event_db_repository.cc: Auto merged sql/event_queue.cc: Auto merged sql/ha_ndbcluster.cc: Auto merged sql/item_func.h: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/set_var.cc: Auto merged sql/sp.cc: Auto merged sql/sp_head.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_view.cc: Auto merged sql/strfunc.cc: Auto merged sql/table.cc: Auto merged include/typelib.h: Merged from 5.1 main tree. mysql-test/r/sp.result: Merged from 5.1 main tree.
This commit is contained in:
commit
67da87d82e
@ -67,5 +67,5 @@ enum options_client
|
|||||||
OPT_SLAP_POST_QUERY,
|
OPT_SLAP_POST_QUERY,
|
||||||
OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID,
|
OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID,
|
||||||
OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT,
|
OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT,
|
||||||
OPT_DEBUG_INFO, OPT_COLUMN_TYPES
|
OPT_DEBUG_INFO, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE
|
||||||
};
|
};
|
||||||
|
@ -885,14 +885,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
opt_nopager= 1;
|
opt_nopager= 1;
|
||||||
break;
|
break;
|
||||||
case OPT_MYSQL_PROTOCOL:
|
case OPT_MYSQL_PROTOCOL:
|
||||||
{
|
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
|
||||||
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
|
opt->name);
|
||||||
{
|
|
||||||
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'A':
|
case 'A':
|
||||||
opt_rehash= 0;
|
opt_rehash= 0;
|
||||||
|
@ -287,15 +287,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case OPT_MYSQL_PROTOCOL:
|
case OPT_MYSQL_PROTOCOL:
|
||||||
{
|
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
|
||||||
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
|
opt->name);
|
||||||
{
|
|
||||||
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
usage();
|
usage();
|
||||||
|
@ -944,14 +944,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
remote_opt= 1;
|
remote_opt= 1;
|
||||||
break;
|
break;
|
||||||
case OPT_MYSQL_PROTOCOL:
|
case OPT_MYSQL_PROTOCOL:
|
||||||
{
|
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
|
||||||
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
|
opt->name);
|
||||||
{
|
|
||||||
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case OPT_START_DATETIME:
|
case OPT_START_DATETIME:
|
||||||
start_datetime= convert_str_to_timestamp(start_datetime_str);
|
start_datetime= convert_str_to_timestamp(start_datetime_str);
|
||||||
break;
|
break;
|
||||||
@ -1104,7 +1099,7 @@ static int dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
|
|||||||
uint logname_len;
|
uint logname_len;
|
||||||
NET* net;
|
NET* net;
|
||||||
int error= 0;
|
int error= 0;
|
||||||
my_off_t old_off= start_position_mot;
|
my_off_t old_off= min(start_position_mot, BIN_LOG_HEADER_SIZE);
|
||||||
char fname[FN_REFLEN+1];
|
char fname[FN_REFLEN+1];
|
||||||
DBUG_ENTER("dump_remote_log_entries");
|
DBUG_ENTER("dump_remote_log_entries");
|
||||||
|
|
||||||
@ -1167,7 +1162,7 @@ could be out of memory");
|
|||||||
}
|
}
|
||||||
if (len < 8 && net->read_pos[0] == 254)
|
if (len < 8 && net->read_pos[0] == 254)
|
||||||
break; // end of data
|
break; // end of data
|
||||||
DBUG_PRINT("info",( "len: %lu, net->read_pos[5]: %d\n",
|
DBUG_PRINT("info",( "len: %lu net->read_pos[5]: %d\n",
|
||||||
len, net->read_pos[5]));
|
len, net->read_pos[5]));
|
||||||
if (!(ev= Log_event::read_log_event((const char*) net->read_pos + 1 ,
|
if (!(ev= Log_event::read_log_event((const char*) net->read_pos + 1 ,
|
||||||
len - 1, &error_msg,
|
len - 1, &error_msg,
|
||||||
@ -1257,8 +1252,15 @@ could be out of memory");
|
|||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
Let's adjust offset for remote log as for local log to produce
|
Let's adjust offset for remote log as for local log to produce
|
||||||
similar text.
|
similar text and to have --stop-position to work identically.
|
||||||
|
|
||||||
|
Exception - the server sends Format_description_log_event
|
||||||
|
in the beginning of the dump, and only after it the event from
|
||||||
|
start_position. Let the old_off reflect it.
|
||||||
*/
|
*/
|
||||||
|
if (old_off < start_position_mot)
|
||||||
|
old_off= start_position_mot;
|
||||||
|
else
|
||||||
old_off+= len-1;
|
old_off+= len-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,15 +310,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
break;
|
break;
|
||||||
case 'V': print_version(); exit(0);
|
case 'V': print_version(); exit(0);
|
||||||
case OPT_MYSQL_PROTOCOL:
|
case OPT_MYSQL_PROTOCOL:
|
||||||
{
|
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
|
||||||
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
|
opt->name);
|
||||||
{
|
|
||||||
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,8 @@ static char *opt_password=0,*current_user=0,
|
|||||||
*lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0,
|
*lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0,
|
||||||
*where=0, *order_by=0,
|
*where=0, *order_by=0,
|
||||||
*opt_compatible_mode_str= 0,
|
*opt_compatible_mode_str= 0,
|
||||||
*err_ptr= 0;
|
*err_ptr= 0,
|
||||||
|
*log_error_file= NULL;
|
||||||
static char **defaults_argv= 0;
|
static char **defaults_argv= 0;
|
||||||
static char compatible_mode_normal_str[255];
|
static char compatible_mode_normal_str[255];
|
||||||
static ulong opt_compatible_mode= 0;
|
static ulong opt_compatible_mode= 0;
|
||||||
@ -121,6 +122,8 @@ static int first_error=0;
|
|||||||
static DYNAMIC_STRING extended_row;
|
static DYNAMIC_STRING extended_row;
|
||||||
#include <sslopt-vars.h>
|
#include <sslopt-vars.h>
|
||||||
FILE *md_result_file= 0;
|
FILE *md_result_file= 0;
|
||||||
|
FILE *stderror_file=0;
|
||||||
|
|
||||||
#ifdef HAVE_SMEM
|
#ifdef HAVE_SMEM
|
||||||
static char *shared_memory_base_name=0;
|
static char *shared_memory_base_name=0;
|
||||||
#endif
|
#endif
|
||||||
@ -307,6 +310,9 @@ static struct my_option my_long_options[] =
|
|||||||
0, 0, 0, 0, 0, 0},
|
0, 0, 0, 0, 0, 0},
|
||||||
{"lock-tables", 'l', "Lock all tables for read.", (gptr*) &lock_tables,
|
{"lock-tables", 'l', "Lock all tables for read.", (gptr*) &lock_tables,
|
||||||
(gptr*) &lock_tables, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
|
(gptr*) &lock_tables, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
|
||||||
|
{"log-error", OPT_ERROR_LOG_FILE, "Append warnings and errors to given file.",
|
||||||
|
(gptr*) &log_error_file, (gptr*) &log_error_file, 0, GET_STR,
|
||||||
|
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"master-data", OPT_MASTER_DATA,
|
{"master-data", OPT_MASTER_DATA,
|
||||||
"This causes the binary log position and filename to be appended to the "
|
"This causes the binary log position and filename to be appended to the "
|
||||||
"output. If equal to 1, will print it as a CHANGE MASTER command; if equal"
|
"output. If equal to 1, will print it as a CHANGE MASTER command; if equal"
|
||||||
@ -790,15 +796,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (int) OPT_MYSQL_PROTOCOL:
|
case (int) OPT_MYSQL_PROTOCOL:
|
||||||
{
|
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
|
||||||
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
|
opt->name);
|
||||||
{
|
|
||||||
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4118,6 +4119,16 @@ int main(int argc, char **argv)
|
|||||||
free_resources(0);
|
free_resources(0);
|
||||||
exit(exit_code);
|
exit(exit_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (log_error_file)
|
||||||
|
{
|
||||||
|
if(!(stderror_file= freopen(log_error_file, "a+", stderr)))
|
||||||
|
{
|
||||||
|
free_resources(0);
|
||||||
|
exit(EX_MYSQLERR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (connect_to_db(current_host, current_user, opt_password))
|
if (connect_to_db(current_host, current_user, opt_password))
|
||||||
{
|
{
|
||||||
free_resources(0);
|
free_resources(0);
|
||||||
@ -4181,5 +4192,9 @@ err:
|
|||||||
if (!path)
|
if (!path)
|
||||||
write_footer(md_result_file);
|
write_footer(md_result_file);
|
||||||
free_resources();
|
free_resources();
|
||||||
|
|
||||||
|
if (stderror_file)
|
||||||
|
fclose(stderror_file);
|
||||||
|
|
||||||
return(first_error);
|
return(first_error);
|
||||||
} /* main */
|
} /* main */
|
||||||
|
@ -231,14 +231,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case OPT_MYSQL_PROTOCOL:
|
case OPT_MYSQL_PROTOCOL:
|
||||||
{
|
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
|
||||||
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
|
opt->name);
|
||||||
{
|
|
||||||
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case '#':
|
case '#':
|
||||||
DBUG_PUSH(argument ? argument : "d:t:o");
|
DBUG_PUSH(argument ? argument : "d:t:o");
|
||||||
break;
|
break;
|
||||||
|
@ -287,14 +287,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case OPT_MYSQL_PROTOCOL:
|
case OPT_MYSQL_PROTOCOL:
|
||||||
{
|
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
|
||||||
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
|
opt->name);
|
||||||
{
|
|
||||||
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case '#':
|
case '#':
|
||||||
DBUG_PUSH(argument ? argument : "d:t:o");
|
DBUG_PUSH(argument ? argument : "d:t:o");
|
||||||
break;
|
break;
|
||||||
|
@ -689,14 +689,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case OPT_MYSQL_PROTOCOL:
|
case OPT_MYSQL_PROTOCOL:
|
||||||
{
|
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
|
||||||
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
|
opt->name);
|
||||||
{
|
|
||||||
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case '#':
|
case '#':
|
||||||
DBUG_PUSH(argument ? argument : default_dbug_option);
|
DBUG_PUSH(argument ? argument : default_dbug_option);
|
||||||
break;
|
break;
|
||||||
|
@ -51,8 +51,6 @@ typedef long my_time_t;
|
|||||||
|
|
||||||
/* two-digit years < this are 20..; >= this are 19.. */
|
/* two-digit years < this are 20..; >= this are 19.. */
|
||||||
#define YY_PART_YEAR 70
|
#define YY_PART_YEAR 70
|
||||||
/* apply above magic to years < this */
|
|
||||||
#define YY_MAGIC_BELOW 200
|
|
||||||
|
|
||||||
/* Flags to str_to_datetime */
|
/* Flags to str_to_datetime */
|
||||||
#define TIME_FUZZY_DATE 1
|
#define TIME_FUZZY_DATE 1
|
||||||
@ -93,6 +91,7 @@ int check_time_range(struct st_mysql_time *, int *warning);
|
|||||||
|
|
||||||
long calc_daynr(uint year,uint month,uint day);
|
long calc_daynr(uint year,uint month,uint day);
|
||||||
uint calc_days_in_year(uint year);
|
uint calc_days_in_year(uint year);
|
||||||
|
uint year_2000_handling(uint year);
|
||||||
|
|
||||||
void init_time(void);
|
void init_time(void);
|
||||||
|
|
||||||
|
@ -26,8 +26,9 @@ typedef struct st_typelib { /* Different types saved here */
|
|||||||
unsigned int *type_lengths;
|
unsigned int *type_lengths;
|
||||||
} TYPELIB;
|
} TYPELIB;
|
||||||
|
|
||||||
extern int find_type(char *x, const TYPELIB *typelib,
|
extern int find_type_or_exit(const char *x, TYPELIB *typelib,
|
||||||
unsigned int full_name);
|
const char *option);
|
||||||
|
extern int find_type(char *x, const TYPELIB *typelib, unsigned int full_name);
|
||||||
extern void make_type(char *to,unsigned int nr,TYPELIB *typelib);
|
extern void make_type(char *to,unsigned int nr,TYPELIB *typelib);
|
||||||
extern const char *get_type(TYPELIB *typelib,unsigned int nr);
|
extern const char *get_type(TYPELIB *typelib,unsigned int nr);
|
||||||
extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from);
|
extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from);
|
||||||
|
@ -91,6 +91,8 @@ create table t1 (date char(30), format char(30) not null);
|
|||||||
insert into t1 values
|
insert into t1 values
|
||||||
('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'),
|
('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'),
|
||||||
('03-01-02 8:11:2.123456', '%y-%m-%d %H:%i:%S.%#'),
|
('03-01-02 8:11:2.123456', '%y-%m-%d %H:%i:%S.%#'),
|
||||||
|
('0003-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'),
|
||||||
|
('03-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'),
|
||||||
('2003-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p'),
|
('2003-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p'),
|
||||||
('2003-01-02 01:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f%p'),
|
('2003-01-02 01:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f%p'),
|
||||||
('2003-01-02 02:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f %p'),
|
('2003-01-02 02:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f %p'),
|
||||||
@ -122,6 +124,8 @@ select date,format,str_to_date(date, format) as str_to_date from t1;
|
|||||||
date format str_to_date
|
date format str_to_date
|
||||||
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12
|
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12
|
||||||
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
|
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
|
||||||
|
0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02 08:11:02
|
||||||
|
03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
|
||||||
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
|
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
|
||||||
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450
|
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450
|
||||||
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450
|
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450
|
||||||
@ -153,6 +157,8 @@ select date,format,concat('',str_to_date(date, format)) as con from t1;
|
|||||||
date format con
|
date format con
|
||||||
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12
|
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12
|
||||||
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
|
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
|
||||||
|
0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02 08:11:02
|
||||||
|
03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
|
||||||
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
|
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
|
||||||
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450
|
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450
|
||||||
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450
|
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450
|
||||||
@ -184,6 +190,8 @@ select date,format,cast(str_to_date(date, format) as datetime) as datetime from
|
|||||||
date format datetime
|
date format datetime
|
||||||
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12
|
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12
|
||||||
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
|
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
|
||||||
|
0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02 08:11:02
|
||||||
|
03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
|
||||||
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
|
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
|
||||||
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450
|
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450
|
||||||
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450
|
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450
|
||||||
@ -222,6 +230,8 @@ select date,format,DATE(str_to_date(date, format)) as date2 from t1;
|
|||||||
date format date2
|
date format date2
|
||||||
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02
|
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02
|
||||||
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02
|
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02
|
||||||
|
0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02
|
||||||
|
03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02
|
||||||
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02
|
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02
|
||||||
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02
|
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02
|
||||||
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02
|
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02
|
||||||
@ -253,6 +263,8 @@ select date,format,TIME(str_to_date(date, format)) as time from t1;
|
|||||||
date format time
|
date format time
|
||||||
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12
|
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12
|
||||||
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 08:11:02
|
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 08:11:02
|
||||||
|
0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02
|
||||||
|
03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02
|
||||||
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 22:11:12
|
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 22:11:12
|
||||||
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 01:11:12.123450
|
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 01:11:12.123450
|
||||||
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450
|
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450
|
||||||
@ -291,6 +303,8 @@ select date,format,concat(TIME(str_to_date(date, format))) as time2 from t1;
|
|||||||
date format time2
|
date format time2
|
||||||
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12
|
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12
|
||||||
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 08:11:02
|
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 08:11:02
|
||||||
|
0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02
|
||||||
|
03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02
|
||||||
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 22:11:12
|
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 22:11:12
|
||||||
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 01:11:12.123450
|
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 01:11:12.123450
|
||||||
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450
|
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450
|
||||||
@ -423,14 +437,14 @@ select date,format,str_to_date(date, format) as str_to_date from t1;
|
|||||||
date format str_to_date
|
date format str_to_date
|
||||||
10:20:10AM %h:%i:%s 0000-00-00 10:20:10
|
10:20:10AM %h:%i:%s 0000-00-00 10:20:10
|
||||||
2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12
|
2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12
|
||||||
03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 0003-01-02 22:11:12
|
03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect datetime value: '10:20:10AM'
|
Warning 1292 Incorrect datetime value: '10:20:10AM'
|
||||||
select date,format,concat(str_to_date(date, format),'') as con from t1;
|
select date,format,concat(str_to_date(date, format),'') as con from t1;
|
||||||
date format con
|
date format con
|
||||||
10:20:10AM %h:%i:%s 0000-00-00 10:20:10
|
10:20:10AM %h:%i:%s 0000-00-00 10:20:10
|
||||||
2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12
|
2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12
|
||||||
03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 0003-01-02 22:11:12
|
03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect datetime value: '10:20:10AM'
|
Warning 1292 Incorrect datetime value: '10:20:10AM'
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@ -75,6 +75,12 @@ NULL
|
|||||||
select weekofyear("1997-11-30 23:59:59.000001");
|
select weekofyear("1997-11-30 23:59:59.000001");
|
||||||
weekofyear("1997-11-30 23:59:59.000001")
|
weekofyear("1997-11-30 23:59:59.000001")
|
||||||
48
|
48
|
||||||
|
select makedate(03,1);
|
||||||
|
makedate(03,1)
|
||||||
|
2003-01-01
|
||||||
|
select makedate('0003',1);
|
||||||
|
makedate('0003',1)
|
||||||
|
2003-01-01
|
||||||
select makedate(1997,1);
|
select makedate(1997,1);
|
||||||
makedate(1997,1)
|
makedate(1997,1)
|
||||||
1997-01-01
|
1997-01-01
|
||||||
|
@ -1225,13 +1225,13 @@ TIME_FORMAT(SEC_TO_TIME(a),"%H:%i:%s")
|
|||||||
End of 5.0 tests
|
End of 5.0 tests
|
||||||
select date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND);
|
select date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND);
|
||||||
date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND)
|
date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND)
|
||||||
NULL
|
0049-12-31 23:59:59
|
||||||
select date_sub("0199-01-01 00:00:01",INTERVAL 2 SECOND);
|
select date_sub("0199-01-01 00:00:01",INTERVAL 2 SECOND);
|
||||||
date_sub("0199-01-01 00:00:01",INTERVAL 2 SECOND)
|
date_sub("0199-01-01 00:00:01",INTERVAL 2 SECOND)
|
||||||
NULL
|
0198-12-31 23:59:59
|
||||||
select date_add("0199-12-31 23:59:59",INTERVAL 2 SECOND);
|
select date_add("0199-12-31 23:59:59",INTERVAL 2 SECOND);
|
||||||
date_add("0199-12-31 23:59:59",INTERVAL 2 SECOND)
|
date_add("0199-12-31 23:59:59",INTERVAL 2 SECOND)
|
||||||
NULL
|
0200-01-01 00:00:01
|
||||||
select date_sub("0200-01-01 00:00:01",INTERVAL 2 SECOND);
|
select date_sub("0200-01-01 00:00:01",INTERVAL 2 SECOND);
|
||||||
date_sub("0200-01-01 00:00:01",INTERVAL 2 SECOND)
|
date_sub("0200-01-01 00:00:01",INTERVAL 2 SECOND)
|
||||||
0199-12-31 23:59:59
|
0199-12-31 23:59:59
|
||||||
@ -1252,8 +1252,8 @@ date_sub("90-01-01 00:00:01",INTERVAL 2 SECOND)
|
|||||||
1989-12-31 23:59:59
|
1989-12-31 23:59:59
|
||||||
select date_sub("0069-01-01 00:00:01",INTERVAL 2 SECOND);
|
select date_sub("0069-01-01 00:00:01",INTERVAL 2 SECOND);
|
||||||
date_sub("0069-01-01 00:00:01",INTERVAL 2 SECOND)
|
date_sub("0069-01-01 00:00:01",INTERVAL 2 SECOND)
|
||||||
NULL
|
0068-12-31 23:59:59
|
||||||
select date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND);
|
select date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND);
|
||||||
date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND)
|
date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND)
|
||||||
NULL
|
0168-12-31 23:59:59
|
||||||
End of 5.1 tests
|
End of 5.1 tests
|
||||||
|
@ -260,29 +260,29 @@ GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' IDENTIFIED BY PASSWORD '*2470C0C
|
|||||||
GRANT SELECT, INSERT, UPDATE ON `test`.* TO 'mysqltest_1'@'localhost'
|
GRANT SELECT, INSERT, UPDATE ON `test`.* TO 'mysqltest_1'@'localhost'
|
||||||
drop user mysqltest_1@localhost;
|
drop user mysqltest_1@localhost;
|
||||||
SET NAMES koi8r;
|
SET NAMES koi8r;
|
||||||
CREATE DATABASE ÂÄ;
|
CREATE DATABASE ツト;
|
||||||
USE ÂÄ;
|
USE ツト;
|
||||||
CREATE TABLE ÔÁÂ (ËÏÌ int);
|
CREATE TABLE ヤチツ (ヒマフ int);
|
||||||
GRANT SELECT ON ÂÄ.* TO ÀÚÅÒ@localhost;
|
GRANT SELECT ON ツト.* TO タレナメ@localhost;
|
||||||
SHOW GRANTS FOR ÀÚÅÒ@localhost;
|
SHOW GRANTS FOR タレナメ@localhost;
|
||||||
Grants for ÀÚÅÒ@localhost
|
Grants for タレナメ@localhost
|
||||||
GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
|
GRANT USAGE ON *.* TO 'タレナメ'@'localhost'
|
||||||
GRANT SELECT ON `ÂÄ`.* TO 'ÀÚÅÒ'@'localhost'
|
GRANT SELECT ON `ツト`.* TO 'タレナメ'@'localhost'
|
||||||
REVOKE SELECT ON ÂÄ.* FROM ÀÚÅÒ@localhost;
|
REVOKE SELECT ON ツト.* FROM タレナメ@localhost;
|
||||||
GRANT SELECT ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
|
GRANT SELECT ON ツト.ヤチツ TO タレナメ@localhost;
|
||||||
SHOW GRANTS FOR ÀÚÅÒ@localhost;
|
SHOW GRANTS FOR タレナメ@localhost;
|
||||||
Grants for ÀÚÅÒ@localhost
|
Grants for タレナメ@localhost
|
||||||
GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
|
GRANT USAGE ON *.* TO 'タレナメ'@'localhost'
|
||||||
GRANT SELECT ON `ÂÄ`.`ÔÁÂ` TO 'ÀÚÅÒ'@'localhost'
|
GRANT SELECT ON `ツト`.`ヤチツ` TO 'タレナメ'@'localhost'
|
||||||
REVOKE SELECT ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
|
REVOKE SELECT ON ツト.ヤチツ FROM タレナメ@localhost;
|
||||||
GRANT SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
|
GRANT SELECT (ヒマフ) ON ツト.ヤチツ TO タレナメ@localhost;
|
||||||
SHOW GRANTS FOR ÀÚÅÒ@localhost;
|
SHOW GRANTS FOR タレナメ@localhost;
|
||||||
Grants for ÀÚÅÒ@localhost
|
Grants for タレナメ@localhost
|
||||||
GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
|
GRANT USAGE ON *.* TO 'タレナメ'@'localhost'
|
||||||
GRANT SELECT (ËÏÌ) ON `ÂÄ`.`ÔÁÂ` TO 'ÀÚÅÒ'@'localhost'
|
GRANT SELECT (ヒマフ) ON `ツト`.`ヤチツ` TO 'タレナメ'@'localhost'
|
||||||
REVOKE SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
|
REVOKE SELECT (ヒマフ) ON ツト.ヤチツ FROM タレナメ@localhost;
|
||||||
DROP USER ÀÚÅÒ@localhost;
|
DROP USER タレナメ@localhost;
|
||||||
DROP DATABASE ÂÄ;
|
DROP DATABASE ツト;
|
||||||
SET NAMES latin1;
|
SET NAMES latin1;
|
||||||
USE test;
|
USE test;
|
||||||
CREATE TABLE t1 (a int );
|
CREATE TABLE t1 (a int );
|
||||||
@ -613,22 +613,22 @@ set @user123="non-existent";
|
|||||||
select * from mysql.db where user=@user123;
|
select * from mysql.db where user=@user123;
|
||||||
Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv Event_priv Trigger_priv
|
Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv Event_priv Trigger_priv
|
||||||
set names koi8r;
|
set names koi8r;
|
||||||
create database ÂÄ;
|
create database ツト;
|
||||||
grant select on ÂÄ.* to root@localhost;
|
grant select on ツト.* to root@localhost;
|
||||||
select hex(Db) from mysql.db where Db='ÂÄ';
|
select hex(Db) from mysql.db where Db='ツト';
|
||||||
hex(Db)
|
hex(Db)
|
||||||
D0B1D0B4
|
D0B1D0B4
|
||||||
show grants for root@localhost;
|
show grants for root@localhost;
|
||||||
Grants for root@localhost
|
Grants for root@localhost
|
||||||
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
|
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
|
||||||
GRANT SELECT ON `ÂÄ`.* TO 'root'@'localhost'
|
GRANT SELECT ON `ツト`.* TO 'root'@'localhost'
|
||||||
flush privileges;
|
flush privileges;
|
||||||
show grants for root@localhost;
|
show grants for root@localhost;
|
||||||
Grants for root@localhost
|
Grants for root@localhost
|
||||||
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
|
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
|
||||||
GRANT SELECT ON `ÂÄ`.* TO 'root'@'localhost'
|
GRANT SELECT ON `ツト`.* TO 'root'@'localhost'
|
||||||
drop database ÂÄ;
|
drop database ツト;
|
||||||
revoke all privileges on ÂÄ.* from root@localhost;
|
revoke all privileges on ツト.* from root@localhost;
|
||||||
show grants for root@localhost;
|
show grants for root@localhost;
|
||||||
Grants for root@localhost
|
Grants for root@localhost
|
||||||
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
|
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
|
||||||
@ -1059,4 +1059,51 @@ DROP DATABASE bug23556;
|
|||||||
DROP USER bug23556@localhost;
|
DROP USER bug23556@localhost;
|
||||||
GRANT PROCESS ON * TO user@localhost;
|
GRANT PROCESS ON * TO user@localhost;
|
||||||
ERROR 3D000: No database selected
|
ERROR 3D000: No database selected
|
||||||
|
DROP DATABASE IF EXISTS mysqltest1;
|
||||||
|
DROP DATABASE IF EXISTS mysqltest2;
|
||||||
|
DROP DATABASE IF EXISTS mysqltest3;
|
||||||
|
DROP DATABASE IF EXISTS mysqltest4;
|
||||||
|
CREATE DATABASE mysqltest1;
|
||||||
|
CREATE DATABASE mysqltest2;
|
||||||
|
CREATE DATABASE mysqltest3;
|
||||||
|
CREATE DATABASE mysqltest4;
|
||||||
|
CREATE PROCEDURE mysqltest1.p_def() SQL SECURITY DEFINER
|
||||||
|
SELECT 1;
|
||||||
|
CREATE PROCEDURE mysqltest2.p_inv() SQL SECURITY INVOKER
|
||||||
|
SELECT 1;
|
||||||
|
CREATE FUNCTION mysqltest3.f_def() RETURNS INT SQL SECURITY DEFINER
|
||||||
|
RETURN 1;
|
||||||
|
CREATE FUNCTION mysqltest4.f_inv() RETURNS INT SQL SECURITY INVOKER
|
||||||
|
RETURN 1;
|
||||||
|
GRANT EXECUTE ON PROCEDURE mysqltest1.p_def TO mysqltest_1@localhost;
|
||||||
|
GRANT EXECUTE ON PROCEDURE mysqltest2.p_inv TO mysqltest_1@localhost;
|
||||||
|
GRANT EXECUTE ON FUNCTION mysqltest3.f_def TO mysqltest_1@localhost;
|
||||||
|
GRANT EXECUTE ON FUNCTION mysqltest4.f_inv TO mysqltest_1@localhost;
|
||||||
|
GRANT ALL PRIVILEGES ON test.* TO mysqltest_1@localhost;
|
||||||
|
|
||||||
|
---> connection: bug9504_con1
|
||||||
|
use mysqltest1;
|
||||||
|
use mysqltest2;
|
||||||
|
use mysqltest3;
|
||||||
|
use mysqltest4;
|
||||||
|
use test;
|
||||||
|
CALL mysqltest1.p_def();
|
||||||
|
1
|
||||||
|
1
|
||||||
|
CALL mysqltest2.p_inv();
|
||||||
|
1
|
||||||
|
1
|
||||||
|
SELECT mysqltest3.f_def();
|
||||||
|
mysqltest3.f_def()
|
||||||
|
1
|
||||||
|
SELECT mysqltest4.f_inv();
|
||||||
|
mysqltest4.f_inv()
|
||||||
|
1
|
||||||
|
|
||||||
|
---> connection: default
|
||||||
|
DROP DATABASE mysqltest1;
|
||||||
|
DROP DATABASE mysqltest2;
|
||||||
|
DROP DATABASE mysqltest3;
|
||||||
|
DROP DATABASE mysqltest4;
|
||||||
|
DROP USER mysqltest_1@localhost;
|
||||||
End of 5.0 tests
|
End of 5.0 tests
|
||||||
|
@ -117,16 +117,82 @@ use testdb_1;
|
|||||||
create table t1 (f1 char(4));
|
create table t1 (f1 char(4));
|
||||||
create view v1 as select f1 from t1;
|
create view v1 as select f1 from t1;
|
||||||
grant insert on v1 to testdb_2@localhost;
|
grant insert on v1 to testdb_2@localhost;
|
||||||
|
create view v5 as select f1 from t1;
|
||||||
|
grant show view on v5 to testdb_2@localhost;
|
||||||
|
create definer=`no_such_user`@`no_such_host` view v6 as select f1 from t1;
|
||||||
|
ERROR 42000: Access denied; you need the SUPER privilege for this operation
|
||||||
|
use testdb_1;
|
||||||
|
create view v6 as select f1 from t1;
|
||||||
|
grant show view on v6 to testdb_2@localhost;
|
||||||
|
create table t2 (f1 char(4));
|
||||||
|
create definer=`no_such_user`@`no_such_host` view v7 as select * from t2;
|
||||||
|
Warnings:
|
||||||
|
Note 1449 There is no 'no_such_user'@'no_such_host' registered
|
||||||
|
show fields from testdb_1.v6;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
f1 char(4) YES NULL
|
||||||
|
show create view testdb_1.v6;
|
||||||
|
View Create View
|
||||||
|
v6 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v6` AS select `t1`.`f1` AS `f1` from `t1`
|
||||||
|
show create view testdb_1.v7;
|
||||||
|
View Create View
|
||||||
|
v7 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v7` AS select `testdb_1`.`t2`.`f1` AS `f1` from `t2`
|
||||||
|
Warnings:
|
||||||
|
Warning 1356 View 'testdb_1.v7' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||||
|
show fields from testdb_1.v7;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
f1 null YES NULL
|
||||||
|
Warnings:
|
||||||
|
Note 1449 There is no 'no_such_user'@'no_such_host' registered
|
||||||
create table t3 (f1 char(4), f2 char(4));
|
create table t3 (f1 char(4), f2 char(4));
|
||||||
create view v3 as select f1,f2 from t3;
|
create view v3 as select f1,f2 from t3;
|
||||||
grant insert(f1), insert(f2) on v3 to testdb_2@localhost;
|
grant insert(f1), insert(f2) on v3 to testdb_2@localhost;
|
||||||
create view v2 as select f1 from testdb_1.v1;
|
create view v2 as select f1 from testdb_1.v1;
|
||||||
create view v4 as select f1,f2 from testdb_1.v3;
|
create view v4 as select f1,f2 from testdb_1.v3;
|
||||||
|
show fields from testdb_1.v5;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
f1 char(4) YES NULL
|
||||||
|
show create view testdb_1.v5;
|
||||||
|
View Create View
|
||||||
|
v5 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_1`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v5` AS select `testdb_1`.`t1`.`f1` AS `f1` from `testdb_1`.`t1`
|
||||||
|
show fields from testdb_1.v6;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
f1 char(4) YES NULL
|
||||||
|
show create view testdb_1.v6;
|
||||||
|
View Create View
|
||||||
|
v6 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v6` AS select `testdb_1`.`t1`.`f1` AS `f1` from `testdb_1`.`t1`
|
||||||
|
show fields from testdb_1.v7;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
f1 null YES NULL
|
||||||
|
Warnings:
|
||||||
|
Note 1449 There is no 'no_such_user'@'no_such_host' registered
|
||||||
|
show create view testdb_1.v7;
|
||||||
|
View Create View
|
||||||
|
v7 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v7` AS select `testdb_1`.`t2`.`f1` AS `f1` from `t2`
|
||||||
|
Warnings:
|
||||||
|
Warning 1356 View 'testdb_1.v7' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||||
revoke insert(f1) on v3 from testdb_2@localhost;
|
revoke insert(f1) on v3 from testdb_2@localhost;
|
||||||
|
revoke show view on v5 from testdb_2@localhost;
|
||||||
|
use testdb_1;
|
||||||
|
revoke show view on v6 from testdb_2@localhost;
|
||||||
|
show fields from testdb_1.v5;
|
||||||
|
ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v5'
|
||||||
|
show create view testdb_1.v5;
|
||||||
|
ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v5'
|
||||||
|
show fields from testdb_1.v6;
|
||||||
|
ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v6'
|
||||||
|
show create view testdb_1.v6;
|
||||||
|
ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v6'
|
||||||
|
show fields from testdb_1.v7;
|
||||||
|
ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v7'
|
||||||
|
show create view testdb_1.v7;
|
||||||
|
ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v7'
|
||||||
show create view v4;
|
show create view v4;
|
||||||
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
|
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
|
||||||
show fields from v4;
|
show fields from v4;
|
||||||
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
|
Field Type Null Key Default Extra
|
||||||
|
f1 null YES NULL
|
||||||
|
f2 char(4) YES NULL
|
||||||
show fields from v2;
|
show fields from v2;
|
||||||
Field Type Null Key Default Extra
|
Field Type Null Key Default Extra
|
||||||
f1 char(4) YES NULL
|
f1 char(4) YES NULL
|
||||||
@ -151,6 +217,7 @@ where a.table_name = 'testdb_1.v1';
|
|||||||
view_definition
|
view_definition
|
||||||
select * from v2;
|
select * from v2;
|
||||||
ERROR HY000: View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
ERROR HY000: View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||||
|
use test;
|
||||||
drop view testdb_1.v1, v2, testdb_1.v3, v4;
|
drop view testdb_1.v1, v2, testdb_1.v3, v4;
|
||||||
drop database testdb_1;
|
drop database testdb_1;
|
||||||
drop user testdb_1@localhost;
|
drop user testdb_1@localhost;
|
||||||
|
@ -7,3 +7,4 @@ SOCKET
|
|||||||
ERROR 2047 (HY000): Wrong or unknown protocol
|
ERROR 2047 (HY000): Wrong or unknown protocol
|
||||||
ERROR 2047 (HY000): Wrong or unknown protocol
|
ERROR 2047 (HY000): Wrong or unknown protocol
|
||||||
Unknown option to protocol: NullS
|
Unknown option to protocol: NullS
|
||||||
|
Alternatives are: 'TCP','SOCKET','PIPE','MEMORY'
|
||||||
|
@ -122,6 +122,24 @@ DELIMITER ;
|
|||||||
ROLLBACK /* added by mysqlbinlog */;
|
ROLLBACK /* added by mysqlbinlog */;
|
||||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||||
|
|
||||||
|
--- start and stop positions ---
|
||||||
|
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||||
|
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
||||||
|
DELIMITER /*!*/;
|
||||||
|
SET INSERT_ID=4/*!*/;
|
||||||
|
use test/*!*/;
|
||||||
|
SET TIMESTAMP=1579609946/*!*/;
|
||||||
|
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/*!*/;
|
||||||
|
insert into t1 values(null, "d")/*!*/;
|
||||||
|
SET INSERT_ID=5/*!*/;
|
||||||
|
DELIMITER ;
|
||||||
|
# End of log file
|
||||||
|
ROLLBACK /* added by mysqlbinlog */;
|
||||||
|
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||||
|
|
||||||
--- start-datetime --
|
--- start-datetime --
|
||||||
/*!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*/;
|
||||||
@ -482,6 +500,24 @@ DELIMITER ;
|
|||||||
ROLLBACK /* added by mysqlbinlog */;
|
ROLLBACK /* added by mysqlbinlog */;
|
||||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||||
|
|
||||||
|
--- start and stop positions ---
|
||||||
|
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||||
|
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
||||||
|
DELIMITER /*!*/;
|
||||||
|
SET INSERT_ID=4/*!*/;
|
||||||
|
use test/*!*/;
|
||||||
|
SET TIMESTAMP=1579609946/*!*/;
|
||||||
|
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/*!*/;
|
||||||
|
insert into t1 values(null, "d")/*!*/;
|
||||||
|
SET INSERT_ID=5/*!*/;
|
||||||
|
DELIMITER ;
|
||||||
|
# End of log file
|
||||||
|
ROLLBACK /* added by mysqlbinlog */;
|
||||||
|
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||||
|
|
||||||
--- start-datetime --
|
--- start-datetime --
|
||||||
/*!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*/;
|
||||||
|
@ -2961,20 +2961,26 @@ delete from t9 ;
|
|||||||
test_sequence
|
test_sequence
|
||||||
-- insert into date/time columns --
|
-- insert into date/time columns --
|
||||||
Warnings:
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
Warnings:
|
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
|
||||||
Warnings:
|
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
|
||||||
Warnings:
|
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value for column 'c13' at row 1
|
Warning 1264 Out of range value for column 'c13' at row 1
|
||||||
@ -3005,6 +3011,7 @@ Warning 1265 Data truncated for column 'c15' at row 1
|
|||||||
Warning 1264 Out of range value for column 'c16' at row 1
|
Warning 1264 Out of range value for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value for column 'c16' at row 1
|
Warning 1264 Out of range value for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
|
@ -2944,20 +2944,26 @@ delete from t9 ;
|
|||||||
test_sequence
|
test_sequence
|
||||||
-- insert into date/time columns --
|
-- insert into date/time columns --
|
||||||
Warnings:
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
Warnings:
|
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
|
||||||
Warnings:
|
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
|
||||||
Warnings:
|
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value for column 'c13' at row 1
|
Warning 1264 Out of range value for column 'c13' at row 1
|
||||||
@ -2988,6 +2994,7 @@ Warning 1265 Data truncated for column 'c15' at row 1
|
|||||||
Warning 1264 Out of range value for column 'c16' at row 1
|
Warning 1264 Out of range value for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value for column 'c16' at row 1
|
Warning 1264 Out of range value for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
|
@ -2945,20 +2945,26 @@ delete from t9 ;
|
|||||||
test_sequence
|
test_sequence
|
||||||
-- insert into date/time columns --
|
-- insert into date/time columns --
|
||||||
Warnings:
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
Warnings:
|
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
|
||||||
Warnings:
|
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
|
||||||
Warnings:
|
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value for column 'c13' at row 1
|
Warning 1264 Out of range value for column 'c13' at row 1
|
||||||
@ -2989,6 +2995,7 @@ Warning 1265 Data truncated for column 'c15' at row 1
|
|||||||
Warning 1264 Out of range value for column 'c16' at row 1
|
Warning 1264 Out of range value for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value for column 'c16' at row 1
|
Warning 1264 Out of range value for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
|
@ -2881,20 +2881,26 @@ delete from t9 ;
|
|||||||
test_sequence
|
test_sequence
|
||||||
-- insert into date/time columns --
|
-- insert into date/time columns --
|
||||||
Warnings:
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
Warnings:
|
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
|
||||||
Warnings:
|
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
|
||||||
Warnings:
|
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value for column 'c13' at row 1
|
Warning 1264 Out of range value for column 'c13' at row 1
|
||||||
@ -2925,6 +2931,7 @@ Warning 1265 Data truncated for column 'c15' at row 1
|
|||||||
Warning 1264 Out of range value for column 'c16' at row 1
|
Warning 1264 Out of range value for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value for column 'c16' at row 1
|
Warning 1264 Out of range value for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
@ -5895,20 +5902,26 @@ delete from t9 ;
|
|||||||
test_sequence
|
test_sequence
|
||||||
-- insert into date/time columns --
|
-- insert into date/time columns --
|
||||||
Warnings:
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
Warnings:
|
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
|
||||||
Warnings:
|
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
|
||||||
Warnings:
|
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value for column 'c13' at row 1
|
Warning 1264 Out of range value for column 'c13' at row 1
|
||||||
@ -5939,6 +5952,7 @@ Warning 1265 Data truncated for column 'c15' at row 1
|
|||||||
Warning 1264 Out of range value for column 'c16' at row 1
|
Warning 1264 Out of range value for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value for column 'c16' at row 1
|
Warning 1264 Out of range value for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
|
@ -2944,20 +2944,26 @@ delete from t9 ;
|
|||||||
test_sequence
|
test_sequence
|
||||||
-- insert into date/time columns --
|
-- insert into date/time columns --
|
||||||
Warnings:
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
Warnings:
|
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
|
||||||
Warnings:
|
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
|
||||||
Warnings:
|
|
||||||
Warning 1265 Data truncated for column 'c17' at row 1
|
Warning 1265 Data truncated for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value for column 'c13' at row 1
|
Warning 1264 Out of range value for column 'c13' at row 1
|
||||||
@ -2988,6 +2994,7 @@ Warning 1265 Data truncated for column 'c15' at row 1
|
|||||||
Warning 1264 Out of range value for column 'c16' at row 1
|
Warning 1264 Out of range value for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
Warnings:
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'c13' at row 1
|
||||||
Warning 1265 Data truncated for column 'c15' at row 1
|
Warning 1265 Data truncated for column 'c15' at row 1
|
||||||
Warning 1264 Out of range value for column 'c16' at row 1
|
Warning 1264 Out of range value for column 'c16' at row 1
|
||||||
Warning 1264 Out of range value for column 'c17' at row 1
|
Warning 1264 Out of range value for column 'c17' at row 1
|
||||||
|
@ -8,22 +8,29 @@ create procedure db1_secret.dummy() begin end;
|
|||||||
drop procedure db1_secret.dummy;
|
drop procedure db1_secret.dummy;
|
||||||
use db1_secret;
|
use db1_secret;
|
||||||
create table t1 ( u varchar(64), i int );
|
create table t1 ( u varchar(64), i int );
|
||||||
|
insert into t1 values('test', 0);
|
||||||
create procedure stamp(i int)
|
create procedure stamp(i int)
|
||||||
insert into db1_secret.t1 values (user(), i);
|
insert into db1_secret.t1 values (user(), i);
|
||||||
show procedure status like 'stamp';
|
show procedure status like 'stamp';
|
||||||
Db Name Type Definer Modified Created Security_type Comment
|
Db Name Type Definer Modified Created Security_type Comment
|
||||||
db1_secret stamp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
db1_secret stamp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
||||||
create function db() returns varchar(64) return database();
|
create function db() returns varchar(64)
|
||||||
|
begin
|
||||||
|
declare v varchar(64);
|
||||||
|
select u into v from t1 limit 1;
|
||||||
|
return v;
|
||||||
|
end|
|
||||||
show function status like 'db';
|
show function status like 'db';
|
||||||
Db Name Type Definer Modified Created Security_type Comment
|
Db Name Type Definer Modified Created Security_type Comment
|
||||||
db1_secret db FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
db1_secret db FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
||||||
call stamp(1);
|
call stamp(1);
|
||||||
select * from t1;
|
select * from t1;
|
||||||
u i
|
u i
|
||||||
|
test 0
|
||||||
root@localhost 1
|
root@localhost 1
|
||||||
select db();
|
select db();
|
||||||
db()
|
db()
|
||||||
db1_secret
|
test
|
||||||
grant execute on procedure db1_secret.stamp to user1@'%';
|
grant execute on procedure db1_secret.stamp to user1@'%';
|
||||||
grant execute on function db1_secret.db to user1@'%';
|
grant execute on function db1_secret.db to user1@'%';
|
||||||
grant execute on procedure db1_secret.stamp to ''@'%';
|
grant execute on procedure db1_secret.stamp to ''@'%';
|
||||||
@ -31,25 +38,34 @@ grant execute on function db1_secret.db to ''@'%';
|
|||||||
call db1_secret.stamp(2);
|
call db1_secret.stamp(2);
|
||||||
select db1_secret.db();
|
select db1_secret.db();
|
||||||
db1_secret.db()
|
db1_secret.db()
|
||||||
db1_secret
|
test
|
||||||
select * from db1_secret.t1;
|
select * from db1_secret.t1;
|
||||||
ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table 't1'
|
ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table 't1'
|
||||||
create procedure db1_secret.dummy() begin end;
|
create procedure db1_secret.dummy() begin end;
|
||||||
ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret'
|
ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret'
|
||||||
drop procedure db1_secret.dummy;
|
drop procedure db1_secret.dummy;
|
||||||
ERROR 42000: PROCEDURE db1_secret.dummy does not exist
|
ERROR 42000: PROCEDURE db1_secret.dummy does not exist
|
||||||
|
drop procedure db1_secret.stamp;
|
||||||
|
ERROR 42000: alter routine command denied to user 'user1'@'localhost' for routine 'db1_secret.stamp'
|
||||||
|
drop function db1_secret.db;
|
||||||
|
ERROR 42000: alter routine command denied to user 'user1'@'localhost' for routine 'db1_secret.db'
|
||||||
call db1_secret.stamp(3);
|
call db1_secret.stamp(3);
|
||||||
select db1_secret.db();
|
select db1_secret.db();
|
||||||
db1_secret.db()
|
db1_secret.db()
|
||||||
db1_secret
|
test
|
||||||
select * from db1_secret.t1;
|
select * from db1_secret.t1;
|
||||||
ERROR 42000: SELECT command denied to user ''@'localhost' for table 't1'
|
ERROR 42000: SELECT command denied to user ''@'localhost' for table 't1'
|
||||||
create procedure db1_secret.dummy() begin end;
|
create procedure db1_secret.dummy() begin end;
|
||||||
ERROR 42000: Access denied for user ''@'%' to database 'db1_secret'
|
ERROR 42000: Access denied for user ''@'%' to database 'db1_secret'
|
||||||
drop procedure db1_secret.dummy;
|
drop procedure db1_secret.dummy;
|
||||||
ERROR 42000: PROCEDURE db1_secret.dummy does not exist
|
ERROR 42000: PROCEDURE db1_secret.dummy does not exist
|
||||||
|
drop procedure db1_secret.stamp;
|
||||||
|
ERROR 42000: alter routine command denied to user ''@'%' for routine 'db1_secret.stamp'
|
||||||
|
drop function db1_secret.db;
|
||||||
|
ERROR 42000: alter routine command denied to user ''@'%' for routine 'db1_secret.db'
|
||||||
select * from t1;
|
select * from t1;
|
||||||
u i
|
u i
|
||||||
|
test 0
|
||||||
root@localhost 1
|
root@localhost 1
|
||||||
user1@localhost 2
|
user1@localhost 2
|
||||||
anon@localhost 3
|
anon@localhost 3
|
||||||
@ -64,21 +80,22 @@ db1_secret db FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 IN
|
|||||||
call stamp(4);
|
call stamp(4);
|
||||||
select * from t1;
|
select * from t1;
|
||||||
u i
|
u i
|
||||||
|
test 0
|
||||||
root@localhost 1
|
root@localhost 1
|
||||||
user1@localhost 2
|
user1@localhost 2
|
||||||
anon@localhost 3
|
anon@localhost 3
|
||||||
root@localhost 4
|
root@localhost 4
|
||||||
select db();
|
select db();
|
||||||
db()
|
db()
|
||||||
db1_secret
|
test
|
||||||
call db1_secret.stamp(5);
|
call db1_secret.stamp(5);
|
||||||
ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret'
|
ERROR 42000: INSERT command denied to user 'user1'@'localhost' for table 't1'
|
||||||
select db1_secret.db();
|
select db1_secret.db();
|
||||||
ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret'
|
ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table 't1'
|
||||||
call db1_secret.stamp(6);
|
call db1_secret.stamp(6);
|
||||||
ERROR 42000: Access denied for user ''@'%' to database 'db1_secret'
|
ERROR 42000: INSERT command denied to user ''@'localhost' for table 't1'
|
||||||
select db1_secret.db();
|
select db1_secret.db();
|
||||||
ERROR 42000: Access denied for user ''@'%' to database 'db1_secret'
|
ERROR 42000: SELECT command denied to user ''@'localhost' for table 't1'
|
||||||
drop database if exists db2;
|
drop database if exists db2;
|
||||||
create database db2;
|
create database db2;
|
||||||
use db2;
|
use db2;
|
||||||
|
@ -5643,6 +5643,90 @@ t3_id_1 t3_id_2 t4_id
|
|||||||
DROP PROCEDURE p1|
|
DROP PROCEDURE p1|
|
||||||
DROP VIEW v1, v2|
|
DROP VIEW v1, v2|
|
||||||
DROP TABLE t3, t4|
|
DROP TABLE t3, t4|
|
||||||
|
drop function if exists bug20777|
|
||||||
|
drop table if exists examplebug20777|
|
||||||
|
create function bug20777(f1 bigint unsigned) returns bigint unsigned
|
||||||
|
begin
|
||||||
|
set f1 = (f1 - 10); set f1 = (f1 10);
|
||||||
|
return f1;
|
||||||
|
end|
|
||||||
|
select bug20777(9223372036854775803) as '9223372036854775803 2**63-5';
|
||||||
|
9223372036854775803 2**63-5
|
||||||
|
9223372036854775803
|
||||||
|
select bug20777(9223372036854775804) as '9223372036854775804 2**63-4';
|
||||||
|
9223372036854775804 2**63-4
|
||||||
|
9223372036854775804
|
||||||
|
select bug20777(9223372036854775805) as '9223372036854775805 2**63-3';
|
||||||
|
9223372036854775805 2**63-3
|
||||||
|
9223372036854775805
|
||||||
|
select bug20777(9223372036854775806) as '9223372036854775806 2**63-2';
|
||||||
|
9223372036854775806 2**63-2
|
||||||
|
9223372036854775806
|
||||||
|
select bug20777(9223372036854775807) as '9223372036854775807 2**63-1';
|
||||||
|
9223372036854775807 2**63-1
|
||||||
|
9223372036854775807
|
||||||
|
select bug20777(9223372036854775808) as '9223372036854775808 2**63+0';
|
||||||
|
9223372036854775808 2**63+0
|
||||||
|
9223372036854775808
|
||||||
|
select bug20777(9223372036854775809) as '9223372036854775809 2**63+1';
|
||||||
|
9223372036854775809 2**63+1
|
||||||
|
9223372036854775809
|
||||||
|
select bug20777(9223372036854775810) as '9223372036854775810 2**63+2';
|
||||||
|
9223372036854775810 2**63+2
|
||||||
|
9223372036854775810
|
||||||
|
select bug20777(-9223372036854775808) as 'lower bounds signed bigint';
|
||||||
|
lower bounds signed bigint
|
||||||
|
0
|
||||||
|
select bug20777(9223372036854775807) as 'upper bounds signed bigint';
|
||||||
|
upper bounds signed bigint
|
||||||
|
9223372036854775807
|
||||||
|
select bug20777(0) as 'lower bounds unsigned bigint';
|
||||||
|
lower bounds unsigned bigint
|
||||||
|
0
|
||||||
|
select bug20777(18446744073709551615) as 'upper bounds unsigned bigint';
|
||||||
|
upper bounds unsigned bigint
|
||||||
|
18446744073709551615
|
||||||
|
select bug20777(18446744073709551616) as 'upper bounds unsigned bigint 1';
|
||||||
|
upper bounds unsigned bigint 1
|
||||||
|
18446744073709551615
|
||||||
|
select bug20777(-1) as 'lower bounds unsigned bigint - 1';
|
||||||
|
lower bounds unsigned bigint - 1
|
||||||
|
0
|
||||||
|
create table examplebug20777 as select
|
||||||
|
0 as 'i',
|
||||||
|
bug20777(9223372036854775806) as '2**63-2',
|
||||||
|
bug20777(9223372036854775807) as '2**63-1',
|
||||||
|
bug20777(9223372036854775808) as '2**63',
|
||||||
|
bug20777(9223372036854775809) as '2**63+1',
|
||||||
|
bug20777(18446744073709551614) as '2**64-2',
|
||||||
|
bug20777(18446744073709551615) as '2**64-1',
|
||||||
|
bug20777(18446744073709551616) as '2**64',
|
||||||
|
bug20777(0) as '0',
|
||||||
|
bug20777(-1) as '-1';
|
||||||
|
insert into examplebug20777 values (1, 9223372036854775806, 9223372036854775807, 223372036854775808, 9223372036854775809, 18446744073709551614, 18446744073709551615, 8446744073709551616, 0, -1);
|
||||||
|
show create table examplebug20777;
|
||||||
|
Table Create Table
|
||||||
|
examplebug20777 CREATE TABLE `examplebug20777` (
|
||||||
|
`i` int(1) NOT NULL DEFAULT '0',
|
||||||
|
`2**63-2` bigint(20) unsigned DEFAULT NULL,
|
||||||
|
`2**63-1` bigint(20) unsigned DEFAULT NULL,
|
||||||
|
`2**63` bigint(20) unsigned DEFAULT NULL,
|
||||||
|
`2**63+1` bigint(20) unsigned DEFAULT NULL,
|
||||||
|
`2**64-2` bigint(20) unsigned DEFAULT NULL,
|
||||||
|
`2**64-1` bigint(20) unsigned DEFAULT NULL,
|
||||||
|
`2**64` bigint(20) unsigned DEFAULT NULL,
|
||||||
|
`0` bigint(20) unsigned DEFAULT NULL,
|
||||||
|
`-1` bigint(20) unsigned DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
select * from examplebug20777 order by i;
|
||||||
|
i 2**63-2 2**63-1 2**63 2**63+1 2**64-2 2**64-1 2**64 0 -1
|
||||||
|
0 9223372036854775806 9223372036854775807 9223372036854775808 9223372036854775809 18446744073709551614 18446744073709551615 18446744073709551615 0 0
|
||||||
|
1 9223372036854775806 9223372036854775807 223372036854775808 9223372036854775809 18446744073709551614 18446744073709551615 8446744073709551616 0 0
|
||||||
|
drop table examplebug20777;
|
||||||
|
select bug20777(18446744073709551613)+1;
|
||||||
|
bug20777(18446744073709551613)+1
|
||||||
|
18446744073709551614
|
||||||
|
drop function bug20777;
|
||||||
End of 5.0 tests
|
End of 5.0 tests
|
||||||
Begin of 5.1 tests
|
Begin of 5.1 tests
|
||||||
drop function if exists pi;
|
drop function if exists pi;
|
||||||
@ -6061,89 +6145,44 @@ SUM(f2) bug25373(f1)
|
|||||||
21.300000071526 NULL
|
21.300000071526 NULL
|
||||||
DROP FUNCTION bug25373|
|
DROP FUNCTION bug25373|
|
||||||
DROP TABLE t3|
|
DROP TABLE t3|
|
||||||
drop function if exists bug20777|
|
DROP DATABASE IF EXISTS mysqltest1|
|
||||||
drop table if exists examplebug20777|
|
DROP DATABASE IF EXISTS mysqltest2|
|
||||||
create function bug20777(f1 bigint unsigned) returns bigint unsigned
|
CREATE DATABASE mysqltest1|
|
||||||
begin
|
CREATE DATABASE mysqltest2|
|
||||||
set f1 = (f1 - 10); set f1 = (f1 + 10);
|
CREATE PROCEDURE mysqltest1.p1()
|
||||||
return f1;
|
DROP DATABASE mysqltest2|
|
||||||
end|
|
use mysqltest2|
|
||||||
select bug20777(9223372036854775803) as '9223372036854775803 2**63-5';
|
CALL mysqltest1.p1()|
|
||||||
9223372036854775803 2**63-5
|
Warnings:
|
||||||
9223372036854775803
|
Note 1049 Unknown database 'mysqltest2'
|
||||||
select bug20777(9223372036854775804) as '9223372036854775804 2**63-4';
|
SELECT DATABASE()|
|
||||||
9223372036854775804 2**63-4
|
DATABASE()
|
||||||
9223372036854775804
|
NULL
|
||||||
select bug20777(9223372036854775805) as '9223372036854775805 2**63-3';
|
DROP DATABASE mysqltest1|
|
||||||
9223372036854775805 2**63-3
|
use test|
|
||||||
9223372036854775805
|
|
||||||
select bug20777(9223372036854775806) as '9223372036854775806 2**63-2';
|
|
||||||
9223372036854775806 2**63-2
|
|
||||||
9223372036854775806
|
|
||||||
select bug20777(9223372036854775807) as '9223372036854775807 2**63-1';
|
|
||||||
9223372036854775807 2**63-1
|
|
||||||
9223372036854775807
|
|
||||||
select bug20777(9223372036854775808) as '9223372036854775808 2**63+0';
|
|
||||||
9223372036854775808 2**63+0
|
|
||||||
9223372036854775808
|
|
||||||
select bug20777(9223372036854775809) as '9223372036854775809 2**63+1';
|
|
||||||
9223372036854775809 2**63+1
|
|
||||||
9223372036854775809
|
|
||||||
select bug20777(9223372036854775810) as '9223372036854775810 2**63+2';
|
|
||||||
9223372036854775810 2**63+2
|
|
||||||
9223372036854775810
|
|
||||||
select bug20777(-9223372036854775808) as 'lower bounds signed bigint';
|
|
||||||
lower bounds signed bigint
|
|
||||||
0
|
|
||||||
select bug20777(9223372036854775807) as 'upper bounds signed bigint';
|
|
||||||
upper bounds signed bigint
|
|
||||||
9223372036854775807
|
|
||||||
select bug20777(0) as 'lower bounds unsigned bigint';
|
|
||||||
lower bounds unsigned bigint
|
|
||||||
0
|
|
||||||
select bug20777(18446744073709551615) as 'upper bounds unsigned bigint';
|
|
||||||
upper bounds unsigned bigint
|
|
||||||
18446744073709551615
|
|
||||||
select bug20777(18446744073709551616) as 'upper bounds unsigned bigint + 1';
|
|
||||||
upper bounds unsigned bigint + 1
|
|
||||||
18446744073709551615
|
|
||||||
select bug20777(-1) as 'lower bounds unsigned bigint - 1';
|
|
||||||
lower bounds unsigned bigint - 1
|
|
||||||
0
|
|
||||||
create table examplebug20777 as select
|
|
||||||
0 as 'i',
|
|
||||||
bug20777(9223372036854775806) as '2**63-2',
|
|
||||||
bug20777(9223372036854775807) as '2**63-1',
|
|
||||||
bug20777(9223372036854775808) as '2**63',
|
|
||||||
bug20777(9223372036854775809) as '2**63+1',
|
|
||||||
bug20777(18446744073709551614) as '2**64-2',
|
|
||||||
bug20777(18446744073709551615) as '2**64-1',
|
|
||||||
bug20777(18446744073709551616) as '2**64',
|
|
||||||
bug20777(0) as '0',
|
|
||||||
bug20777(-1) as '-1';
|
|
||||||
insert into examplebug20777 values (1, 9223372036854775806, 9223372036854775807, 223372036854775808, 9223372036854775809, 18446744073709551614, 18446744073709551615, 8446744073709551616, 0, -1);
|
|
||||||
show create table examplebug20777;
|
|
||||||
Table Create Table
|
|
||||||
examplebug20777 CREATE TABLE `examplebug20777` (
|
|
||||||
`i` int(1) NOT NULL DEFAULT '0',
|
|
||||||
`2**63-2` bigint(20) unsigned DEFAULT NULL,
|
|
||||||
`2**63-1` bigint(20) unsigned DEFAULT NULL,
|
|
||||||
`2**63` bigint(20) unsigned DEFAULT NULL,
|
|
||||||
`2**63+1` bigint(20) unsigned DEFAULT NULL,
|
|
||||||
`2**64-2` bigint(20) unsigned DEFAULT NULL,
|
|
||||||
`2**64-1` bigint(20) unsigned DEFAULT NULL,
|
|
||||||
`2**64` bigint(20) unsigned DEFAULT NULL,
|
|
||||||
`0` bigint(20) unsigned DEFAULT NULL,
|
|
||||||
`-1` bigint(20) unsigned DEFAULT NULL
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
||||||
select * from examplebug20777 order by i;
|
|
||||||
i 2**63-2 2**63-1 2**63 2**63+1 2**64-2 2**64-1 2**64 0 -1
|
|
||||||
0 9223372036854775806 9223372036854775807 9223372036854775808 9223372036854775809 18446744073709551614 18446744073709551615 18446744073709551615 0 0
|
|
||||||
1 9223372036854775806 9223372036854775807 223372036854775808 9223372036854775809 18446744073709551614 18446744073709551615 8446744073709551616 0 0
|
|
||||||
drop table examplebug20777;
|
|
||||||
select bug20777(18446744073709551613)+1;
|
|
||||||
bug20777(18446744073709551613)+1
|
|
||||||
18446744073709551614
|
|
||||||
drop function bug20777;
|
|
||||||
End of 5.0 tests.
|
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
CREATE TABLE t1 (a int auto_increment primary key) engine=MyISAM;
|
||||||
|
CREATE TABLE t2 (a int auto_increment primary key, b int) engine=innodb;
|
||||||
|
set @a=0;
|
||||||
|
CREATE function bug27354() RETURNS int deterministic
|
||||||
|
begin
|
||||||
|
insert into t1 values (null);
|
||||||
|
set @a=@a+1;
|
||||||
|
return @a;
|
||||||
|
end|
|
||||||
|
update t2 set b=1 where a=bug27354();
|
||||||
|
select count(t_1.a),count(t_2.a) from t1 as t_1, t2 as t_2 /* must be 0,0 */;
|
||||||
|
count(t_1.a) count(t_2.a)
|
||||||
|
0 0
|
||||||
|
insert into t2 values (1,1),(2,2),(3,3);
|
||||||
|
update t2 set b=-b where a=bug27354();
|
||||||
|
select * from t2 /* must return 1,-1 ... */;
|
||||||
|
a b
|
||||||
|
1 -1
|
||||||
|
2 -2
|
||||||
|
3 -3
|
||||||
|
select count(*) from t1 /* must be 3 */;
|
||||||
|
count(*)
|
||||||
|
3
|
||||||
|
drop table t1,t2;
|
||||||
|
drop function bug27354;
|
||||||
|
@ -530,6 +530,27 @@ count(*)
|
|||||||
drop table t3, t4|
|
drop table t3, t4|
|
||||||
drop procedure bug14210|
|
drop procedure bug14210|
|
||||||
set @@session.max_heap_table_size=default|
|
set @@session.max_heap_table_size=default|
|
||||||
|
drop function if exists bug23333|
|
||||||
|
drop table if exists t1,t2|
|
||||||
|
CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM|
|
||||||
|
CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB|
|
||||||
|
insert into t2 values (1,1)|
|
||||||
|
create function bug23333()
|
||||||
|
RETURNS int(11)
|
||||||
|
DETERMINISTIC
|
||||||
|
begin
|
||||||
|
insert into t1 values (null);
|
||||||
|
select count(*) from t1 into @a;
|
||||||
|
return @a;
|
||||||
|
end|
|
||||||
|
reset master|
|
||||||
|
insert into t2 values (bug23333(),1)|
|
||||||
|
ERROR 23000: Duplicate entry '1' for key 1
|
||||||
|
show binlog events from 98 /* with fixes for #23333 will show there is the query */|
|
||||||
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
|
select count(*),@a from t1 /* must be 1,1 */|
|
||||||
|
count(*) @a
|
||||||
|
1 1
|
||||||
CREATE DATABASE db_bug7787|
|
CREATE DATABASE db_bug7787|
|
||||||
use db_bug7787|
|
use db_bug7787|
|
||||||
CREATE PROCEDURE p1()
|
CREATE PROCEDURE p1()
|
||||||
|
@ -110,3 +110,29 @@ select 1 from t1 where cast('2000-01-01 12:01:01' as datetime) between start_dat
|
|||||||
1
|
1
|
||||||
1
|
1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
select @d:=1111, year(@d), month(@d), day(@d), cast(@d as date);
|
||||||
|
@d:=1111 year(@d) month(@d) day(@d) cast(@d as date)
|
||||||
|
1111 2000 11 11 2000-11-11
|
||||||
|
select @d:=011111, year(@d), month(@d), day(@d), cast(@d as date);
|
||||||
|
@d:=011111 year(@d) month(@d) day(@d) cast(@d as date)
|
||||||
|
11111 2001 11 11 2001-11-11
|
||||||
|
select @d:=1311, year(@d), month(@d), day(@d), cast(@d as date);
|
||||||
|
@d:=1311 year(@d) month(@d) day(@d) cast(@d as date)
|
||||||
|
1311 NULL NULL NULL NULL
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Incorrect datetime value: '1311'
|
||||||
|
Warning 1292 Incorrect datetime value: '1311'
|
||||||
|
Warning 1292 Incorrect datetime value: '1311'
|
||||||
|
Warning 1292 Incorrect datetime value: '1311'
|
||||||
|
create table t1 (d date , dt datetime , ts timestamp);
|
||||||
|
insert into t1 values (9912101,9912101,9912101);
|
||||||
|
Warnings:
|
||||||
|
Warning 1264 Out of range value for column 'd' at row 1
|
||||||
|
Warning 1264 Out of range value for column 'dt' at row 1
|
||||||
|
Warning 1265 Data truncated for column 'ts' at row 1
|
||||||
|
insert into t1 values (11111,11111,11111);
|
||||||
|
select * from t1;
|
||||||
|
d dt ts
|
||||||
|
0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00
|
||||||
|
2001-11-11 2001-11-11 00:00:00 2001-11-11 00:00:00
|
||||||
|
drop table t1;
|
||||||
|
@ -194,3 +194,38 @@ CAST(CAST('2006-08-10 10:11:12' AS DATETIME) + INTERVAL 14 MICROSECOND AS DECIMA
|
|||||||
SELECT CAST(CAST('10:11:12.098700' AS TIME) AS DECIMAL(20,6));
|
SELECT CAST(CAST('10:11:12.098700' AS TIME) AS DECIMAL(20,6));
|
||||||
CAST(CAST('10:11:12.098700' AS TIME) AS DECIMAL(20,6))
|
CAST(CAST('10:11:12.098700' AS TIME) AS DECIMAL(20,6))
|
||||||
101112.098700
|
101112.098700
|
||||||
|
set @org_mode=@@sql_mode;
|
||||||
|
create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03');
|
||||||
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'da' at row 1
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`da` date DEFAULT '1962-03-03',
|
||||||
|
`dt` datetime DEFAULT '1962-03-03 00:00:00'
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
insert into t1 values ();
|
||||||
|
insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
|
||||||
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'da' at row 1
|
||||||
|
set @@sql_mode='ansi,traditional';
|
||||||
|
insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
|
||||||
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'da' at row 1
|
||||||
|
insert into t1 set dt='2007-03-23 13:49:38',da=dt;
|
||||||
|
Warnings:
|
||||||
|
Note 1265 Data truncated for column 'da' at row 1
|
||||||
|
insert into t1 values ('2007-03-32','2007-03-23 13:49:38');
|
||||||
|
ERROR 22007: Incorrect date value: '2007-03-32' for column 'da' at row 1
|
||||||
|
select * from t1;
|
||||||
|
da dt
|
||||||
|
1962-03-03 1962-03-03 00:00:00
|
||||||
|
2007-03-23 2007-03-23 13:49:38
|
||||||
|
2007-03-23 2007-03-23 13:49:38
|
||||||
|
2007-03-23 2007-03-23 13:49:38
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (da date default '1962-03-32 23:33:34', dt datetime default '1962-03-03');
|
||||||
|
ERROR 42000: Invalid default value for 'da'
|
||||||
|
create table t1 (t time default '916:00:00 a');
|
||||||
|
ERROR 42000: Invalid default value for 't'
|
||||||
|
set @@sql_mode= @org_mode;
|
||||||
|
@ -284,15 +284,6 @@ create view mysqltest.v3 as select b from mysqltest.t2;
|
|||||||
grant create view, update on mysqltest.v3 to mysqltest_1@localhost;
|
grant create view, update on mysqltest.v3 to mysqltest_1@localhost;
|
||||||
drop view mysqltest.v3;
|
drop view mysqltest.v3;
|
||||||
create view mysqltest.v3 as select b from mysqltest.t2;
|
create view mysqltest.v3 as select b from mysqltest.t2;
|
||||||
grant create view, update, insert on mysqltest.v3 to mysqltest_1@localhost;
|
|
||||||
drop view mysqltest.v3;
|
|
||||||
create view mysqltest.v3 as select b from mysqltest.t2;
|
|
||||||
ERROR 42000: create view command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 'v3'
|
|
||||||
create table mysqltest.v3 (b int);
|
|
||||||
grant select(b) on mysqltest.v3 to mysqltest_1@localhost;
|
|
||||||
drop table mysqltest.v3;
|
|
||||||
create view mysqltest.v3 as select b from mysqltest.t2;
|
|
||||||
ERROR 42000: create view command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 'v3'
|
|
||||||
create view v4 as select b+1 from mysqltest.t2;
|
create view v4 as select b+1 from mysqltest.t2;
|
||||||
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 't2'
|
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 't2'
|
||||||
grant create view,update,select on test.* to mysqltest_1@localhost;
|
grant create view,update,select on test.* to mysqltest_1@localhost;
|
||||||
@ -796,6 +787,94 @@ View Create View
|
|||||||
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`f2` AS `f2` from `t1`
|
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`f2` AS `f2` from `t1`
|
||||||
DROP USER u26813@localhost;
|
DROP USER u26813@localhost;
|
||||||
DROP DATABASE db26813;
|
DROP DATABASE db26813;
|
||||||
|
DROP DATABASE IF EXISTS mysqltest1;
|
||||||
|
DROP DATABASE IF EXISTS mysqltest2;
|
||||||
|
CREATE DATABASE mysqltest1;
|
||||||
|
CREATE DATABASE mysqltest2;
|
||||||
|
CREATE TABLE mysqltest1.t1(c1 INT);
|
||||||
|
CREATE TABLE mysqltest1.t2(c2 INT);
|
||||||
|
CREATE TABLE mysqltest1.t3(c3 INT);
|
||||||
|
CREATE TABLE mysqltest1.t4(c4 INT);
|
||||||
|
INSERT INTO mysqltest1.t1 VALUES (11), (12), (13), (14);
|
||||||
|
INSERT INTO mysqltest1.t2 VALUES (21), (22), (23), (24);
|
||||||
|
INSERT INTO mysqltest1.t3 VALUES (31), (32), (33), (34);
|
||||||
|
INSERT INTO mysqltest1.t4 VALUES (41), (42), (43), (44);
|
||||||
|
GRANT SELECT ON mysqltest1.t1 TO mysqltest_u1@localhost;
|
||||||
|
GRANT INSERT ON mysqltest1.t2 TO mysqltest_u1@localhost;
|
||||||
|
GRANT SELECT, UPDATE ON mysqltest1.t3 TO mysqltest_u1@localhost;
|
||||||
|
GRANT SELECT, DELETE ON mysqltest1.t4 TO mysqltest_u1@localhost;
|
||||||
|
GRANT ALL PRIVILEGES ON mysqltest2.* TO mysqltest_u1@localhost;
|
||||||
|
|
||||||
|
---> connection: bug24040_con
|
||||||
|
SELECT * FROM mysqltest1.t1;
|
||||||
|
c1
|
||||||
|
11
|
||||||
|
12
|
||||||
|
13
|
||||||
|
14
|
||||||
|
INSERT INTO mysqltest1.t2 VALUES(25);
|
||||||
|
UPDATE mysqltest1.t3 SET c3 = 331 WHERE c3 = 31;
|
||||||
|
DELETE FROM mysqltest1.t4 WHERE c4 = 44;
|
||||||
|
CREATE VIEW v1 AS SELECT * FROM mysqltest1.t1;
|
||||||
|
CREATE VIEW v2 AS SELECT * FROM mysqltest1.t2;
|
||||||
|
CREATE VIEW v3 AS SELECT * FROM mysqltest1.t3;
|
||||||
|
CREATE VIEW v4 AS SELECT * FROM mysqltest1.t4;
|
||||||
|
SELECT * FROM v1;
|
||||||
|
c1
|
||||||
|
11
|
||||||
|
12
|
||||||
|
13
|
||||||
|
14
|
||||||
|
INSERT INTO v2 VALUES(26);
|
||||||
|
UPDATE v3 SET c3 = 332 WHERE c3 = 32;
|
||||||
|
DELETE FROM v4 WHERE c4 = 43;
|
||||||
|
CREATE VIEW v12 AS SELECT c1, c2 FROM mysqltest1.t1, mysqltest1.t2;
|
||||||
|
ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c2' in table 'v12'
|
||||||
|
CREATE VIEW v13 AS SELECT c1, c3 FROM mysqltest1.t1, mysqltest1.t3;
|
||||||
|
CREATE VIEW v14 AS SELECT c1, c4 FROM mysqltest1.t1, mysqltest1.t4;
|
||||||
|
CREATE VIEW v21 AS SELECT c2, c1 FROM mysqltest1.t2, mysqltest1.t1;
|
||||||
|
ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c1' in table 'v21'
|
||||||
|
CREATE VIEW v23 AS SELECT c2, c3 FROM mysqltest1.t2, mysqltest1.t3;
|
||||||
|
ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c3' in table 'v23'
|
||||||
|
CREATE VIEW v24 AS SELECT c2, c4 FROM mysqltest1.t2, mysqltest1.t4;
|
||||||
|
ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c4' in table 'v24'
|
||||||
|
CREATE VIEW v31 AS SELECT c3, c1 FROM mysqltest1.t3, mysqltest1.t1;
|
||||||
|
CREATE VIEW v32 AS SELECT c3, c2 FROM mysqltest1.t3, mysqltest1.t2;
|
||||||
|
ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c2' in table 'v32'
|
||||||
|
CREATE VIEW v34 AS SELECT c3, c4 FROM mysqltest1.t3, mysqltest1.t4;
|
||||||
|
CREATE VIEW v41 AS SELECT c4, c1 FROM mysqltest1.t4, mysqltest1.t1;
|
||||||
|
CREATE VIEW v42 AS SELECT c4, c2 FROM mysqltest1.t4, mysqltest1.t2;
|
||||||
|
ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c2' in table 'v42'
|
||||||
|
CREATE VIEW v43 AS SELECT c4, c3 FROM mysqltest1.t4, mysqltest1.t3;
|
||||||
|
|
||||||
|
---> connection: default
|
||||||
|
SELECT * FROM mysqltest1.t1;
|
||||||
|
c1
|
||||||
|
11
|
||||||
|
12
|
||||||
|
13
|
||||||
|
14
|
||||||
|
SELECT * FROM mysqltest1.t2;
|
||||||
|
c2
|
||||||
|
21
|
||||||
|
22
|
||||||
|
23
|
||||||
|
24
|
||||||
|
25
|
||||||
|
26
|
||||||
|
SELECT * FROM mysqltest1.t3;
|
||||||
|
c3
|
||||||
|
331
|
||||||
|
332
|
||||||
|
33
|
||||||
|
34
|
||||||
|
SELECT * FROM mysqltest1.t4;
|
||||||
|
c4
|
||||||
|
41
|
||||||
|
42
|
||||||
|
DROP DATABASE mysqltest1;
|
||||||
|
DROP DATABASE mysqltest2;
|
||||||
|
DROP USER mysqltest_u1@localhost;
|
||||||
End of 5.0 tests.
|
End of 5.0 tests.
|
||||||
DROP VIEW IF EXISTS v1;
|
DROP VIEW IF EXISTS v1;
|
||||||
DROP TABLE IF EXISTS t1;
|
DROP TABLE IF EXISTS t1;
|
||||||
|
@ -132,6 +132,8 @@ create table t1 (date char(30), format char(30) not null);
|
|||||||
insert into t1 values
|
insert into t1 values
|
||||||
('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'),
|
('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'),
|
||||||
('03-01-02 8:11:2.123456', '%y-%m-%d %H:%i:%S.%#'),
|
('03-01-02 8:11:2.123456', '%y-%m-%d %H:%i:%S.%#'),
|
||||||
|
('0003-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'),
|
||||||
|
('03-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'),
|
||||||
('2003-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p'),
|
('2003-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p'),
|
||||||
('2003-01-02 01:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f%p'),
|
('2003-01-02 01:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f%p'),
|
||||||
('2003-01-02 02:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f %p'),
|
('2003-01-02 02:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f %p'),
|
||||||
|
@ -41,6 +41,8 @@ select datediff("1997-11-30 23:59:59.000001",null);
|
|||||||
|
|
||||||
select weekofyear("1997-11-30 23:59:59.000001");
|
select weekofyear("1997-11-30 23:59:59.000001");
|
||||||
|
|
||||||
|
select makedate(03,1);
|
||||||
|
select makedate('0003',1);
|
||||||
select makedate(1997,1);
|
select makedate(1997,1);
|
||||||
select makedate(1997,0);
|
select makedate(1997,0);
|
||||||
select makedate(9999,365);
|
select makedate(9999,365);
|
||||||
|
@ -985,4 +985,87 @@ GRANT PROCESS ON * TO user@localhost;
|
|||||||
disconnect con1;
|
disconnect con1;
|
||||||
connection default;
|
connection default;
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# BUG#9504: Stored procedures: execute privilege doesn't make 'use database'
|
||||||
|
# okay.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Prepare.
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
DROP DATABASE IF EXISTS mysqltest1;
|
||||||
|
DROP DATABASE IF EXISTS mysqltest2;
|
||||||
|
DROP DATABASE IF EXISTS mysqltest3;
|
||||||
|
DROP DATABASE IF EXISTS mysqltest4;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
CREATE DATABASE mysqltest1;
|
||||||
|
CREATE DATABASE mysqltest2;
|
||||||
|
CREATE DATABASE mysqltest3;
|
||||||
|
CREATE DATABASE mysqltest4;
|
||||||
|
|
||||||
|
CREATE PROCEDURE mysqltest1.p_def() SQL SECURITY DEFINER
|
||||||
|
SELECT 1;
|
||||||
|
|
||||||
|
CREATE PROCEDURE mysqltest2.p_inv() SQL SECURITY INVOKER
|
||||||
|
SELECT 1;
|
||||||
|
|
||||||
|
CREATE FUNCTION mysqltest3.f_def() RETURNS INT SQL SECURITY DEFINER
|
||||||
|
RETURN 1;
|
||||||
|
|
||||||
|
CREATE FUNCTION mysqltest4.f_inv() RETURNS INT SQL SECURITY INVOKER
|
||||||
|
RETURN 1;
|
||||||
|
|
||||||
|
GRANT EXECUTE ON PROCEDURE mysqltest1.p_def TO mysqltest_1@localhost;
|
||||||
|
GRANT EXECUTE ON PROCEDURE mysqltest2.p_inv TO mysqltest_1@localhost;
|
||||||
|
GRANT EXECUTE ON FUNCTION mysqltest3.f_def TO mysqltest_1@localhost;
|
||||||
|
GRANT EXECUTE ON FUNCTION mysqltest4.f_inv TO mysqltest_1@localhost;
|
||||||
|
|
||||||
|
GRANT ALL PRIVILEGES ON test.* TO mysqltest_1@localhost;
|
||||||
|
|
||||||
|
# Test.
|
||||||
|
|
||||||
|
--connect (bug9504_con1,localhost,mysqltest_1,,)
|
||||||
|
--echo
|
||||||
|
--echo ---> connection: bug9504_con1
|
||||||
|
|
||||||
|
# - Check that we can switch to the db;
|
||||||
|
|
||||||
|
use mysqltest1;
|
||||||
|
|
||||||
|
use mysqltest2;
|
||||||
|
|
||||||
|
use mysqltest3;
|
||||||
|
|
||||||
|
use mysqltest4;
|
||||||
|
|
||||||
|
# - Check that we can call stored routines;
|
||||||
|
|
||||||
|
use test;
|
||||||
|
|
||||||
|
CALL mysqltest1.p_def();
|
||||||
|
|
||||||
|
CALL mysqltest2.p_inv();
|
||||||
|
|
||||||
|
SELECT mysqltest3.f_def();
|
||||||
|
|
||||||
|
SELECT mysqltest4.f_inv();
|
||||||
|
|
||||||
|
# Cleanup.
|
||||||
|
|
||||||
|
--connection default
|
||||||
|
--echo
|
||||||
|
--echo ---> connection: default
|
||||||
|
|
||||||
|
--disconnect bug9504_con1
|
||||||
|
|
||||||
|
DROP DATABASE mysqltest1;
|
||||||
|
DROP DATABASE mysqltest2;
|
||||||
|
DROP DATABASE mysqltest3;
|
||||||
|
DROP DATABASE mysqltest4;
|
||||||
|
|
||||||
|
DROP USER mysqltest_1@localhost;
|
||||||
|
|
||||||
|
|
||||||
--echo End of 5.0 tests
|
--echo End of 5.0 tests
|
||||||
|
@ -121,6 +121,28 @@ create table t1 (f1 char(4));
|
|||||||
create view v1 as select f1 from t1;
|
create view v1 as select f1 from t1;
|
||||||
grant insert on v1 to testdb_2@localhost;
|
grant insert on v1 to testdb_2@localhost;
|
||||||
|
|
||||||
|
create view v5 as select f1 from t1;
|
||||||
|
grant show view on v5 to testdb_2@localhost;
|
||||||
|
|
||||||
|
--error 1227
|
||||||
|
create definer=`no_such_user`@`no_such_host` view v6 as select f1 from t1;
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
use testdb_1;
|
||||||
|
create view v6 as select f1 from t1;
|
||||||
|
grant show view on v6 to testdb_2@localhost;
|
||||||
|
|
||||||
|
create table t2 (f1 char(4));
|
||||||
|
create definer=`no_such_user`@`no_such_host` view v7 as select * from t2;
|
||||||
|
|
||||||
|
show fields from testdb_1.v6;
|
||||||
|
show create view testdb_1.v6;
|
||||||
|
|
||||||
|
show create view testdb_1.v7;
|
||||||
|
show fields from testdb_1.v7;
|
||||||
|
|
||||||
|
connection testdb_1;
|
||||||
|
|
||||||
create table t3 (f1 char(4), f2 char(4));
|
create table t3 (f1 char(4), f2 char(4));
|
||||||
create view v3 as select f1,f2 from t3;
|
create view v3 as select f1,f2 from t3;
|
||||||
grant insert(f1), insert(f2) on v3 to testdb_2@localhost;
|
grant insert(f1), insert(f2) on v3 to testdb_2@localhost;
|
||||||
@ -129,13 +151,41 @@ connect (testdb_2,localhost,testdb_2,,test);
|
|||||||
create view v2 as select f1 from testdb_1.v1;
|
create view v2 as select f1 from testdb_1.v1;
|
||||||
create view v4 as select f1,f2 from testdb_1.v3;
|
create view v4 as select f1,f2 from testdb_1.v3;
|
||||||
|
|
||||||
|
show fields from testdb_1.v5;
|
||||||
|
show create view testdb_1.v5;
|
||||||
|
|
||||||
|
show fields from testdb_1.v6;
|
||||||
|
show create view testdb_1.v6;
|
||||||
|
|
||||||
connection testdb_1;
|
connection testdb_1;
|
||||||
|
show fields from testdb_1.v7;
|
||||||
|
show create view testdb_1.v7;
|
||||||
|
|
||||||
revoke insert(f1) on v3 from testdb_2@localhost;
|
revoke insert(f1) on v3 from testdb_2@localhost;
|
||||||
|
revoke show view on v5 from testdb_2@localhost;
|
||||||
|
connection default;
|
||||||
|
use testdb_1;
|
||||||
|
revoke show view on v6 from testdb_2@localhost;
|
||||||
connection testdb_2;
|
connection testdb_2;
|
||||||
|
|
||||||
|
--error 1142
|
||||||
|
show fields from testdb_1.v5;
|
||||||
|
--error 1142
|
||||||
|
show create view testdb_1.v5;
|
||||||
|
|
||||||
|
--error 1142
|
||||||
|
show fields from testdb_1.v6;
|
||||||
|
--error 1142
|
||||||
|
show create view testdb_1.v6;
|
||||||
|
|
||||||
|
--error 1142
|
||||||
|
show fields from testdb_1.v7;
|
||||||
|
--error 1142
|
||||||
|
show create view testdb_1.v7;
|
||||||
|
|
||||||
--error 1345
|
--error 1345
|
||||||
show create view v4;
|
show create view v4;
|
||||||
--error 1345
|
#--error 1345
|
||||||
show fields from v4;
|
show fields from v4;
|
||||||
|
|
||||||
show fields from v2;
|
show fields from v2;
|
||||||
@ -155,6 +205,7 @@ where a.table_name = 'testdb_1.v1';
|
|||||||
select * from v2;
|
select * from v2;
|
||||||
|
|
||||||
connection default;
|
connection default;
|
||||||
|
use test;
|
||||||
drop view testdb_1.v1, v2, testdb_1.v3, v4;
|
drop view testdb_1.v1, v2, testdb_1.v3, v4;
|
||||||
drop database testdb_1;
|
drop database testdb_1;
|
||||||
drop user testdb_1@localhost;
|
drop user testdb_1@localhost;
|
||||||
|
@ -58,6 +58,10 @@ select "--- stop-position --" as "";
|
|||||||
--enable_query_log
|
--enable_query_log
|
||||||
--exec $MYSQL_BINLOG --short-form --stop-position=608 $MYSQLTEST_VARDIR/log/master-bin.000001
|
--exec $MYSQL_BINLOG --short-form --stop-position=608 $MYSQLTEST_VARDIR/log/master-bin.000001
|
||||||
--disable_query_log
|
--disable_query_log
|
||||||
|
select "--- start and stop positions ---" as "";
|
||||||
|
--enable_query_log
|
||||||
|
--exec $MYSQL_BINLOG --short-form --start-position=600 --stop-position 725 $MYSQLTEST_VARDIR/log/master-bin.000001
|
||||||
|
--disable_query_log
|
||||||
select "--- start-datetime --" as "";
|
select "--- start-datetime --" as "";
|
||||||
--enable_query_log
|
--enable_query_log
|
||||||
--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQLTEST_VARDIR/log/master-bin.000001
|
--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQLTEST_VARDIR/log/master-bin.000001
|
||||||
@ -111,6 +115,10 @@ select "--- start-position --" as "";
|
|||||||
--enable_query_log
|
--enable_query_log
|
||||||
--exec $MYSQL_BINLOG --short-form --start-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
|
--exec $MYSQL_BINLOG --short-form --start-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
|
||||||
--disable_query_log
|
--disable_query_log
|
||||||
|
select "--- start and stop positions ---" as "";
|
||||||
|
--enable_query_log
|
||||||
|
--exec $MYSQL_BINLOG --short-form --start-position=600 --stop-position 725 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
|
||||||
|
--disable_query_log
|
||||||
select "--- stop-position --" as "";
|
select "--- stop-position --" as "";
|
||||||
--enable_query_log
|
--enable_query_log
|
||||||
--exec $MYSQL_BINLOG --short-form --stop-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
|
--exec $MYSQL_BINLOG --short-form --stop-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
|
||||||
|
@ -28,6 +28,7 @@ drop procedure db1_secret.dummy;
|
|||||||
use db1_secret;
|
use db1_secret;
|
||||||
|
|
||||||
create table t1 ( u varchar(64), i int );
|
create table t1 ( u varchar(64), i int );
|
||||||
|
insert into t1 values('test', 0);
|
||||||
|
|
||||||
# A test procedure and function
|
# A test procedure and function
|
||||||
create procedure stamp(i int)
|
create procedure stamp(i int)
|
||||||
@ -35,7 +36,16 @@ create procedure stamp(i int)
|
|||||||
--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
|
--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
|
||||||
show procedure status like 'stamp';
|
show procedure status like 'stamp';
|
||||||
|
|
||||||
create function db() returns varchar(64) return database();
|
delimiter |;
|
||||||
|
create function db() returns varchar(64)
|
||||||
|
begin
|
||||||
|
declare v varchar(64);
|
||||||
|
|
||||||
|
select u into v from t1 limit 1;
|
||||||
|
|
||||||
|
return v;
|
||||||
|
end|
|
||||||
|
delimiter ;|
|
||||||
--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
|
--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
|
||||||
show function status like 'db';
|
show function status like 'db';
|
||||||
|
|
||||||
@ -63,14 +73,18 @@ call db1_secret.stamp(2);
|
|||||||
select db1_secret.db();
|
select db1_secret.db();
|
||||||
|
|
||||||
# ...but not this
|
# ...but not this
|
||||||
--error 1142
|
--error ER_TABLEACCESS_DENIED_ERROR
|
||||||
select * from db1_secret.t1;
|
select * from db1_secret.t1;
|
||||||
|
|
||||||
# ...and not this
|
# ...and not this
|
||||||
--error 1044
|
--error ER_DBACCESS_DENIED_ERROR
|
||||||
create procedure db1_secret.dummy() begin end;
|
create procedure db1_secret.dummy() begin end;
|
||||||
--error 1305
|
--error ER_SP_DOES_NOT_EXIST
|
||||||
drop procedure db1_secret.dummy;
|
drop procedure db1_secret.dummy;
|
||||||
|
--error ER_PROCACCESS_DENIED_ERROR
|
||||||
|
drop procedure db1_secret.stamp;
|
||||||
|
--error ER_PROCACCESS_DENIED_ERROR
|
||||||
|
drop function db1_secret.db;
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -83,14 +97,18 @@ call db1_secret.stamp(3);
|
|||||||
select db1_secret.db();
|
select db1_secret.db();
|
||||||
|
|
||||||
# ...but not this
|
# ...but not this
|
||||||
--error 1142
|
--error ER_TABLEACCESS_DENIED_ERROR
|
||||||
select * from db1_secret.t1;
|
select * from db1_secret.t1;
|
||||||
|
|
||||||
# ...and not this
|
# ...and not this
|
||||||
--error 1044
|
--error ER_DBACCESS_DENIED_ERROR
|
||||||
create procedure db1_secret.dummy() begin end;
|
create procedure db1_secret.dummy() begin end;
|
||||||
--error 1305
|
--error ER_SP_DOES_NOT_EXIST
|
||||||
drop procedure db1_secret.dummy;
|
drop procedure db1_secret.dummy;
|
||||||
|
--error ER_PROCACCESS_DENIED_ERROR
|
||||||
|
drop procedure db1_secret.stamp;
|
||||||
|
--error ER_PROCACCESS_DENIED_ERROR
|
||||||
|
drop function db1_secret.db;
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -121,9 +139,9 @@ select db();
|
|||||||
connection con2user1;
|
connection con2user1;
|
||||||
|
|
||||||
# This should not work
|
# This should not work
|
||||||
--error 1044
|
--error ER_TABLEACCESS_DENIED_ERROR
|
||||||
call db1_secret.stamp(5);
|
call db1_secret.stamp(5);
|
||||||
--error 1044
|
--error ER_TABLEACCESS_DENIED_ERROR
|
||||||
select db1_secret.db();
|
select db1_secret.db();
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -132,9 +150,9 @@ select db1_secret.db();
|
|||||||
connection con3anon;
|
connection con3anon;
|
||||||
|
|
||||||
# This should not work
|
# This should not work
|
||||||
--error 1044
|
--error ER_TABLEACCESS_DENIED_ERROR
|
||||||
call db1_secret.stamp(6);
|
call db1_secret.stamp(6);
|
||||||
--error 1044
|
--error ER_TABLEACCESS_DENIED_ERROR
|
||||||
select db1_secret.db();
|
select db1_secret.db();
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -165,7 +183,7 @@ use db2;
|
|||||||
create procedure p () insert into t2 values (1);
|
create procedure p () insert into t2 values (1);
|
||||||
|
|
||||||
# Check that this doesn't work.
|
# Check that this doesn't work.
|
||||||
--error 1142
|
--error ER_TABLEACCESS_DENIED_ERROR
|
||||||
call p();
|
call p();
|
||||||
|
|
||||||
connect (con4user2,localhost,user2,,);
|
connect (con4user2,localhost,user2,,);
|
||||||
@ -174,7 +192,7 @@ connection con4user2;
|
|||||||
use db2;
|
use db2;
|
||||||
|
|
||||||
# This should not work, since p is executed with definer's (user1's) rights.
|
# This should not work, since p is executed with definer's (user1's) rights.
|
||||||
--error 1370
|
--error ER_PROCACCESS_DENIED_ERROR
|
||||||
call p();
|
call p();
|
||||||
select * from t2;
|
select * from t2;
|
||||||
|
|
||||||
@ -207,9 +225,9 @@ alter procedure p modifies sql data;
|
|||||||
drop procedure p;
|
drop procedure p;
|
||||||
|
|
||||||
# This should NOT work
|
# This should NOT work
|
||||||
--error 1370
|
--error ER_PROCACCESS_DENIED_ERROR
|
||||||
alter procedure q modifies sql data;
|
alter procedure q modifies sql data;
|
||||||
--error 1370
|
--error ER_PROCACCESS_DENIED_ERROR
|
||||||
drop procedure q;
|
drop procedure q;
|
||||||
|
|
||||||
connection con1root;
|
connection con1root;
|
||||||
@ -260,30 +278,30 @@ connect (con4userc,localhost,userc,,);
|
|||||||
|
|
||||||
connection con2usera;
|
connection con2usera;
|
||||||
call sptest.p1(1);
|
call sptest.p1(1);
|
||||||
--error 1370
|
--error ER_PROCACCESS_DENIED_ERROR
|
||||||
grant execute on procedure sptest.p1 to userb@localhost;
|
grant execute on procedure sptest.p1 to userb@localhost;
|
||||||
--error 1370
|
--error ER_PROCACCESS_DENIED_ERROR
|
||||||
drop procedure sptest.p1;
|
drop procedure sptest.p1;
|
||||||
|
|
||||||
connection con3userb;
|
connection con3userb;
|
||||||
--error 1370
|
--error ER_PROCACCESS_DENIED_ERROR
|
||||||
call sptest.p1(2);
|
call sptest.p1(2);
|
||||||
--error 1370
|
--error ER_PROCACCESS_DENIED_ERROR
|
||||||
grant execute on procedure sptest.p1 to userb@localhost;
|
grant execute on procedure sptest.p1 to userb@localhost;
|
||||||
--error 1370
|
--error ER_PROCACCESS_DENIED_ERROR
|
||||||
drop procedure sptest.p1;
|
drop procedure sptest.p1;
|
||||||
|
|
||||||
connection con4userc;
|
connection con4userc;
|
||||||
call sptest.p1(3);
|
call sptest.p1(3);
|
||||||
grant execute on procedure sptest.p1 to userb@localhost;
|
grant execute on procedure sptest.p1 to userb@localhost;
|
||||||
--error 1370
|
--error ER_PROCACCESS_DENIED_ERROR
|
||||||
drop procedure sptest.p1;
|
drop procedure sptest.p1;
|
||||||
|
|
||||||
connection con3userb;
|
connection con3userb;
|
||||||
call sptest.p1(4);
|
call sptest.p1(4);
|
||||||
--error 1370
|
--error ER_PROCACCESS_DENIED_ERROR
|
||||||
grant execute on procedure sptest.p1 to userb@localhost;
|
grant execute on procedure sptest.p1 to userb@localhost;
|
||||||
--error 1370
|
--error ER_PROCACCESS_DENIED_ERROR
|
||||||
drop procedure sptest.p1;
|
drop procedure sptest.p1;
|
||||||
|
|
||||||
connection con1root;
|
connection con1root;
|
||||||
@ -332,7 +350,7 @@ delimiter ;//
|
|||||||
connect (user1,localhost,user1,,test);
|
connect (user1,localhost,user1,,test);
|
||||||
connection user1;
|
connection user1;
|
||||||
use mysqltest;
|
use mysqltest;
|
||||||
-- error 1370
|
-- error ER_PROCACCESS_DENIED_ERROR
|
||||||
select bug_9503();
|
select bug_9503();
|
||||||
|
|
||||||
connection root;
|
connection root;
|
||||||
@ -401,13 +419,13 @@ grant usage on *.* to mysqltest_1@localhost;
|
|||||||
|
|
||||||
connect (n1,localhost,mysqltest_1,,information_schema,$MASTER_MYPORT,$MASTER_MYSOCK);
|
connect (n1,localhost,mysqltest_1,,information_schema,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||||
connection n1;
|
connection n1;
|
||||||
--error 1370
|
--error ER_PROCACCESS_DENIED_ERROR
|
||||||
call mysqltest_1.p1();
|
call mysqltest_1.p1();
|
||||||
disconnect n1;
|
disconnect n1;
|
||||||
# Test also without a current database
|
# Test also without a current database
|
||||||
connect (n2,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK);
|
connect (n2,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||||
connection n2;
|
connection n2;
|
||||||
--error 1370
|
--error ER_PROCACCESS_DENIED_ERROR
|
||||||
call mysqltest_1.p1();
|
call mysqltest_1.p1();
|
||||||
disconnect n2;
|
disconnect n2;
|
||||||
|
|
||||||
@ -433,9 +451,9 @@ end;
|
|||||||
create user user_bug12812@localhost IDENTIFIED BY 'ABC'|
|
create user user_bug12812@localhost IDENTIFIED BY 'ABC'|
|
||||||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
||||||
connect (test_user_12812,localhost,user_bug12812,ABC,test)|
|
connect (test_user_12812,localhost,user_bug12812,ABC,test)|
|
||||||
--error 1370
|
--error ER_PROCACCESS_DENIED_ERROR
|
||||||
SELECT test.bug12812()|
|
SELECT test.bug12812()|
|
||||||
--error 1370
|
--error ER_PROCACCESS_DENIED_ERROR
|
||||||
CREATE VIEW v1 AS SELECT test.bug12812()|
|
CREATE VIEW v1 AS SELECT test.bug12812()|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
connection default|
|
connection default|
|
||||||
@ -489,7 +507,8 @@ drop database db_bug14834;
|
|||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# BUG#14533: 'desc tbl' in stored procedure causes error 1142
|
# BUG#14533: 'desc tbl' in stored procedure causes error
|
||||||
|
# ER_TABLEACCESS_DENIED_ERROR
|
||||||
#
|
#
|
||||||
create database db_bug14533;
|
create database db_bug14533;
|
||||||
use db_bug14533;
|
use db_bug14533;
|
||||||
|
@ -7017,6 +7017,47 @@ INSERT INTO t3 VALUES (1, 3.4), (1, 2), (1, 0.9), (2, 8), (2, 7)|
|
|||||||
SELECT SUM(f2), bug25373(f1) FROM t3 GROUP BY bug25373(f1) WITH ROLLUP|
|
SELECT SUM(f2), bug25373(f1) FROM t3 GROUP BY bug25373(f1) WITH ROLLUP|
|
||||||
DROP FUNCTION bug25373|
|
DROP FUNCTION bug25373|
|
||||||
DROP TABLE t3|
|
DROP TABLE t3|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# BUG#25082: Default database change on trigger execution breaks replication.
|
||||||
|
#
|
||||||
|
# As it turned out, this bug has actually two bugs. So, here we have two test
|
||||||
|
# cases -- one in sp.test, the other in sp-security.test.
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test case 1: error on dropping the current database.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Prepare.
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
DROP DATABASE IF EXISTS mysqltest1|
|
||||||
|
DROP DATABASE IF EXISTS mysqltest2|
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
CREATE DATABASE mysqltest1|
|
||||||
|
CREATE DATABASE mysqltest2|
|
||||||
|
|
||||||
|
# Test.
|
||||||
|
|
||||||
|
CREATE PROCEDURE mysqltest1.p1()
|
||||||
|
DROP DATABASE mysqltest2|
|
||||||
|
|
||||||
|
use mysqltest2|
|
||||||
|
|
||||||
|
CALL mysqltest1.p1()|
|
||||||
|
|
||||||
|
SELECT DATABASE()|
|
||||||
|
|
||||||
|
# Cleanup.
|
||||||
|
|
||||||
|
DROP DATABASE mysqltest1|
|
||||||
|
|
||||||
|
use test|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug#20777: Function w BIGINT UNSIGNED shows diff. behaviour --ps-protocol
|
# Bug#20777: Function w BIGINT UNSIGNED shows diff. behaviour --ps-protocol
|
||||||
--disable_warnings
|
--disable_warnings
|
||||||
@ -7084,3 +7125,26 @@ delimiter |;
|
|||||||
delimiter ;|
|
delimiter ;|
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a int auto_increment primary key) engine=MyISAM;
|
||||||
|
CREATE TABLE t2 (a int auto_increment primary key, b int) engine=innodb;
|
||||||
|
set @a=0;
|
||||||
|
|
||||||
|
delimiter |;
|
||||||
|
CREATE function bug27354() RETURNS int deterministic
|
||||||
|
begin
|
||||||
|
insert into t1 values (null);
|
||||||
|
set @a=@a+1;
|
||||||
|
return @a;
|
||||||
|
end|
|
||||||
|
|
||||||
|
delimiter ;|
|
||||||
|
update t2 set b=1 where a=bug27354();
|
||||||
|
select count(t_1.a),count(t_2.a) from t1 as t_1, t2 as t_2 /* must be 0,0 */;
|
||||||
|
insert into t2 values (1,1),(2,2),(3,3);
|
||||||
|
update t2 set b=-b where a=bug27354();
|
||||||
|
select * from t2 /* must return 1,-1 ... */;
|
||||||
|
select count(*) from t1 /* must be 3 */;
|
||||||
|
|
||||||
|
|
||||||
|
drop table t1,t2;
|
||||||
|
drop function bug27354;
|
||||||
|
@ -592,6 +592,37 @@ drop function bug13575|
|
|||||||
drop table t3|
|
drop table t3|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #13270 INSERT,UPDATE,etc that calls func with side-effect does not binlog
|
||||||
|
# Bug #23333 stored function + non-transac table + transac table =
|
||||||
|
# breaks stmt-based binlog
|
||||||
|
# Bug #27395 OPTION_STATUS_NO_TRANS_UPDATE is not preserved at the end of SF()
|
||||||
|
#
|
||||||
|
--disable_warnings
|
||||||
|
drop function if exists bug23333|
|
||||||
|
drop table if exists t1,t2|
|
||||||
|
--enable_warnings
|
||||||
|
CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM|
|
||||||
|
CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB|
|
||||||
|
|
||||||
|
insert into t2 values (1,1)|
|
||||||
|
|
||||||
|
create function bug23333()
|
||||||
|
RETURNS int(11)
|
||||||
|
DETERMINISTIC
|
||||||
|
begin
|
||||||
|
insert into t1 values (null);
|
||||||
|
select count(*) from t1 into @a;
|
||||||
|
return @a;
|
||||||
|
end|
|
||||||
|
|
||||||
|
reset master|
|
||||||
|
--error ER_DUP_ENTRY
|
||||||
|
insert into t2 values (bug23333(),1)|
|
||||||
|
--replace_column 2 # 5 # 6 #
|
||||||
|
show binlog events from 98 /* with fixes for #23333 will show there is the query */|
|
||||||
|
select count(*),@a from t1 /* must be 1,1 */|
|
||||||
|
|
||||||
#
|
#
|
||||||
# BUG#NNNN: New bug synopsis
|
# BUG#NNNN: New bug synopsis
|
||||||
#
|
#
|
||||||
|
@ -123,3 +123,16 @@ insert into t1 values ('2000-01-01','2000-01-02');
|
|||||||
select 1 from t1 where cast('2000-01-01 12:01:01' as datetime) between start_date and end_date;
|
select 1 from t1 where cast('2000-01-01 12:01:01' as datetime) between start_date and end_date;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
# End of 4.1 tests
|
# End of 4.1 tests
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #23093: Implicit conversion of 9912101 to date does not match
|
||||||
|
# cast(9912101 as date)
|
||||||
|
#
|
||||||
|
select @d:=1111, year(@d), month(@d), day(@d), cast(@d as date);
|
||||||
|
select @d:=011111, year(@d), month(@d), day(@d), cast(@d as date);
|
||||||
|
select @d:=1311, year(@d), month(@d), day(@d), cast(@d as date);
|
||||||
|
create table t1 (d date , dt datetime , ts timestamp);
|
||||||
|
insert into t1 values (9912101,9912101,9912101);
|
||||||
|
insert into t1 values (11111,11111,11111);
|
||||||
|
select * from t1;
|
||||||
|
drop table t1;
|
||||||
|
@ -141,3 +141,25 @@ SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME) AS DECIMAL(20,6));
|
|||||||
SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME) + INTERVAL 14 MICROSECOND AS DECIMAL(20,6));
|
SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME) + INTERVAL 14 MICROSECOND AS DECIMAL(20,6));
|
||||||
SELECT CAST(CAST('10:11:12.098700' AS TIME) AS DECIMAL(20,6));
|
SELECT CAST(CAST('10:11:12.098700' AS TIME) AS DECIMAL(20,6));
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test of storing datetime into date fields
|
||||||
|
#
|
||||||
|
|
||||||
|
set @org_mode=@@sql_mode;
|
||||||
|
create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03');
|
||||||
|
show create table t1;
|
||||||
|
insert into t1 values ();
|
||||||
|
insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
|
||||||
|
set @@sql_mode='ansi,traditional';
|
||||||
|
insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
|
||||||
|
insert into t1 set dt='2007-03-23 13:49:38',da=dt;
|
||||||
|
# Test error handling
|
||||||
|
--error 1292
|
||||||
|
insert into t1 values ('2007-03-32','2007-03-23 13:49:38');
|
||||||
|
select * from t1;
|
||||||
|
drop table t1;
|
||||||
|
--error 1067
|
||||||
|
create table t1 (da date default '1962-03-32 23:33:34', dt datetime default '1962-03-03');
|
||||||
|
--error 1067
|
||||||
|
create table t1 (t time default '916:00:00 a');
|
||||||
|
set @@sql_mode= @org_mode;
|
||||||
|
@ -356,25 +356,6 @@ drop view mysqltest.v3;
|
|||||||
connection user1;
|
connection user1;
|
||||||
create view mysqltest.v3 as select b from mysqltest.t2;
|
create view mysqltest.v3 as select b from mysqltest.t2;
|
||||||
|
|
||||||
# give UPDATE and INSERT privilege (to get more privileges then underlying
|
|
||||||
# table)
|
|
||||||
connection root;
|
|
||||||
grant create view, update, insert on mysqltest.v3 to mysqltest_1@localhost;
|
|
||||||
drop view mysqltest.v3;
|
|
||||||
connection user1;
|
|
||||||
-- error 1143
|
|
||||||
create view mysqltest.v3 as select b from mysqltest.t2;
|
|
||||||
|
|
||||||
|
|
||||||
# If we would get more privileges on VIEW then we have on
|
|
||||||
# underlying tables => creation prohibited
|
|
||||||
connection root;
|
|
||||||
create table mysqltest.v3 (b int);
|
|
||||||
grant select(b) on mysqltest.v3 to mysqltest_1@localhost;
|
|
||||||
drop table mysqltest.v3;
|
|
||||||
connection user1;
|
|
||||||
-- error 1143
|
|
||||||
create view mysqltest.v3 as select b from mysqltest.t2;
|
|
||||||
|
|
||||||
# Expression need select privileges
|
# Expression need select privileges
|
||||||
-- error 1143
|
-- error 1143
|
||||||
@ -1072,6 +1053,97 @@ DROP USER u26813@localhost;
|
|||||||
DROP DATABASE db26813;
|
DROP DATABASE db26813;
|
||||||
disconnect u1;
|
disconnect u1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# BUG#24040: Create View don't succed with "all privileges" on a database.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Prepare.
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
DROP DATABASE IF EXISTS mysqltest1;
|
||||||
|
DROP DATABASE IF EXISTS mysqltest2;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
CREATE DATABASE mysqltest1;
|
||||||
|
CREATE DATABASE mysqltest2;
|
||||||
|
|
||||||
|
# Test.
|
||||||
|
|
||||||
|
CREATE TABLE mysqltest1.t1(c1 INT);
|
||||||
|
CREATE TABLE mysqltest1.t2(c2 INT);
|
||||||
|
CREATE TABLE mysqltest1.t3(c3 INT);
|
||||||
|
CREATE TABLE mysqltest1.t4(c4 INT);
|
||||||
|
|
||||||
|
INSERT INTO mysqltest1.t1 VALUES (11), (12), (13), (14);
|
||||||
|
INSERT INTO mysqltest1.t2 VALUES (21), (22), (23), (24);
|
||||||
|
INSERT INTO mysqltest1.t3 VALUES (31), (32), (33), (34);
|
||||||
|
INSERT INTO mysqltest1.t4 VALUES (41), (42), (43), (44);
|
||||||
|
|
||||||
|
GRANT SELECT ON mysqltest1.t1 TO mysqltest_u1@localhost;
|
||||||
|
GRANT INSERT ON mysqltest1.t2 TO mysqltest_u1@localhost;
|
||||||
|
GRANT SELECT, UPDATE ON mysqltest1.t3 TO mysqltest_u1@localhost;
|
||||||
|
GRANT SELECT, DELETE ON mysqltest1.t4 TO mysqltest_u1@localhost;
|
||||||
|
|
||||||
|
GRANT ALL PRIVILEGES ON mysqltest2.* TO mysqltest_u1@localhost;
|
||||||
|
|
||||||
|
--connect (bug24040_con,localhost,mysqltest_u1,,mysqltest2)
|
||||||
|
--echo
|
||||||
|
--echo ---> connection: bug24040_con
|
||||||
|
|
||||||
|
SELECT * FROM mysqltest1.t1;
|
||||||
|
INSERT INTO mysqltest1.t2 VALUES(25);
|
||||||
|
UPDATE mysqltest1.t3 SET c3 = 331 WHERE c3 = 31;
|
||||||
|
DELETE FROM mysqltest1.t4 WHERE c4 = 44;
|
||||||
|
|
||||||
|
CREATE VIEW v1 AS SELECT * FROM mysqltest1.t1;
|
||||||
|
CREATE VIEW v2 AS SELECT * FROM mysqltest1.t2;
|
||||||
|
CREATE VIEW v3 AS SELECT * FROM mysqltest1.t3;
|
||||||
|
CREATE VIEW v4 AS SELECT * FROM mysqltest1.t4;
|
||||||
|
|
||||||
|
SELECT * FROM v1;
|
||||||
|
INSERT INTO v2 VALUES(26);
|
||||||
|
UPDATE v3 SET c3 = 332 WHERE c3 = 32;
|
||||||
|
DELETE FROM v4 WHERE c4 = 43;
|
||||||
|
|
||||||
|
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||||
|
CREATE VIEW v12 AS SELECT c1, c2 FROM mysqltest1.t1, mysqltest1.t2;
|
||||||
|
CREATE VIEW v13 AS SELECT c1, c3 FROM mysqltest1.t1, mysqltest1.t3;
|
||||||
|
CREATE VIEW v14 AS SELECT c1, c4 FROM mysqltest1.t1, mysqltest1.t4;
|
||||||
|
|
||||||
|
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||||
|
CREATE VIEW v21 AS SELECT c2, c1 FROM mysqltest1.t2, mysqltest1.t1;
|
||||||
|
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||||
|
CREATE VIEW v23 AS SELECT c2, c3 FROM mysqltest1.t2, mysqltest1.t3;
|
||||||
|
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||||
|
CREATE VIEW v24 AS SELECT c2, c4 FROM mysqltest1.t2, mysqltest1.t4;
|
||||||
|
|
||||||
|
CREATE VIEW v31 AS SELECT c3, c1 FROM mysqltest1.t3, mysqltest1.t1;
|
||||||
|
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||||
|
CREATE VIEW v32 AS SELECT c3, c2 FROM mysqltest1.t3, mysqltest1.t2;
|
||||||
|
CREATE VIEW v34 AS SELECT c3, c4 FROM mysqltest1.t3, mysqltest1.t4;
|
||||||
|
|
||||||
|
CREATE VIEW v41 AS SELECT c4, c1 FROM mysqltest1.t4, mysqltest1.t1;
|
||||||
|
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||||
|
CREATE VIEW v42 AS SELECT c4, c2 FROM mysqltest1.t4, mysqltest1.t2;
|
||||||
|
CREATE VIEW v43 AS SELECT c4, c3 FROM mysqltest1.t4, mysqltest1.t3;
|
||||||
|
|
||||||
|
--connection default
|
||||||
|
--echo
|
||||||
|
--echo ---> connection: default
|
||||||
|
|
||||||
|
SELECT * FROM mysqltest1.t1;
|
||||||
|
SELECT * FROM mysqltest1.t2;
|
||||||
|
SELECT * FROM mysqltest1.t3;
|
||||||
|
SELECT * FROM mysqltest1.t4;
|
||||||
|
|
||||||
|
# Cleanup.
|
||||||
|
|
||||||
|
-- disconnect bug24040_con
|
||||||
|
|
||||||
|
DROP DATABASE mysqltest1;
|
||||||
|
DROP DATABASE mysqltest2;
|
||||||
|
DROP USER mysqltest_u1@localhost;
|
||||||
|
|
||||||
--echo End of 5.0 tests.
|
--echo End of 5.0 tests.
|
||||||
|
|
||||||
|
|
||||||
|
@ -557,4 +557,3 @@ HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, uchar *a)
|
|||||||
}
|
}
|
||||||
return keyseg;
|
return keyseg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -527,7 +527,7 @@ MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags)
|
|||||||
{
|
{
|
||||||
int m_used;
|
int m_used;
|
||||||
DBUG_ENTER("my_stat");
|
DBUG_ENTER("my_stat");
|
||||||
DBUG_PRINT("my", ("path: '%s', stat_area: 0x%lx, MyFlags: %d", path,
|
DBUG_PRINT("my", ("path: '%s' stat_area: 0x%lx MyFlags: %d", path,
|
||||||
(long) stat_area, my_flags));
|
(long) stat_area, my_flags));
|
||||||
|
|
||||||
if ((m_used= (stat_area == NULL)))
|
if ((m_used= (stat_area == NULL)))
|
||||||
|
@ -60,7 +60,7 @@ my_off_t my_seek(File fd, my_off_t pos, int whence,
|
|||||||
if (newpos == (os_off_t) -1)
|
if (newpos == (os_off_t) -1)
|
||||||
{
|
{
|
||||||
my_errno=errno;
|
my_errno=errno;
|
||||||
DBUG_PRINT("error",("lseek: %lu, errno: %d", (ulong) newpos,errno));
|
DBUG_PRINT("error",("lseek: %lu errno: %d", (ulong) newpos,errno));
|
||||||
DBUG_RETURN(MY_FILEPOS_ERROR);
|
DBUG_RETURN(MY_FILEPOS_ERROR);
|
||||||
}
|
}
|
||||||
if ((my_off_t) newpos != pos)
|
if ((my_off_t) newpos != pos)
|
||||||
|
@ -76,7 +76,10 @@ void init_thr_alarm(uint max_alarms)
|
|||||||
sigfillset(&full_signal_set); /* Neaded to block signals */
|
sigfillset(&full_signal_set); /* Neaded to block signals */
|
||||||
pthread_mutex_init(&LOCK_alarm,MY_MUTEX_INIT_FAST);
|
pthread_mutex_init(&LOCK_alarm,MY_MUTEX_INIT_FAST);
|
||||||
pthread_cond_init(&COND_alarm,NULL);
|
pthread_cond_init(&COND_alarm,NULL);
|
||||||
thr_client_alarm= thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1;
|
if (thd_lib_detected == THD_LIB_LT)
|
||||||
|
thr_client_alarm= SIGALRM;
|
||||||
|
else
|
||||||
|
thr_client_alarm= SIGUSR1;
|
||||||
#ifndef USE_ALARM_THREAD
|
#ifndef USE_ALARM_THREAD
|
||||||
if (thd_lib_detected != THD_LIB_LT)
|
if (thd_lib_detected != THD_LIB_LT)
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,6 +20,28 @@
|
|||||||
#include <m_ctype.h>
|
#include <m_ctype.h>
|
||||||
|
|
||||||
|
|
||||||
|
int find_type_or_exit(const char *x, TYPELIB *typelib, const char *option)
|
||||||
|
{
|
||||||
|
int res;
|
||||||
|
const char **ptr;
|
||||||
|
|
||||||
|
if ((res= find_type((my_string) x, typelib, 2)) <= 0)
|
||||||
|
{
|
||||||
|
ptr= typelib->type_names;
|
||||||
|
if (!*x)
|
||||||
|
fprintf(stderr, "No option given to %s\n", option);
|
||||||
|
else
|
||||||
|
fprintf(stderr, "Unknown option to %s: %s\n", option, x);
|
||||||
|
fprintf(stderr, "Alternatives are: '%s'", *ptr);
|
||||||
|
while (*++ptr)
|
||||||
|
fprintf(stderr, ",'%s'", *ptr);
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Search after a string in a list of strings. Endspace in x is not compared.
|
Search after a string in a list of strings. Endspace in x is not compared.
|
||||||
|
|
||||||
|
@ -456,7 +456,7 @@ err:
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Convert a time string to a TIME struct.
|
Convert a time string to a MYSQL_TIME struct.
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
str_to_time()
|
str_to_time()
|
||||||
@ -642,11 +642,11 @@ fractional:
|
|||||||
l_time->second_part= date[4];
|
l_time->second_part= date[4];
|
||||||
l_time->time_type= MYSQL_TIMESTAMP_TIME;
|
l_time->time_type= MYSQL_TIMESTAMP_TIME;
|
||||||
|
|
||||||
/* Check if the value is valid and fits into TIME range */
|
/* Check if the value is valid and fits into MYSQL_TIME range */
|
||||||
if (check_time_range(l_time, warning))
|
if (check_time_range(l_time, warning))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* Check if there is garbage at end of the TIME specification */
|
/* Check if there is garbage at end of the MYSQL_TIME specification */
|
||||||
if (str != end)
|
if (str != end)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
@ -663,11 +663,11 @@ fractional:
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Check 'time' value to lie in the TIME range
|
Check 'time' value to lie in the MYSQL_TIME range
|
||||||
|
|
||||||
SYNOPSIS:
|
SYNOPSIS:
|
||||||
check_time_range()
|
check_time_range()
|
||||||
time pointer to TIME value
|
time pointer to MYSQL_TIME value
|
||||||
warning set MYSQL_TIME_WARN_OUT_OF_RANGE flag if the value is out of range
|
warning set MYSQL_TIME_WARN_OUT_OF_RANGE flag if the value is out of range
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
@ -730,7 +730,39 @@ void init_time(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Calculate nr of day since year 0 in new date-system (from 1615) */
|
/*
|
||||||
|
Handle 2 digit year conversions
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
year_2000_handling()
|
||||||
|
year 2 digit year
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
Year between 1970-2069
|
||||||
|
*/
|
||||||
|
|
||||||
|
uint year_2000_handling(uint year)
|
||||||
|
{
|
||||||
|
if ((year=year+1900) < 1900+YY_PART_YEAR)
|
||||||
|
year+=100;
|
||||||
|
return year;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Calculate nr of day since year 0 in new date-system (from 1615)
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
calc_daynr()
|
||||||
|
year Year (exact 4 digit year, no year conversions)
|
||||||
|
month Month
|
||||||
|
day Day
|
||||||
|
|
||||||
|
NOTES: 0000-00-00 is a valid date, and will return 0
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
Days since 0000-00-00
|
||||||
|
*/
|
||||||
|
|
||||||
long calc_daynr(uint year,uint month,uint day)
|
long calc_daynr(uint year,uint month,uint day)
|
||||||
{
|
{
|
||||||
@ -740,11 +772,6 @@ long calc_daynr(uint year,uint month,uint day)
|
|||||||
|
|
||||||
if (year == 0 && month == 0 && day == 0)
|
if (year == 0 && month == 0 && day == 0)
|
||||||
DBUG_RETURN(0); /* Skip errors */
|
DBUG_RETURN(0); /* Skip errors */
|
||||||
if (year < YY_MAGIC_BELOW)
|
|
||||||
{
|
|
||||||
if ((year=year+1900) < 1900+YY_PART_YEAR)
|
|
||||||
year+=100;
|
|
||||||
}
|
|
||||||
delsum= (long) (365L * year+ 31*(month-1) +day);
|
delsum= (long) (365L * year+ 31*(month-1) +day);
|
||||||
if (month <= 2)
|
if (month <= 2)
|
||||||
year--;
|
year--;
|
||||||
@ -981,7 +1008,7 @@ void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type)
|
|||||||
/*
|
/*
|
||||||
Functions to convert time/date/datetime value to a string,
|
Functions to convert time/date/datetime value to a string,
|
||||||
using default format.
|
using default format.
|
||||||
This functions don't check that given TIME structure members are
|
This functions don't check that given MYSQL_TIME structure members are
|
||||||
in valid range. If they are not, return value won't reflect any
|
in valid range. If they are not, return value won't reflect any
|
||||||
valid date either. Additionally, make_time doesn't take into
|
valid date either. Additionally, make_time doesn't take into
|
||||||
account time->day member: it's assumed that days have been converted
|
account time->day member: it's assumed that days have been converted
|
||||||
@ -1067,7 +1094,7 @@ int my_TIME_to_str(const MYSQL_TIME *l_time, char *to)
|
|||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
Convert a datetime value of formats YYMMDD, YYYYMMDD, YYMMDDHHMSS,
|
Convert a datetime value of formats YYMMDD, YYYYMMDD, YYMMDDHHMSS,
|
||||||
YYYYMMDDHHMMSS to broken-down TIME representation. Return value in
|
YYYYMMDDHHMMSS to broken-down MYSQL_TIME representation. Return value in
|
||||||
YYYYMMDDHHMMSS format as side-effect.
|
YYYYMMDDHHMMSS format as side-effect.
|
||||||
|
|
||||||
This function also checks if datetime value fits in DATETIME range.
|
This function also checks if datetime value fits in DATETIME range.
|
||||||
@ -1123,6 +1150,7 @@ longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
|
|||||||
ok:
|
ok:
|
||||||
part1=(long) (nr/LL(1000000));
|
part1=(long) (nr/LL(1000000));
|
||||||
part2=(long) (nr - (longlong) part1*LL(1000000));
|
part2=(long) (nr - (longlong) part1*LL(1000000));
|
||||||
|
time_res->neg= 0;
|
||||||
time_res->year= (int) (part1/10000L); part1%=10000L;
|
time_res->year= (int) (part1/10000L); part1%=10000L;
|
||||||
time_res->month= (int) part1 / 100;
|
time_res->month= (int) part1 / 100;
|
||||||
time_res->day= (int) part1 % 100;
|
time_res->day= (int) part1 % 100;
|
||||||
@ -1159,7 +1187,7 @@ ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *my_time)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Convert TIME value to integer in YYYYMMDD format */
|
/* Convert MYSQL_TIME value to integer in YYYYMMDD format */
|
||||||
|
|
||||||
ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *my_time)
|
ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *my_time)
|
||||||
{
|
{
|
||||||
@ -1169,7 +1197,7 @@ ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *my_time)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Convert TIME value to integer in HHMMSS format.
|
Convert MYSQL_TIME value to integer in HHMMSS format.
|
||||||
This function doesn't take into account time->day member:
|
This function doesn't take into account time->day member:
|
||||||
it's assumed that days have been converted to hours already.
|
it's assumed that days have been converted to hours already.
|
||||||
*/
|
*/
|
||||||
@ -1183,7 +1211,7 @@ ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *my_time)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Convert struct TIME (date and time split into year/month/day/hour/...
|
Convert struct MYSQL_TIME (date and time split into year/month/day/hour/...
|
||||||
to a number in format YYYYMMDDHHMMSS (DATETIME),
|
to a number in format YYYYMMDDHHMMSS (DATETIME),
|
||||||
YYYYMMDD (DATE) or HHMMSS (TIME).
|
YYYYMMDD (DATE) or HHMMSS (TIME).
|
||||||
|
|
||||||
@ -1197,7 +1225,7 @@ ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *my_time)
|
|||||||
SELECT ?+1;
|
SELECT ?+1;
|
||||||
|
|
||||||
NOTE
|
NOTE
|
||||||
This function doesn't check that given TIME structure members are
|
This function doesn't check that given MYSQL_TIME structure members are
|
||||||
in valid range. If they are not, return value won't reflect any
|
in valid range. If they are not, return value won't reflect any
|
||||||
valid date either.
|
valid date either.
|
||||||
*/
|
*/
|
||||||
|
@ -79,7 +79,7 @@ ADD_EXECUTABLE(mysqld ../sql-common/client.c derror.cc des_key_file.cc
|
|||||||
${PROJECT_SOURCE_DIR}/sql/sql_builtin.cc
|
${PROJECT_SOURCE_DIR}/sql/sql_builtin.cc
|
||||||
${PROJECT_SOURCE_DIR}/sql/lex_hash.h)
|
${PROJECT_SOURCE_DIR}/sql/lex_hash.h)
|
||||||
TARGET_LINK_LIBRARIES(mysqld heap myisam myisammrg mysys yassl zlib dbug yassl
|
TARGET_LINK_LIBRARIES(mysqld heap myisam myisammrg mysys yassl zlib dbug yassl
|
||||||
taocrypt strings vio regex wsock32)
|
taocrypt strings vio regex wsock32 ws2_32)
|
||||||
IF(WITH_ARCHIVE_STORAGE_ENGINE)
|
IF(WITH_ARCHIVE_STORAGE_ENGINE)
|
||||||
TARGET_LINK_LIBRARIES(mysqld archive)
|
TARGET_LINK_LIBRARIES(mysqld archive)
|
||||||
ENDIF(WITH_ARCHIVE_STORAGE_ENGINE)
|
ENDIF(WITH_ARCHIVE_STORAGE_ENGINE)
|
||||||
|
@ -287,7 +287,7 @@ int
|
|||||||
Event_parse_data::init_execute_at(THD *thd)
|
Event_parse_data::init_execute_at(THD *thd)
|
||||||
{
|
{
|
||||||
my_bool not_used;
|
my_bool not_used;
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
my_time_t ltime_utc;
|
my_time_t ltime_utc;
|
||||||
|
|
||||||
DBUG_ENTER("Event_parse_data::init_execute_at");
|
DBUG_ENTER("Event_parse_data::init_execute_at");
|
||||||
@ -456,7 +456,7 @@ int
|
|||||||
Event_parse_data::init_starts(THD *thd)
|
Event_parse_data::init_starts(THD *thd)
|
||||||
{
|
{
|
||||||
my_bool not_used;
|
my_bool not_used;
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
my_time_t ltime_utc;
|
my_time_t ltime_utc;
|
||||||
|
|
||||||
DBUG_ENTER("Event_parse_data::init_starts");
|
DBUG_ENTER("Event_parse_data::init_starts");
|
||||||
@ -510,7 +510,7 @@ int
|
|||||||
Event_parse_data::init_ends(THD *thd)
|
Event_parse_data::init_ends(THD *thd)
|
||||||
{
|
{
|
||||||
my_bool not_used;
|
my_bool not_used;
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
my_time_t ltime_utc;
|
my_time_t ltime_utc;
|
||||||
|
|
||||||
DBUG_ENTER("Event_parse_data::init_ends");
|
DBUG_ENTER("Event_parse_data::init_ends");
|
||||||
@ -935,7 +935,7 @@ int
|
|||||||
Event_queue_element::load_from_row(THD *thd, TABLE *table)
|
Event_queue_element::load_from_row(THD *thd, TABLE *table)
|
||||||
{
|
{
|
||||||
char *ptr;
|
char *ptr;
|
||||||
TIME time;
|
MYSQL_TIME time;
|
||||||
|
|
||||||
DBUG_ENTER("Event_queue_element::load_from_row");
|
DBUG_ENTER("Event_queue_element::load_from_row");
|
||||||
|
|
||||||
@ -1120,7 +1120,7 @@ error:
|
|||||||
*/
|
*/
|
||||||
static
|
static
|
||||||
my_time_t
|
my_time_t
|
||||||
add_interval(TIME *ltime, const Time_zone *time_zone,
|
add_interval(MYSQL_TIME *ltime, const Time_zone *time_zone,
|
||||||
interval_type scale, INTERVAL interval)
|
interval_type scale, INTERVAL interval)
|
||||||
{
|
{
|
||||||
if (date_add_interval(ltime, scale, interval))
|
if (date_add_interval(ltime, scale, interval))
|
||||||
@ -1213,8 +1213,8 @@ bool get_next_time(const Time_zone *time_zone, my_time_t *next,
|
|||||||
}
|
}
|
||||||
DBUG_PRINT("info", ("seconds: %ld months: %ld", (long) seconds, (long) months));
|
DBUG_PRINT("info", ("seconds: %ld months: %ld", (long) seconds, (long) months));
|
||||||
|
|
||||||
TIME local_start;
|
MYSQL_TIME local_start;
|
||||||
TIME local_now;
|
MYSQL_TIME local_now;
|
||||||
|
|
||||||
/* Convert times from UTC to local. */
|
/* Convert times from UTC to local. */
|
||||||
{
|
{
|
||||||
@ -1457,7 +1457,7 @@ Event_queue_element::compute_next_execution_time()
|
|||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Both starts and m_ends are set and time_now is between them (incl.)
|
Both starts and m_ends are set and time_now is between them (incl.)
|
||||||
If last_executed is set then increase with m_expression. The new TIME is
|
If last_executed is set then increase with m_expression. The new MYSQL_TIME is
|
||||||
after m_ends set execute_at to 0. And check for on_completion
|
after m_ends set execute_at to 0. And check for on_completion
|
||||||
If not set then schedule for now.
|
If not set then schedule for now.
|
||||||
*/
|
*/
|
||||||
@ -1599,7 +1599,7 @@ err:
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Set the internal last_executed TIME struct to now. NOW is the
|
Set the internal last_executed MYSQL_TIME struct to now. NOW is the
|
||||||
time according to thd->query_start(), so the THD's clock.
|
time according to thd->query_start(), so the THD's clock.
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
@ -1666,7 +1666,7 @@ Event_queue_element::update_timing_fields(THD *thd)
|
|||||||
|
|
||||||
if (last_executed_changed)
|
if (last_executed_changed)
|
||||||
{
|
{
|
||||||
TIME time;
|
MYSQL_TIME time;
|
||||||
my_tz_UTC->gmt_sec_to_TIME(&time, last_executed);
|
my_tz_UTC->gmt_sec_to_TIME(&time, last_executed);
|
||||||
|
|
||||||
fields[ET_FIELD_LAST_EXECUTED]->set_notnull();
|
fields[ET_FIELD_LAST_EXECUTED]->set_notnull();
|
||||||
@ -1712,7 +1712,7 @@ append_datetime(String *buf, Time_zone *time_zone, my_time_t secs,
|
|||||||
Pass the buffer and the second param tells fills the buffer and
|
Pass the buffer and the second param tells fills the buffer and
|
||||||
returns the number of chars to copy.
|
returns the number of chars to copy.
|
||||||
*/
|
*/
|
||||||
TIME time;
|
MYSQL_TIME time;
|
||||||
time_zone->gmt_sec_to_TIME(&time, secs);
|
time_zone->gmt_sec_to_TIME(&time, secs);
|
||||||
buf->append(dtime_buff, my_datetime_to_str(&time, dtime_buff));
|
buf->append(dtime_buff, my_datetime_to_str(&time, dtime_buff));
|
||||||
buf->append(STRING_WITH_LEN("'"));
|
buf->append(STRING_WITH_LEN("'"));
|
||||||
|
@ -218,7 +218,7 @@ mysql_event_fill_row(THD *thd, TABLE *table, Event_parse_data *et,
|
|||||||
|
|
||||||
if (!et->starts_null)
|
if (!et->starts_null)
|
||||||
{
|
{
|
||||||
TIME time;
|
MYSQL_TIME time;
|
||||||
my_tz_UTC->gmt_sec_to_TIME(&time, et->starts);
|
my_tz_UTC->gmt_sec_to_TIME(&time, et->starts);
|
||||||
|
|
||||||
fields[ET_FIELD_STARTS]->set_notnull();
|
fields[ET_FIELD_STARTS]->set_notnull();
|
||||||
@ -227,7 +227,7 @@ mysql_event_fill_row(THD *thd, TABLE *table, Event_parse_data *et,
|
|||||||
|
|
||||||
if (!et->ends_null)
|
if (!et->ends_null)
|
||||||
{
|
{
|
||||||
TIME time;
|
MYSQL_TIME time;
|
||||||
my_tz_UTC->gmt_sec_to_TIME(&time, et->ends);
|
my_tz_UTC->gmt_sec_to_TIME(&time, et->ends);
|
||||||
|
|
||||||
fields[ET_FIELD_ENDS]->set_notnull();
|
fields[ET_FIELD_ENDS]->set_notnull();
|
||||||
@ -246,7 +246,7 @@ mysql_event_fill_row(THD *thd, TABLE *table, Event_parse_data *et,
|
|||||||
fields[ET_FIELD_STARTS]->set_null();
|
fields[ET_FIELD_STARTS]->set_null();
|
||||||
fields[ET_FIELD_ENDS]->set_null();
|
fields[ET_FIELD_ENDS]->set_null();
|
||||||
|
|
||||||
TIME time;
|
MYSQL_TIME time;
|
||||||
my_tz_UTC->gmt_sec_to_TIME(&time, et->execute_at);
|
my_tz_UTC->gmt_sec_to_TIME(&time, et->execute_at);
|
||||||
|
|
||||||
fields[ET_FIELD_EXECUTE_AT]->set_notnull();
|
fields[ET_FIELD_EXECUTE_AT]->set_notnull();
|
||||||
@ -653,7 +653,7 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
|
|||||||
|
|
||||||
ok:
|
ok:
|
||||||
if (dbchanged)
|
if (dbchanged)
|
||||||
(void) mysql_change_db(thd, old_db.str, 1);
|
(void) mysql_change_db(thd, &old_db, 1);
|
||||||
/*
|
/*
|
||||||
This statement may cause a spooky valgrind warning at startup
|
This statement may cause a spooky valgrind warning at startup
|
||||||
inside init_key_cache on my system (ahristov, 2006/08/10)
|
inside init_key_cache on my system (ahristov, 2006/08/10)
|
||||||
@ -663,7 +663,7 @@ ok:
|
|||||||
|
|
||||||
err:
|
err:
|
||||||
if (dbchanged)
|
if (dbchanged)
|
||||||
(void) mysql_change_db(thd, old_db.str, 1);
|
(void) mysql_change_db(thd, &old_db, 1);
|
||||||
if (table)
|
if (table)
|
||||||
close_thread_tables(thd);
|
close_thread_tables(thd);
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
|
@ -742,7 +742,7 @@ Event_queue::dump_internal_status()
|
|||||||
mutex_last_attempted_lock_at_line);
|
mutex_last_attempted_lock_at_line);
|
||||||
printf("WOC : %s\n", waiting_on_cond? "YES":"NO");
|
printf("WOC : %s\n", waiting_on_cond? "YES":"NO");
|
||||||
|
|
||||||
TIME time;
|
MYSQL_TIME time;
|
||||||
my_tz_UTC->gmt_sec_to_TIME(&time, next_activation_at);
|
my_tz_UTC->gmt_sec_to_TIME(&time, next_activation_at);
|
||||||
printf("Next activation : %04d-%02d-%02d %02d:%02d:%02d\n",
|
printf("Next activation : %04d-%02d-%02d %02d:%02d:%02d\n",
|
||||||
time.year, time.month, time.day, time.hour, time.minute, time.second);
|
time.year, time.month, time.day, time.hour, time.minute, time.second);
|
||||||
|
117
sql/field.cc
117
sql/field.cc
@ -1500,7 +1500,7 @@ uint Field::fill_cache_field(CACHE_FIELD *copy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Field::get_date(TIME *ltime,uint fuzzydate)
|
bool Field::get_date(MYSQL_TIME *ltime,uint fuzzydate)
|
||||||
{
|
{
|
||||||
char buff[40];
|
char buff[40];
|
||||||
String tmp(buff,sizeof(buff),&my_charset_bin),*res;
|
String tmp(buff,sizeof(buff),&my_charset_bin),*res;
|
||||||
@ -1511,7 +1511,7 @@ bool Field::get_date(TIME *ltime,uint fuzzydate)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Field::get_time(TIME *ltime)
|
bool Field::get_time(MYSQL_TIME *ltime)
|
||||||
{
|
{
|
||||||
char buff[40];
|
char buff[40];
|
||||||
String tmp(buff,sizeof(buff),&my_charset_bin),*res;
|
String tmp(buff,sizeof(buff),&my_charset_bin),*res;
|
||||||
@ -1528,7 +1528,7 @@ bool Field::get_time(TIME *ltime)
|
|||||||
Needs to be changed if/when we want to support different time formats
|
Needs to be changed if/when we want to support different time formats
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int Field::store_time(TIME *ltime, timestamp_type type_arg)
|
int Field::store_time(MYSQL_TIME *ltime, timestamp_type type_arg)
|
||||||
{
|
{
|
||||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||||
char buff[MAX_DATE_STRING_REP_LENGTH];
|
char buff[MAX_DATE_STRING_REP_LENGTH];
|
||||||
@ -2476,7 +2476,7 @@ int Field_new_decimal::store_decimal(const my_decimal *decimal_value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Field_new_decimal::store_time(TIME *ltime, timestamp_type t_type)
|
int Field_new_decimal::store_time(MYSQL_TIME *ltime, timestamp_type t_type)
|
||||||
{
|
{
|
||||||
my_decimal decimal_value;
|
my_decimal decimal_value;
|
||||||
return store_value(date2my_decimal(ltime, &decimal_value));
|
return store_value(date2my_decimal(ltime, &decimal_value));
|
||||||
@ -4522,7 +4522,7 @@ timestamp_auto_set_type Field_timestamp::get_auto_set_type() const
|
|||||||
int Field_timestamp::store(const char *from,uint len,CHARSET_INFO *cs)
|
int Field_timestamp::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||||
{
|
{
|
||||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||||
TIME l_time;
|
MYSQL_TIME l_time;
|
||||||
my_time_t tmp= 0;
|
my_time_t tmp= 0;
|
||||||
int error;
|
int error;
|
||||||
bool have_smth_to_conv;
|
bool have_smth_to_conv;
|
||||||
@ -4593,7 +4593,7 @@ int Field_timestamp::store(double nr)
|
|||||||
int Field_timestamp::store(longlong nr, bool unsigned_val)
|
int Field_timestamp::store(longlong nr, bool unsigned_val)
|
||||||
{
|
{
|
||||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||||
TIME l_time;
|
MYSQL_TIME l_time;
|
||||||
my_time_t timestamp= 0;
|
my_time_t timestamp= 0;
|
||||||
int error;
|
int error;
|
||||||
my_bool in_dst_time_gap;
|
my_bool in_dst_time_gap;
|
||||||
@ -4652,7 +4652,7 @@ longlong Field_timestamp::val_int(void)
|
|||||||
{
|
{
|
||||||
ASSERT_COLUMN_MARKED_FOR_READ;
|
ASSERT_COLUMN_MARKED_FOR_READ;
|
||||||
uint32 temp;
|
uint32 temp;
|
||||||
TIME time_tmp;
|
MYSQL_TIME time_tmp;
|
||||||
THD *thd= table ? table->in_use : current_thd;
|
THD *thd= table ? table->in_use : current_thd;
|
||||||
|
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
@ -4678,7 +4678,7 @@ String *Field_timestamp::val_str(String *val_buffer, String *val_ptr)
|
|||||||
{
|
{
|
||||||
ASSERT_COLUMN_MARKED_FOR_READ;
|
ASSERT_COLUMN_MARKED_FOR_READ;
|
||||||
uint32 temp, temp2;
|
uint32 temp, temp2;
|
||||||
TIME time_tmp;
|
MYSQL_TIME time_tmp;
|
||||||
THD *thd= table ? table->in_use : current_thd;
|
THD *thd= table ? table->in_use : current_thd;
|
||||||
char *to;
|
char *to;
|
||||||
|
|
||||||
@ -4747,7 +4747,7 @@ String *Field_timestamp::val_str(String *val_buffer, String *val_ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Field_timestamp::get_date(TIME *ltime, uint fuzzydate)
|
bool Field_timestamp::get_date(MYSQL_TIME *ltime, uint fuzzydate)
|
||||||
{
|
{
|
||||||
long temp;
|
long temp;
|
||||||
THD *thd= table ? table->in_use : current_thd;
|
THD *thd= table ? table->in_use : current_thd;
|
||||||
@ -4771,7 +4771,7 @@ bool Field_timestamp::get_date(TIME *ltime, uint fuzzydate)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Field_timestamp::get_time(TIME *ltime)
|
bool Field_timestamp::get_time(MYSQL_TIME *ltime)
|
||||||
{
|
{
|
||||||
return Field_timestamp::get_date(ltime,0);
|
return Field_timestamp::get_date(ltime,0);
|
||||||
}
|
}
|
||||||
@ -4779,7 +4779,7 @@ bool Field_timestamp::get_time(TIME *ltime)
|
|||||||
|
|
||||||
bool Field_timestamp::send_binary(Protocol *protocol)
|
bool Field_timestamp::send_binary(Protocol *protocol)
|
||||||
{
|
{
|
||||||
TIME tm;
|
MYSQL_TIME tm;
|
||||||
Field_timestamp::get_date(&tm, 0);
|
Field_timestamp::get_date(&tm, 0);
|
||||||
return protocol->store(&tm);
|
return protocol->store(&tm);
|
||||||
}
|
}
|
||||||
@ -4855,7 +4855,7 @@ void Field_timestamp::set_time()
|
|||||||
|
|
||||||
int Field_time::store(const char *from,uint len,CHARSET_INFO *cs)
|
int Field_time::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||||
{
|
{
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
long tmp;
|
long tmp;
|
||||||
int error= 0;
|
int error= 0;
|
||||||
int warning;
|
int warning;
|
||||||
@ -4870,9 +4870,12 @@ int Field_time::store(const char *from,uint len,CHARSET_INFO *cs)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (warning & MYSQL_TIME_WARN_TRUNCATED)
|
if (warning & MYSQL_TIME_WARN_TRUNCATED)
|
||||||
|
{
|
||||||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
WARN_DATA_TRUNCATED,
|
WARN_DATA_TRUNCATED,
|
||||||
from, len, MYSQL_TIMESTAMP_TIME, 1);
|
from, len, MYSQL_TIMESTAMP_TIME, 1);
|
||||||
|
error= 1;
|
||||||
|
}
|
||||||
if (warning & MYSQL_TIME_WARN_OUT_OF_RANGE)
|
if (warning & MYSQL_TIME_WARN_OUT_OF_RANGE)
|
||||||
{
|
{
|
||||||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
@ -4883,8 +4886,6 @@ int Field_time::store(const char *from,uint len,CHARSET_INFO *cs)
|
|||||||
if (ltime.month)
|
if (ltime.month)
|
||||||
ltime.day=0;
|
ltime.day=0;
|
||||||
tmp=(ltime.day*24L+ltime.hour)*10000L+(ltime.minute*100+ltime.second);
|
tmp=(ltime.day*24L+ltime.hour)*10000L+(ltime.minute*100+ltime.second);
|
||||||
if (error > 1)
|
|
||||||
error= 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ltime.neg)
|
if (ltime.neg)
|
||||||
@ -4894,7 +4895,7 @@ int Field_time::store(const char *from,uint len,CHARSET_INFO *cs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Field_time::store_time(TIME *ltime, timestamp_type time_type)
|
int Field_time::store_time(MYSQL_TIME *ltime, timestamp_type time_type)
|
||||||
{
|
{
|
||||||
long tmp= ((ltime->month ? 0 : ltime->day * 24L) + ltime->hour) * 10000L +
|
long tmp= ((ltime->month ? 0 : ltime->day * 24L) + ltime->hour) * 10000L +
|
||||||
(ltime->minute * 100 + ltime->second);
|
(ltime->minute * 100 + ltime->second);
|
||||||
@ -5003,7 +5004,7 @@ String *Field_time::val_str(String *val_buffer,
|
|||||||
String *val_ptr __attribute__((unused)))
|
String *val_ptr __attribute__((unused)))
|
||||||
{
|
{
|
||||||
ASSERT_COLUMN_MARKED_FOR_READ;
|
ASSERT_COLUMN_MARKED_FOR_READ;
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
val_buffer->alloc(19);
|
val_buffer->alloc(19);
|
||||||
long tmp=(long) sint3korr(ptr);
|
long tmp=(long) sint3korr(ptr);
|
||||||
ltime.neg= 0;
|
ltime.neg= 0;
|
||||||
@ -5027,7 +5028,7 @@ String *Field_time::val_str(String *val_buffer,
|
|||||||
DATE_FORMAT(time, "%l.%i %p")
|
DATE_FORMAT(time, "%l.%i %p")
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool Field_time::get_date(TIME *ltime, uint fuzzydate)
|
bool Field_time::get_date(MYSQL_TIME *ltime, uint fuzzydate)
|
||||||
{
|
{
|
||||||
long tmp;
|
long tmp;
|
||||||
THD *thd= table ? table->in_use : current_thd;
|
THD *thd= table ? table->in_use : current_thd;
|
||||||
@ -5055,7 +5056,7 @@ bool Field_time::get_date(TIME *ltime, uint fuzzydate)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Field_time::get_time(TIME *ltime)
|
bool Field_time::get_time(MYSQL_TIME *ltime)
|
||||||
{
|
{
|
||||||
long tmp=(long) sint3korr(ptr);
|
long tmp=(long) sint3korr(ptr);
|
||||||
ltime->neg=0;
|
ltime->neg=0;
|
||||||
@ -5077,7 +5078,7 @@ bool Field_time::get_time(TIME *ltime)
|
|||||||
|
|
||||||
bool Field_time::send_binary(Protocol *protocol)
|
bool Field_time::send_binary(Protocol *protocol)
|
||||||
{
|
{
|
||||||
TIME tm;
|
MYSQL_TIME tm;
|
||||||
Field_time::get_time(&tm);
|
Field_time::get_time(&tm);
|
||||||
tm.day= tm.hour/24; // Move hours to days
|
tm.day= tm.hour/24; // Move hours to days
|
||||||
tm.hour-= tm.day*24;
|
tm.hour-= tm.day*24;
|
||||||
@ -5226,7 +5227,7 @@ void Field_year::sql_type(String &res) const
|
|||||||
int Field_date::store(const char *from, uint len,CHARSET_INFO *cs)
|
int Field_date::store(const char *from, uint len,CHARSET_INFO *cs)
|
||||||
{
|
{
|
||||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||||
TIME l_time;
|
MYSQL_TIME l_time;
|
||||||
uint32 tmp;
|
uint32 tmp;
|
||||||
int error;
|
int error;
|
||||||
THD *thd= table ? table->in_use : current_thd;
|
THD *thd= table ? table->in_use : current_thd;
|
||||||
@ -5283,7 +5284,7 @@ int Field_date::store(double nr)
|
|||||||
int Field_date::store(longlong nr, bool unsigned_val)
|
int Field_date::store(longlong nr, bool unsigned_val)
|
||||||
{
|
{
|
||||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||||
TIME not_used;
|
MYSQL_TIME not_used;
|
||||||
int error;
|
int error;
|
||||||
longlong initial_nr= nr;
|
longlong initial_nr= nr;
|
||||||
THD *thd= table ? table->in_use : current_thd;
|
THD *thd= table ? table->in_use : current_thd;
|
||||||
@ -5324,7 +5325,7 @@ int Field_date::store(longlong nr, bool unsigned_val)
|
|||||||
bool Field_date::send_binary(Protocol *protocol)
|
bool Field_date::send_binary(Protocol *protocol)
|
||||||
{
|
{
|
||||||
longlong tmp= Field_date::val_int();
|
longlong tmp= Field_date::val_int();
|
||||||
TIME tm;
|
MYSQL_TIME tm;
|
||||||
tm.year= (uint32) tmp/10000L % 10000;
|
tm.year= (uint32) tmp/10000L % 10000;
|
||||||
tm.month= (uint32) tmp/100 % 100;
|
tm.month= (uint32) tmp/100 % 100;
|
||||||
tm.day= (uint32) tmp % 100;
|
tm.day= (uint32) tmp % 100;
|
||||||
@ -5364,7 +5365,7 @@ String *Field_date::val_str(String *val_buffer,
|
|||||||
String *val_ptr __attribute__((unused)))
|
String *val_ptr __attribute__((unused)))
|
||||||
{
|
{
|
||||||
ASSERT_COLUMN_MARKED_FOR_READ;
|
ASSERT_COLUMN_MARKED_FOR_READ;
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
val_buffer->alloc(field_length);
|
val_buffer->alloc(field_length);
|
||||||
int32 tmp;
|
int32 tmp;
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
@ -5433,10 +5434,27 @@ void Field_date::sql_type(String &res) const
|
|||||||
** In number context: YYYYMMDD
|
** In number context: YYYYMMDD
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Store string into a date field
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
Field_newdate::store()
|
||||||
|
from Date string
|
||||||
|
len Length of date field
|
||||||
|
cs Character set (not used)
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
0 ok
|
||||||
|
1 Value was cut during conversion
|
||||||
|
2 Wrong date string
|
||||||
|
3 Datetime value that was cut (warning level NOTE)
|
||||||
|
*/
|
||||||
|
|
||||||
int Field_newdate::store(const char *from,uint len,CHARSET_INFO *cs)
|
int Field_newdate::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||||
{
|
{
|
||||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||||
TIME l_time;
|
long tmp;
|
||||||
|
MYSQL_TIME l_time;
|
||||||
int error;
|
int error;
|
||||||
THD *thd= table ? table->in_use : current_thd;
|
THD *thd= table ? table->in_use : current_thd;
|
||||||
enum enum_mysql_timestamp_type ret;
|
enum enum_mysql_timestamp_type ret;
|
||||||
@ -5447,20 +5465,23 @@ int Field_newdate::store(const char *from,uint len,CHARSET_INFO *cs)
|
|||||||
MODE_INVALID_DATES))),
|
MODE_INVALID_DATES))),
|
||||||
&error)) <= MYSQL_TIMESTAMP_ERROR)
|
&error)) <= MYSQL_TIMESTAMP_ERROR)
|
||||||
{
|
{
|
||||||
int3store(ptr,0L);
|
tmp= 0;
|
||||||
error= 2;
|
error= 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int3store(ptr, l_time.day + l_time.month*32 + l_time.year*16*32);
|
tmp= l_time.day + l_time.month*32 + l_time.year*16*32;
|
||||||
if (!error && (ret != MYSQL_TIMESTAMP_DATE))
|
if (!error && (ret != MYSQL_TIMESTAMP_DATE))
|
||||||
return 2;
|
error= 3; // Datetime was cut (note)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED,
|
set_datetime_warning(error == 3 ? MYSQL_ERROR::WARN_LEVEL_NOTE :
|
||||||
|
MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
|
WARN_DATA_TRUNCATED,
|
||||||
from, len, MYSQL_TIMESTAMP_DATE, 1);
|
from, len, MYSQL_TIMESTAMP_DATE, 1);
|
||||||
|
|
||||||
|
int3store(ptr, tmp);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5481,7 +5502,7 @@ int Field_newdate::store(double nr)
|
|||||||
int Field_newdate::store(longlong nr, bool unsigned_val)
|
int Field_newdate::store(longlong nr, bool unsigned_val)
|
||||||
{
|
{
|
||||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||||
TIME l_time;
|
MYSQL_TIME l_time;
|
||||||
longlong tmp;
|
longlong tmp;
|
||||||
int error;
|
int error;
|
||||||
THD *thd= table ? table->in_use : current_thd;
|
THD *thd= table ? table->in_use : current_thd;
|
||||||
@ -5508,7 +5529,7 @@ int Field_newdate::store(longlong nr, bool unsigned_val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Field_newdate::store_time(TIME *ltime,timestamp_type time_type)
|
int Field_newdate::store_time(MYSQL_TIME *ltime,timestamp_type time_type)
|
||||||
{
|
{
|
||||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||||
long tmp;
|
long tmp;
|
||||||
@ -5543,7 +5564,7 @@ int Field_newdate::store_time(TIME *ltime,timestamp_type time_type)
|
|||||||
|
|
||||||
bool Field_newdate::send_binary(Protocol *protocol)
|
bool Field_newdate::send_binary(Protocol *protocol)
|
||||||
{
|
{
|
||||||
TIME tm;
|
MYSQL_TIME tm;
|
||||||
Field_newdate::get_date(&tm,0);
|
Field_newdate::get_date(&tm,0);
|
||||||
return protocol->store_date(&tm);
|
return protocol->store_date(&tm);
|
||||||
}
|
}
|
||||||
@ -5594,7 +5615,7 @@ String *Field_newdate::val_str(String *val_buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Field_newdate::get_date(TIME *ltime,uint fuzzydate)
|
bool Field_newdate::get_date(MYSQL_TIME *ltime,uint fuzzydate)
|
||||||
{
|
{
|
||||||
uint32 tmp=(uint32) uint3korr(ptr);
|
uint32 tmp=(uint32) uint3korr(ptr);
|
||||||
ltime->day= tmp & 31;
|
ltime->day= tmp & 31;
|
||||||
@ -5607,7 +5628,7 @@ bool Field_newdate::get_date(TIME *ltime,uint fuzzydate)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Field_newdate::get_time(TIME *ltime)
|
bool Field_newdate::get_time(MYSQL_TIME *ltime)
|
||||||
{
|
{
|
||||||
return Field_newdate::get_date(ltime,0);
|
return Field_newdate::get_date(ltime,0);
|
||||||
}
|
}
|
||||||
@ -5646,7 +5667,7 @@ void Field_newdate::sql_type(String &res) const
|
|||||||
int Field_datetime::store(const char *from,uint len,CHARSET_INFO *cs)
|
int Field_datetime::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||||
{
|
{
|
||||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||||
TIME time_tmp;
|
MYSQL_TIME time_tmp;
|
||||||
int error;
|
int error;
|
||||||
ulonglong tmp= 0;
|
ulonglong tmp= 0;
|
||||||
enum enum_mysql_timestamp_type func_res;
|
enum enum_mysql_timestamp_type func_res;
|
||||||
@ -5699,7 +5720,7 @@ int Field_datetime::store(double nr)
|
|||||||
int Field_datetime::store(longlong nr, bool unsigned_val)
|
int Field_datetime::store(longlong nr, bool unsigned_val)
|
||||||
{
|
{
|
||||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||||
TIME not_used;
|
MYSQL_TIME not_used;
|
||||||
int error;
|
int error;
|
||||||
longlong initial_nr= nr;
|
longlong initial_nr= nr;
|
||||||
THD *thd= table ? table->in_use : current_thd;
|
THD *thd= table ? table->in_use : current_thd;
|
||||||
@ -5734,7 +5755,7 @@ int Field_datetime::store(longlong nr, bool unsigned_val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Field_datetime::store_time(TIME *ltime,timestamp_type time_type)
|
int Field_datetime::store_time(MYSQL_TIME *ltime,timestamp_type time_type)
|
||||||
{
|
{
|
||||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||||
longlong tmp;
|
longlong tmp;
|
||||||
@ -5780,7 +5801,7 @@ int Field_datetime::store_time(TIME *ltime,timestamp_type time_type)
|
|||||||
|
|
||||||
bool Field_datetime::send_binary(Protocol *protocol)
|
bool Field_datetime::send_binary(Protocol *protocol)
|
||||||
{
|
{
|
||||||
TIME tm;
|
MYSQL_TIME tm;
|
||||||
Field_datetime::get_date(&tm, TIME_FUZZY_DATE);
|
Field_datetime::get_date(&tm, TIME_FUZZY_DATE);
|
||||||
return protocol->store(&tm);
|
return protocol->store(&tm);
|
||||||
}
|
}
|
||||||
@ -5854,7 +5875,7 @@ String *Field_datetime::val_str(String *val_buffer,
|
|||||||
return val_buffer;
|
return val_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Field_datetime::get_date(TIME *ltime, uint fuzzydate)
|
bool Field_datetime::get_date(MYSQL_TIME *ltime, uint fuzzydate)
|
||||||
{
|
{
|
||||||
longlong tmp=Field_datetime::val_int();
|
longlong tmp=Field_datetime::val_int();
|
||||||
uint32 part1,part2;
|
uint32 part1,part2;
|
||||||
@ -5873,7 +5894,7 @@ bool Field_datetime::get_date(TIME *ltime, uint fuzzydate)
|
|||||||
return (!(fuzzydate & TIME_FUZZY_DATE) && (!ltime->month || !ltime->day)) ? 1 : 0;
|
return (!(fuzzydate & TIME_FUZZY_DATE) && (!ltime->month || !ltime->day)) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Field_datetime::get_time(TIME *ltime)
|
bool Field_datetime::get_time(MYSQL_TIME *ltime)
|
||||||
{
|
{
|
||||||
return Field_datetime::get_date(ltime,0);
|
return Field_datetime::get_date(ltime,0);
|
||||||
}
|
}
|
||||||
@ -9440,10 +9461,13 @@ uint32 Field_blob::max_display_length()
|
|||||||
|
|
||||||
NOTE
|
NOTE
|
||||||
This function won't produce warning and increase cut fields counter
|
This function won't produce warning and increase cut fields counter
|
||||||
if count_cuted_fields == FIELD_CHECK_IGNORE for current thread.
|
if count_cuted_fields == CHECK_FIELD_IGNORE for current thread.
|
||||||
|
|
||||||
|
if count_cuted_fields == CHECK_FIELD_IGNORE then we ignore notes.
|
||||||
|
This allows us to avoid notes in optimisation, like convert_constant_item().
|
||||||
|
|
||||||
RETURN VALUE
|
RETURN VALUE
|
||||||
1 if count_cuted_fields == FIELD_CHECK_IGNORE
|
1 if count_cuted_fields == CHECK_FIELD_IGNORE and error level is not NOTE
|
||||||
0 otherwise
|
0 otherwise
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -9463,7 +9487,7 @@ Field::set_warning(MYSQL_ERROR::enum_warning_level level, uint code,
|
|||||||
thd->row_count);
|
thd->row_count);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return level >= MYSQL_ERROR::WARN_LEVEL_WARN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -9491,9 +9515,10 @@ Field::set_datetime_warning(MYSQL_ERROR::enum_warning_level level, uint code,
|
|||||||
timestamp_type ts_type, int cuted_increment)
|
timestamp_type ts_type, int cuted_increment)
|
||||||
{
|
{
|
||||||
THD *thd= table ? table->in_use : current_thd;
|
THD *thd= table ? table->in_use : current_thd;
|
||||||
if (thd->really_abort_on_warning() ||
|
if ((thd->really_abort_on_warning() &&
|
||||||
|
level >= MYSQL_ERROR::WARN_LEVEL_WARN) ||
|
||||||
set_warning(level, code, cuted_increment))
|
set_warning(level, code, cuted_increment))
|
||||||
make_truncated_value_warning(thd, str, str_length, ts_type,
|
make_truncated_value_warning(thd, level, str, str_length, ts_type,
|
||||||
field_name);
|
field_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9526,7 +9551,7 @@ Field::set_datetime_warning(MYSQL_ERROR::enum_warning_level level, uint code,
|
|||||||
{
|
{
|
||||||
char str_nr[22];
|
char str_nr[22];
|
||||||
char *str_end= longlong10_to_str(nr, str_nr, -10);
|
char *str_end= longlong10_to_str(nr, str_nr, -10);
|
||||||
make_truncated_value_warning(thd, str_nr, (uint) (str_end - str_nr),
|
make_truncated_value_warning(thd, level, str_nr, (uint) (str_end - str_nr),
|
||||||
ts_type, field_name);
|
ts_type, field_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -9559,7 +9584,7 @@ Field::set_datetime_warning(MYSQL_ERROR::enum_warning_level level, uint code,
|
|||||||
/* DBL_DIG is enough to print '-[digits].E+###' */
|
/* DBL_DIG is enough to print '-[digits].E+###' */
|
||||||
char str_nr[DBL_DIG + 8];
|
char str_nr[DBL_DIG + 8];
|
||||||
uint str_len= my_sprintf(str_nr, (str_nr, "%g", nr));
|
uint str_len= my_sprintf(str_nr, (str_nr, "%g", nr));
|
||||||
make_truncated_value_warning(thd, str_nr, str_len, ts_type,
|
make_truncated_value_warning(thd, level, str_nr, str_len, ts_type,
|
||||||
field_name);
|
field_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
30
sql/field.h
30
sql/field.h
@ -98,7 +98,7 @@ public:
|
|||||||
virtual int store(double nr)=0;
|
virtual int store(double nr)=0;
|
||||||
virtual int store(longlong nr, bool unsigned_val)=0;
|
virtual int store(longlong nr, bool unsigned_val)=0;
|
||||||
virtual int store_decimal(const my_decimal *d)=0;
|
virtual int store_decimal(const my_decimal *d)=0;
|
||||||
virtual int store_time(TIME *ltime, timestamp_type t_type);
|
virtual int store_time(MYSQL_TIME *ltime, timestamp_type t_type);
|
||||||
virtual double val_real(void)=0;
|
virtual double val_real(void)=0;
|
||||||
virtual longlong val_int(void)=0;
|
virtual longlong val_int(void)=0;
|
||||||
virtual my_decimal *val_decimal(my_decimal *);
|
virtual my_decimal *val_decimal(my_decimal *);
|
||||||
@ -347,8 +347,8 @@ public:
|
|||||||
}
|
}
|
||||||
void copy_from_tmp(int offset);
|
void copy_from_tmp(int offset);
|
||||||
uint fill_cache_field(struct st_cache_field *copy);
|
uint fill_cache_field(struct st_cache_field *copy);
|
||||||
virtual bool get_date(TIME *ltime,uint fuzzydate);
|
virtual bool get_date(MYSQL_TIME *ltime,uint fuzzydate);
|
||||||
virtual bool get_time(TIME *ltime);
|
virtual bool get_time(MYSQL_TIME *ltime);
|
||||||
virtual CHARSET_INFO *charset(void) const { return &my_charset_bin; }
|
virtual CHARSET_INFO *charset(void) const { return &my_charset_bin; }
|
||||||
virtual CHARSET_INFO *sort_charset(void) const { return charset(); }
|
virtual CHARSET_INFO *sort_charset(void) const { return charset(); }
|
||||||
virtual bool has_charset(void) const { return FALSE; }
|
virtual bool has_charset(void) const { return FALSE; }
|
||||||
@ -564,7 +564,7 @@ public:
|
|||||||
int store(const char *to, uint length, CHARSET_INFO *charset);
|
int store(const char *to, uint length, CHARSET_INFO *charset);
|
||||||
int store(double nr);
|
int store(double nr);
|
||||||
int store(longlong nr, bool unsigned_val);
|
int store(longlong nr, bool unsigned_val);
|
||||||
int store_time(TIME *ltime, timestamp_type t_type);
|
int store_time(MYSQL_TIME *ltime, timestamp_type t_type);
|
||||||
int store_decimal(const my_decimal *);
|
int store_decimal(const my_decimal *);
|
||||||
double val_real(void);
|
double val_real(void);
|
||||||
longlong val_int(void);
|
longlong val_int(void);
|
||||||
@ -907,8 +907,8 @@ public:
|
|||||||
longget(tmp,ptr);
|
longget(tmp,ptr);
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
bool get_date(TIME *ltime,uint fuzzydate);
|
bool get_date(MYSQL_TIME *ltime,uint fuzzydate);
|
||||||
bool get_time(TIME *ltime);
|
bool get_time(MYSQL_TIME *ltime);
|
||||||
timestamp_auto_set_type get_auto_set_type() const;
|
timestamp_auto_set_type get_auto_set_type() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -981,7 +981,7 @@ public:
|
|||||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||||
int store(double nr);
|
int store(double nr);
|
||||||
int store(longlong nr, bool unsigned_val);
|
int store(longlong nr, bool unsigned_val);
|
||||||
int store_time(TIME *ltime, timestamp_type type);
|
int store_time(MYSQL_TIME *ltime, timestamp_type type);
|
||||||
int reset(void) { ptr[0]=ptr[1]=ptr[2]=0; return 0; }
|
int reset(void) { ptr[0]=ptr[1]=ptr[2]=0; return 0; }
|
||||||
double val_real(void);
|
double val_real(void);
|
||||||
longlong val_int(void);
|
longlong val_int(void);
|
||||||
@ -993,8 +993,8 @@ public:
|
|||||||
void sql_type(String &str) const;
|
void sql_type(String &str) const;
|
||||||
bool can_be_compared_as_longlong() const { return TRUE; }
|
bool can_be_compared_as_longlong() const { return TRUE; }
|
||||||
bool zero_pack() const { return 1; }
|
bool zero_pack() const { return 1; }
|
||||||
bool get_date(TIME *ltime,uint fuzzydate);
|
bool get_date(MYSQL_TIME *ltime,uint fuzzydate);
|
||||||
bool get_time(TIME *ltime);
|
bool get_time(MYSQL_TIME *ltime);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1013,7 +1013,7 @@ public:
|
|||||||
enum_field_types type() const { return MYSQL_TYPE_TIME;}
|
enum_field_types type() const { return MYSQL_TYPE_TIME;}
|
||||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_INT24; }
|
enum ha_base_keytype key_type() const { return HA_KEYTYPE_INT24; }
|
||||||
enum Item_result cmp_type () const { return INT_RESULT; }
|
enum Item_result cmp_type () const { return INT_RESULT; }
|
||||||
int store_time(TIME *ltime, timestamp_type type);
|
int store_time(MYSQL_TIME *ltime, timestamp_type type);
|
||||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||||
int store(double nr);
|
int store(double nr);
|
||||||
int store(longlong nr, bool unsigned_val);
|
int store(longlong nr, bool unsigned_val);
|
||||||
@ -1021,9 +1021,9 @@ public:
|
|||||||
double val_real(void);
|
double val_real(void);
|
||||||
longlong val_int(void);
|
longlong val_int(void);
|
||||||
String *val_str(String*,String *);
|
String *val_str(String*,String *);
|
||||||
bool get_date(TIME *ltime, uint fuzzydate);
|
bool get_date(MYSQL_TIME *ltime, uint fuzzydate);
|
||||||
bool send_binary(Protocol *protocol);
|
bool send_binary(Protocol *protocol);
|
||||||
bool get_time(TIME *ltime);
|
bool get_time(MYSQL_TIME *ltime);
|
||||||
int cmp(const char *,const char*);
|
int cmp(const char *,const char*);
|
||||||
void sort_string(char *buff,uint length);
|
void sort_string(char *buff,uint length);
|
||||||
uint32 pack_length() const { return 3; }
|
uint32 pack_length() const { return 3; }
|
||||||
@ -1054,7 +1054,7 @@ public:
|
|||||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||||
int store(double nr);
|
int store(double nr);
|
||||||
int store(longlong nr, bool unsigned_val);
|
int store(longlong nr, bool unsigned_val);
|
||||||
int store_time(TIME *ltime, timestamp_type type);
|
int store_time(MYSQL_TIME *ltime, timestamp_type type);
|
||||||
int reset(void)
|
int reset(void)
|
||||||
{
|
{
|
||||||
ptr[0]=ptr[1]=ptr[2]=ptr[3]=ptr[4]=ptr[5]=ptr[6]=ptr[7]=0;
|
ptr[0]=ptr[1]=ptr[2]=ptr[3]=ptr[4]=ptr[5]=ptr[6]=ptr[7]=0;
|
||||||
@ -1070,8 +1070,8 @@ public:
|
|||||||
void sql_type(String &str) const;
|
void sql_type(String &str) const;
|
||||||
bool can_be_compared_as_longlong() const { return TRUE; }
|
bool can_be_compared_as_longlong() const { return TRUE; }
|
||||||
bool zero_pack() const { return 1; }
|
bool zero_pack() const { return 1; }
|
||||||
bool get_date(TIME *ltime,uint fuzzydate);
|
bool get_date(MYSQL_TIME *ltime,uint fuzzydate);
|
||||||
bool get_time(TIME *ltime);
|
bool get_time(MYSQL_TIME *ltime);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -4151,8 +4151,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
|
|||||||
{
|
{
|
||||||
m_transaction_on= FALSE;
|
m_transaction_on= FALSE;
|
||||||
/* Would be simpler if has_transactions() didn't always say "yes" */
|
/* Would be simpler if has_transactions() didn't always say "yes" */
|
||||||
thd->options|= OPTION_STATUS_NO_TRANS_UPDATE;
|
thd->no_trans_update.all= thd->no_trans_update.stmt= TRUE;
|
||||||
thd->no_trans_update= TRUE;
|
|
||||||
}
|
}
|
||||||
else if (!thd->transaction.on)
|
else if (!thd->transaction.on)
|
||||||
m_transaction_on= FALSE;
|
m_transaction_on= FALSE;
|
||||||
@ -4838,7 +4837,7 @@ int ha_ndbcluster::create(const char *name,
|
|||||||
for (i= 0; i < form->s->fields; i++)
|
for (i= 0; i < form->s->fields; i++)
|
||||||
{
|
{
|
||||||
Field *field= form->field[i];
|
Field *field= form->field[i];
|
||||||
DBUG_PRINT("info", ("name: %s, type: %u, pack_length: %d",
|
DBUG_PRINT("info", ("name: %s type: %u pack_length: %d",
|
||||||
field->field_name, field->real_type(),
|
field->field_name, field->real_type(),
|
||||||
field->pack_length()));
|
field->pack_length()));
|
||||||
if ((my_errno= create_ndb_column(col, field, create_info)))
|
if ((my_errno= create_ndb_column(col, field, create_info)))
|
||||||
|
@ -844,7 +844,7 @@ int ha_rollback_trans(THD *thd, bool all)
|
|||||||
the error log; but we don't want users to wonder why they have this
|
the error log; but we don't want users to wonder why they have this
|
||||||
message in the error log, so we don't send it.
|
message in the error log, so we don't send it.
|
||||||
*/
|
*/
|
||||||
if (is_real_trans && (thd->options & OPTION_STATUS_NO_TRANS_UPDATE) &&
|
if (is_real_trans && thd->no_trans_update.all &&
|
||||||
!thd->slave_thread && thd->killed != THD::KILL_CONNECTION)
|
!thd->slave_thread && thd->killed != THD::KILL_CONNECTION)
|
||||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
ER_WARNING_NOT_COMPLETE_ROLLBACK,
|
ER_WARNING_NOT_COMPLETE_ROLLBACK,
|
||||||
|
63
sql/item.cc
63
sql/item.cc
@ -267,7 +267,7 @@ my_decimal *Item::val_decimal_from_string(my_decimal *decimal_value)
|
|||||||
my_decimal *Item::val_decimal_from_date(my_decimal *decimal_value)
|
my_decimal *Item::val_decimal_from_date(my_decimal *decimal_value)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
if (get_date(<ime, TIME_FUZZY_DATE))
|
if (get_date(<ime, TIME_FUZZY_DATE))
|
||||||
{
|
{
|
||||||
my_decimal_set_zero(decimal_value);
|
my_decimal_set_zero(decimal_value);
|
||||||
@ -280,7 +280,7 @@ my_decimal *Item::val_decimal_from_date(my_decimal *decimal_value)
|
|||||||
my_decimal *Item::val_decimal_from_time(my_decimal *decimal_value)
|
my_decimal *Item::val_decimal_from_time(my_decimal *decimal_value)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
if (get_time(<ime))
|
if (get_time(<ime))
|
||||||
{
|
{
|
||||||
my_decimal_set_zero(decimal_value);
|
my_decimal_set_zero(decimal_value);
|
||||||
@ -315,7 +315,7 @@ longlong Item::val_int_from_decimal()
|
|||||||
|
|
||||||
int Item::save_time_in_field(Field *field)
|
int Item::save_time_in_field(Field *field)
|
||||||
{
|
{
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
if (get_time(<ime))
|
if (get_time(<ime))
|
||||||
return set_field_to_null(field);
|
return set_field_to_null(field);
|
||||||
field->set_notnull();
|
field->set_notnull();
|
||||||
@ -325,7 +325,7 @@ int Item::save_time_in_field(Field *field)
|
|||||||
|
|
||||||
int Item::save_date_in_field(Field *field)
|
int Item::save_date_in_field(Field *field)
|
||||||
{
|
{
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
if (get_date(<ime, TIME_FUZZY_DATE))
|
if (get_date(<ime, TIME_FUZZY_DATE))
|
||||||
return set_field_to_null(field);
|
return set_field_to_null(field);
|
||||||
field->set_notnull();
|
field->set_notnull();
|
||||||
@ -853,22 +853,40 @@ bool Item_string::eq(const Item *item, bool binary_cmp) const
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Get the value of the function as a TIME structure.
|
Get the value of the function as a MYSQL_TIME structure.
|
||||||
As a extra convenience the time structure is reset on error!
|
As a extra convenience the time structure is reset on error!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool Item::get_date(TIME *ltime,uint fuzzydate)
|
bool Item::get_date(MYSQL_TIME *ltime,uint fuzzydate)
|
||||||
|
{
|
||||||
|
if (result_type() == STRING_RESULT)
|
||||||
{
|
{
|
||||||
char buff[40];
|
char buff[40];
|
||||||
String tmp(buff,sizeof(buff), &my_charset_bin),*res;
|
String tmp(buff,sizeof(buff), &my_charset_bin),*res;
|
||||||
if (!(res=val_str(&tmp)) ||
|
if (!(res=val_str(&tmp)) ||
|
||||||
str_to_datetime_with_warn(res->ptr(), res->length(),
|
str_to_datetime_with_warn(res->ptr(), res->length(),
|
||||||
ltime, fuzzydate) <= MYSQL_TIMESTAMP_ERROR)
|
ltime, fuzzydate) <= MYSQL_TIMESTAMP_ERROR)
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
bzero((char*) ltime,sizeof(*ltime));
|
longlong value= val_int();
|
||||||
return 1;
|
int was_cut;
|
||||||
|
if (number_to_datetime(value, ltime, fuzzydate, &was_cut) == LL(-1))
|
||||||
|
{
|
||||||
|
char buff[22], *end;
|
||||||
|
end= longlong10_to_str(value, buff, -10);
|
||||||
|
make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
|
buff, (int) (end-buff), MYSQL_TIMESTAMP_NONE,
|
||||||
|
NullS);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err:
|
||||||
|
bzero((char*) ltime,sizeof(*ltime));
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -876,7 +894,7 @@ bool Item::get_date(TIME *ltime,uint fuzzydate)
|
|||||||
As a extra convenience the time structure is reset on error!
|
As a extra convenience the time structure is reset on error!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool Item::get_time(TIME *ltime)
|
bool Item::get_time(MYSQL_TIME *ltime)
|
||||||
{
|
{
|
||||||
char buff[40];
|
char buff[40];
|
||||||
String tmp(buff,sizeof(buff),&my_charset_bin),*res;
|
String tmp(buff,sizeof(buff),&my_charset_bin),*res;
|
||||||
@ -1873,7 +1891,7 @@ String *Item_field::str_result(String *str)
|
|||||||
return result_field->val_str(str,&str_value);
|
return result_field->val_str(str,&str_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Item_field::get_date(TIME *ltime,uint fuzzydate)
|
bool Item_field::get_date(MYSQL_TIME *ltime,uint fuzzydate)
|
||||||
{
|
{
|
||||||
if ((null_value=field->is_null()) || field->get_date(ltime,fuzzydate))
|
if ((null_value=field->is_null()) || field->get_date(ltime,fuzzydate))
|
||||||
{
|
{
|
||||||
@ -1883,7 +1901,7 @@ bool Item_field::get_date(TIME *ltime,uint fuzzydate)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Item_field::get_date_result(TIME *ltime,uint fuzzydate)
|
bool Item_field::get_date_result(MYSQL_TIME *ltime,uint fuzzydate)
|
||||||
{
|
{
|
||||||
if ((null_value=result_field->is_null()) ||
|
if ((null_value=result_field->is_null()) ||
|
||||||
result_field->get_date(ltime,fuzzydate))
|
result_field->get_date(ltime,fuzzydate))
|
||||||
@ -1894,7 +1912,7 @@ bool Item_field::get_date_result(TIME *ltime,uint fuzzydate)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Item_field::get_time(TIME *ltime)
|
bool Item_field::get_time(MYSQL_TIME *ltime)
|
||||||
{
|
{
|
||||||
if ((null_value=field->is_null()) || field->get_time(ltime))
|
if ((null_value=field->is_null()) || field->get_time(ltime))
|
||||||
{
|
{
|
||||||
@ -2421,7 +2439,7 @@ void Item_param::set_decimal(const char *str, ulong length)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Set parameter value from TIME value.
|
Set parameter value from MYSQL_TIME value.
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
set_time()
|
set_time()
|
||||||
@ -2435,7 +2453,7 @@ void Item_param::set_decimal(const char *str, ulong length)
|
|||||||
the fact that even wrong value sent over binary protocol fits into
|
the fact that even wrong value sent over binary protocol fits into
|
||||||
MAX_DATE_STRING_REP_LENGTH buffer.
|
MAX_DATE_STRING_REP_LENGTH buffer.
|
||||||
*/
|
*/
|
||||||
void Item_param::set_time(TIME *tm, timestamp_type time_type,
|
void Item_param::set_time(MYSQL_TIME *tm, timestamp_type time_type,
|
||||||
uint32 max_length_arg)
|
uint32 max_length_arg)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("Item_param::set_time");
|
DBUG_ENTER("Item_param::set_time");
|
||||||
@ -2450,7 +2468,8 @@ void Item_param::set_time(TIME *tm, timestamp_type time_type,
|
|||||||
{
|
{
|
||||||
char buff[MAX_DATE_STRING_REP_LENGTH];
|
char buff[MAX_DATE_STRING_REP_LENGTH];
|
||||||
uint length= my_TIME_to_str(&value.time, buff);
|
uint length= my_TIME_to_str(&value.time, buff);
|
||||||
make_truncated_value_warning(current_thd, buff, length, time_type, 0);
|
make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
|
buff, length, time_type, 0);
|
||||||
set_zero_time(&value.time, MYSQL_TIMESTAMP_ERROR);
|
set_zero_time(&value.time, MYSQL_TIMESTAMP_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2652,7 +2671,7 @@ int Item_param::save_in_field(Field *field, bool no_conversions)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Item_param::get_time(TIME *res)
|
bool Item_param::get_time(MYSQL_TIME *res)
|
||||||
{
|
{
|
||||||
if (state == TIME_VALUE)
|
if (state == TIME_VALUE)
|
||||||
{
|
{
|
||||||
@ -2667,7 +2686,7 @@ bool Item_param::get_time(TIME *res)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Item_param::get_date(TIME *res, uint fuzzydate)
|
bool Item_param::get_date(MYSQL_TIME *res, uint fuzzydate)
|
||||||
{
|
{
|
||||||
if (state == TIME_VALUE)
|
if (state == TIME_VALUE)
|
||||||
{
|
{
|
||||||
@ -3093,7 +3112,7 @@ String* Item_ref_null_helper::val_str(String* s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Item_ref_null_helper::get_date(TIME *ltime, uint fuzzydate)
|
bool Item_ref_null_helper::get_date(MYSQL_TIME *ltime, uint fuzzydate)
|
||||||
{
|
{
|
||||||
return (owner->was_null|= null_value= (*ref)->get_date(ltime, fuzzydate));
|
return (owner->was_null|= null_value= (*ref)->get_date(ltime, fuzzydate));
|
||||||
}
|
}
|
||||||
@ -4931,7 +4950,7 @@ bool Item::send(Protocol *protocol, String *buffer)
|
|||||||
case MYSQL_TYPE_DATE:
|
case MYSQL_TYPE_DATE:
|
||||||
case MYSQL_TYPE_TIMESTAMP:
|
case MYSQL_TYPE_TIMESTAMP:
|
||||||
{
|
{
|
||||||
TIME tm;
|
MYSQL_TIME tm;
|
||||||
get_date(&tm, TIME_FUZZY_DATE);
|
get_date(&tm, TIME_FUZZY_DATE);
|
||||||
if (!null_value)
|
if (!null_value)
|
||||||
{
|
{
|
||||||
@ -4944,7 +4963,7 @@ bool Item::send(Protocol *protocol, String *buffer)
|
|||||||
}
|
}
|
||||||
case MYSQL_TYPE_TIME:
|
case MYSQL_TYPE_TIME:
|
||||||
{
|
{
|
||||||
TIME tm;
|
MYSQL_TIME tm;
|
||||||
get_time(&tm);
|
get_time(&tm);
|
||||||
if (!null_value)
|
if (!null_value)
|
||||||
result= protocol->store_time(&tm);
|
result= protocol->store_time(&tm);
|
||||||
@ -5496,7 +5515,7 @@ bool Item_ref::is_null()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Item_ref::get_date(TIME *ltime,uint fuzzydate)
|
bool Item_ref::get_date(MYSQL_TIME *ltime,uint fuzzydate)
|
||||||
{
|
{
|
||||||
return (null_value=(*ref)->get_date_result(ltime,fuzzydate));
|
return (null_value=(*ref)->get_date_result(ltime,fuzzydate));
|
||||||
}
|
}
|
||||||
@ -5595,7 +5614,7 @@ bool Item_direct_ref::is_null()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Item_direct_ref::get_date(TIME *ltime,uint fuzzydate)
|
bool Item_direct_ref::get_date(MYSQL_TIME *ltime,uint fuzzydate)
|
||||||
{
|
{
|
||||||
return (null_value=(*ref)->get_date(ltime,fuzzydate));
|
return (null_value=(*ref)->get_date(ltime,fuzzydate));
|
||||||
}
|
}
|
||||||
|
26
sql/item.h
26
sql/item.h
@ -730,9 +730,9 @@ public:
|
|||||||
/* Called for items that really have to be split */
|
/* Called for items that really have to be split */
|
||||||
void split_sum_func2(THD *thd, Item **ref_pointer_array, List<Item> &fields,
|
void split_sum_func2(THD *thd, Item **ref_pointer_array, List<Item> &fields,
|
||||||
Item **ref, bool skip_registered);
|
Item **ref, bool skip_registered);
|
||||||
virtual bool get_date(TIME *ltime,uint fuzzydate);
|
virtual bool get_date(MYSQL_TIME *ltime,uint fuzzydate);
|
||||||
virtual bool get_time(TIME *ltime);
|
virtual bool get_time(MYSQL_TIME *ltime);
|
||||||
virtual bool get_date_result(TIME *ltime,uint fuzzydate)
|
virtual bool get_date_result(MYSQL_TIME *ltime,uint fuzzydate)
|
||||||
{ return get_date(ltime,fuzzydate); }
|
{ return get_date(ltime,fuzzydate); }
|
||||||
/*
|
/*
|
||||||
This function is used only in Item_func_isnull/Item_func_isnotnull
|
This function is used only in Item_func_isnull/Item_func_isnotnull
|
||||||
@ -1373,9 +1373,9 @@ public:
|
|||||||
}
|
}
|
||||||
Field *get_tmp_table_field() { return result_field; }
|
Field *get_tmp_table_field() { return result_field; }
|
||||||
Field *tmp_table_field(TABLE *t_arg) { return result_field; }
|
Field *tmp_table_field(TABLE *t_arg) { return result_field; }
|
||||||
bool get_date(TIME *ltime,uint fuzzydate);
|
bool get_date(MYSQL_TIME *ltime,uint fuzzydate);
|
||||||
bool get_date_result(TIME *ltime,uint fuzzydate);
|
bool get_date_result(MYSQL_TIME *ltime,uint fuzzydate);
|
||||||
bool get_time(TIME *ltime);
|
bool get_time(MYSQL_TIME *ltime);
|
||||||
bool is_null() { return field->is_null(); }
|
bool is_null() { return field->is_null(); }
|
||||||
void update_null_value();
|
void update_null_value();
|
||||||
Item *get_tmp_table_item(THD *thd);
|
Item *get_tmp_table_item(THD *thd);
|
||||||
@ -1499,7 +1499,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
CHARSET_INFO *final_character_set_of_str_value;
|
CHARSET_INFO *final_character_set_of_str_value;
|
||||||
} cs_info;
|
} cs_info;
|
||||||
TIME time;
|
MYSQL_TIME time;
|
||||||
} value;
|
} value;
|
||||||
|
|
||||||
/* Cached values for virtual methods to save us one switch. */
|
/* Cached values for virtual methods to save us one switch. */
|
||||||
@ -1531,8 +1531,8 @@ public:
|
|||||||
longlong val_int();
|
longlong val_int();
|
||||||
my_decimal *val_decimal(my_decimal*);
|
my_decimal *val_decimal(my_decimal*);
|
||||||
String *val_str(String*);
|
String *val_str(String*);
|
||||||
bool get_time(TIME *tm);
|
bool get_time(MYSQL_TIME *tm);
|
||||||
bool get_date(TIME *tm, uint fuzzydate);
|
bool get_date(MYSQL_TIME *tm, uint fuzzydate);
|
||||||
int save_in_field(Field *field, bool no_conversions);
|
int save_in_field(Field *field, bool no_conversions);
|
||||||
|
|
||||||
void set_null();
|
void set_null();
|
||||||
@ -1541,7 +1541,7 @@ public:
|
|||||||
void set_decimal(const char *str, ulong length);
|
void set_decimal(const char *str, ulong length);
|
||||||
bool set_str(const char *str, ulong length);
|
bool set_str(const char *str, ulong length);
|
||||||
bool set_longdata(const char *str, ulong length);
|
bool set_longdata(const char *str, ulong length);
|
||||||
void set_time(TIME *tm, timestamp_type type, uint32 max_length_arg);
|
void set_time(MYSQL_TIME *tm, timestamp_type type, uint32 max_length_arg);
|
||||||
bool set_from_user_var(THD *thd, const user_var_entry *entry);
|
bool set_from_user_var(THD *thd, const user_var_entry *entry);
|
||||||
void reset();
|
void reset();
|
||||||
/*
|
/*
|
||||||
@ -1980,7 +1980,7 @@ public:
|
|||||||
bool val_bool();
|
bool val_bool();
|
||||||
String *val_str(String* tmp);
|
String *val_str(String* tmp);
|
||||||
bool is_null();
|
bool is_null();
|
||||||
bool get_date(TIME *ltime,uint fuzzydate);
|
bool get_date(MYSQL_TIME *ltime,uint fuzzydate);
|
||||||
double val_result();
|
double val_result();
|
||||||
longlong val_int_result();
|
longlong val_int_result();
|
||||||
String *str_result(String* tmp);
|
String *str_result(String* tmp);
|
||||||
@ -2057,7 +2057,7 @@ public:
|
|||||||
my_decimal *val_decimal(my_decimal *);
|
my_decimal *val_decimal(my_decimal *);
|
||||||
bool val_bool();
|
bool val_bool();
|
||||||
bool is_null();
|
bool is_null();
|
||||||
bool get_date(TIME *ltime,uint fuzzydate);
|
bool get_date(MYSQL_TIME *ltime,uint fuzzydate);
|
||||||
virtual Ref_Type ref_type() { return DIRECT_REF; }
|
virtual Ref_Type ref_type() { return DIRECT_REF; }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2143,7 +2143,7 @@ public:
|
|||||||
String* val_str(String* s);
|
String* val_str(String* s);
|
||||||
my_decimal *val_decimal(my_decimal *);
|
my_decimal *val_decimal(my_decimal *);
|
||||||
bool val_bool();
|
bool val_bool();
|
||||||
bool get_date(TIME *ltime, uint fuzzydate);
|
bool get_date(MYSQL_TIME *ltime, uint fuzzydate);
|
||||||
void print(String *str);
|
void print(String *str);
|
||||||
/*
|
/*
|
||||||
we add RAND_TABLE_BIT to prevent moving this item from HAVING to WHERE
|
we add RAND_TABLE_BIT to prevent moving this item from HAVING to WHERE
|
||||||
|
@ -293,6 +293,7 @@ static bool convert_constant_item(THD *thd, Field *field, Item **item)
|
|||||||
{
|
{
|
||||||
TABLE *table= field->table;
|
TABLE *table= field->table;
|
||||||
ulong orig_sql_mode= thd->variables.sql_mode;
|
ulong orig_sql_mode= thd->variables.sql_mode;
|
||||||
|
enum_check_fields orig_count_cuted_fields= thd->count_cuted_fields;
|
||||||
my_bitmap_map *old_write_map;
|
my_bitmap_map *old_write_map;
|
||||||
my_bitmap_map *old_read_map;
|
my_bitmap_map *old_read_map;
|
||||||
|
|
||||||
@ -306,6 +307,7 @@ static bool convert_constant_item(THD *thd, Field *field, Item **item)
|
|||||||
}
|
}
|
||||||
/* For comparison purposes allow invalid dates like 2000-01-32 */
|
/* For comparison purposes allow invalid dates like 2000-01-32 */
|
||||||
thd->variables.sql_mode|= MODE_INVALID_DATES;
|
thd->variables.sql_mode|= MODE_INVALID_DATES;
|
||||||
|
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
|
||||||
if (!(*item)->save_in_field(field, 1) && !((*item)->null_value))
|
if (!(*item)->save_in_field(field, 1) && !((*item)->null_value))
|
||||||
{
|
{
|
||||||
Item *tmp= new Item_int_with_ref(field->val_int(), *item,
|
Item *tmp= new Item_int_with_ref(field->val_int(), *item,
|
||||||
@ -315,6 +317,7 @@ static bool convert_constant_item(THD *thd, Field *field, Item **item)
|
|||||||
result= 1; // Item was replaced
|
result= 1; // Item was replaced
|
||||||
}
|
}
|
||||||
thd->variables.sql_mode= orig_sql_mode;
|
thd->variables.sql_mode= orig_sql_mode;
|
||||||
|
thd->count_cuted_fields= orig_count_cuted_fields;
|
||||||
if (table)
|
if (table)
|
||||||
{
|
{
|
||||||
dbug_tmp_restore_column_map(table->write_set, old_write_map);
|
dbug_tmp_restore_column_map(table->write_set, old_write_map);
|
||||||
@ -2402,7 +2405,7 @@ byte *in_row::get_value(Item *item)
|
|||||||
void in_row::set(uint pos, Item *item)
|
void in_row::set(uint pos, Item *item)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("in_row::set");
|
DBUG_ENTER("in_row::set");
|
||||||
DBUG_PRINT("enter", ("pos %u item 0x%lx", pos, (ulong) item));
|
DBUG_PRINT("enter", ("pos: %u item: 0x%lx", pos, (ulong) item));
|
||||||
((cmp_item_row*) base)[pos].store_value_by_template(&tmp, item);
|
((cmp_item_row*) base)[pos].store_value_by_template(&tmp, item);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
@ -147,11 +147,11 @@ public:
|
|||||||
void count_only_length();
|
void count_only_length();
|
||||||
void count_real_length();
|
void count_real_length();
|
||||||
void count_decimal_length();
|
void count_decimal_length();
|
||||||
inline bool get_arg0_date(TIME *ltime, uint fuzzy_date)
|
inline bool get_arg0_date(MYSQL_TIME *ltime, uint fuzzy_date)
|
||||||
{
|
{
|
||||||
return (null_value=args[0]->get_date(ltime, fuzzy_date));
|
return (null_value=args[0]->get_date(ltime, fuzzy_date));
|
||||||
}
|
}
|
||||||
inline bool get_arg0_time(TIME *ltime)
|
inline bool get_arg0_time(MYSQL_TIME *ltime)
|
||||||
{
|
{
|
||||||
return (null_value=args[0]->get_time(ltime));
|
return (null_value=args[0]->get_time(ltime));
|
||||||
}
|
}
|
||||||
@ -1454,6 +1454,8 @@ public:
|
|||||||
virtual ~Item_func_sp()
|
virtual ~Item_func_sp()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
table_map used_tables() const { return RAND_TABLE_BIT; }
|
||||||
|
|
||||||
void cleanup();
|
void cleanup();
|
||||||
|
|
||||||
const char *func_name() const;
|
const char *func_name() const;
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
the microseconds twice.
|
the microseconds twice.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool make_datetime(date_time_format_types format, TIME *ltime,
|
static bool make_datetime(date_time_format_types format, MYSQL_TIME *ltime,
|
||||||
String *str)
|
String *str)
|
||||||
{
|
{
|
||||||
char *buff;
|
char *buff;
|
||||||
@ -95,7 +95,7 @@ static bool make_datetime(date_time_format_types format, TIME *ltime,
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Wrapper over make_datetime() with validation of the input TIME value
|
Wrapper over make_datetime() with validation of the input MYSQL_TIME value
|
||||||
|
|
||||||
NOTE
|
NOTE
|
||||||
see make_datetime() for more information
|
see make_datetime() for more information
|
||||||
@ -105,7 +105,7 @@ static bool make_datetime(date_time_format_types format, TIME *ltime,
|
|||||||
0 otherwise
|
0 otherwise
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool make_datetime_with_warn(date_time_format_types format, TIME *ltime,
|
static bool make_datetime_with_warn(date_time_format_types format, MYSQL_TIME *ltime,
|
||||||
String *str)
|
String *str)
|
||||||
{
|
{
|
||||||
int warning= 0;
|
int warning= 0;
|
||||||
@ -117,14 +117,15 @@ static bool make_datetime_with_warn(date_time_format_types format, TIME *ltime,
|
|||||||
if (!warning)
|
if (!warning)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
make_truncated_value_warning(current_thd, str->ptr(), str->length(),
|
make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
|
str->ptr(), str->length(),
|
||||||
MYSQL_TIMESTAMP_TIME, NullS);
|
MYSQL_TIMESTAMP_TIME, NullS);
|
||||||
return make_datetime(format, ltime, str);
|
return make_datetime(format, ltime, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Wrapper over make_time() with validation of the input TIME value
|
Wrapper over make_time() with validation of the input MYSQL_TIME value
|
||||||
|
|
||||||
NOTE
|
NOTE
|
||||||
see make_time() for more info
|
see make_time() for more info
|
||||||
@ -135,7 +136,7 @@ static bool make_datetime_with_warn(date_time_format_types format, TIME *ltime,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static bool make_time_with_warn(const DATE_TIME_FORMAT *format,
|
static bool make_time_with_warn(const DATE_TIME_FORMAT *format,
|
||||||
TIME *l_time, String *str)
|
MYSQL_TIME *l_time, String *str)
|
||||||
{
|
{
|
||||||
int warning= 0;
|
int warning= 0;
|
||||||
make_time(format, l_time, str);
|
make_time(format, l_time, str);
|
||||||
@ -143,7 +144,8 @@ static bool make_time_with_warn(const DATE_TIME_FORMAT *format,
|
|||||||
return 1;
|
return 1;
|
||||||
if (warning)
|
if (warning)
|
||||||
{
|
{
|
||||||
make_truncated_value_warning(current_thd, str->ptr(), str->length(),
|
make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
|
str->ptr(), str->length(),
|
||||||
MYSQL_TIMESTAMP_TIME, NullS);
|
MYSQL_TIMESTAMP_TIME, NullS);
|
||||||
make_time(format, l_time, str);
|
make_time(format, l_time, str);
|
||||||
}
|
}
|
||||||
@ -153,16 +155,16 @@ static bool make_time_with_warn(const DATE_TIME_FORMAT *format,
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Convert seconds to TIME value with overflow checking
|
Convert seconds to MYSQL_TIME value with overflow checking
|
||||||
|
|
||||||
SYNOPSIS:
|
SYNOPSIS:
|
||||||
sec_to_time()
|
sec_to_time()
|
||||||
seconds number of seconds
|
seconds number of seconds
|
||||||
unsigned_flag 1, if 'seconds' is unsigned, 0, otherwise
|
unsigned_flag 1, if 'seconds' is unsigned, 0, otherwise
|
||||||
ltime output TIME value
|
ltime output MYSQL_TIME value
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
If the 'seconds' argument is inside TIME data range, convert it to a
|
If the 'seconds' argument is inside MYSQL_TIME data range, convert it to a
|
||||||
corresponding value.
|
corresponding value.
|
||||||
Otherwise, truncate the resulting value to the nearest endpoint, and
|
Otherwise, truncate the resulting value to the nearest endpoint, and
|
||||||
produce a warning message.
|
produce a warning message.
|
||||||
@ -172,7 +174,7 @@ static bool make_time_with_warn(const DATE_TIME_FORMAT *format,
|
|||||||
0 otherwise
|
0 otherwise
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool sec_to_time(longlong seconds, bool unsigned_flag, TIME *ltime)
|
static bool sec_to_time(longlong seconds, bool unsigned_flag, MYSQL_TIME *ltime)
|
||||||
{
|
{
|
||||||
uint sec;
|
uint sec;
|
||||||
|
|
||||||
@ -205,7 +207,8 @@ overflow:
|
|||||||
char buf[22];
|
char buf[22];
|
||||||
int len= (int)(longlong10_to_str(seconds, buf, unsigned_flag ? 10 : -10)
|
int len= (int)(longlong10_to_str(seconds, buf, unsigned_flag ? 10 : -10)
|
||||||
- buf);
|
- buf);
|
||||||
make_truncated_value_warning(current_thd, buf, len, MYSQL_TIMESTAMP_TIME,
|
make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
|
buf, len, MYSQL_TIMESTAMP_TIME,
|
||||||
NullS);
|
NullS);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -224,7 +227,7 @@ static DATE_TIME_FORMAT time_24hrs_format= {{0}, '\0', 0,
|
|||||||
{(char *)"%H:%i:%S", 8}};
|
{(char *)"%H:%i:%S", 8}};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Extract datetime value to TIME struct from string value
|
Extract datetime value to MYSQL_TIME struct from string value
|
||||||
according to format string.
|
according to format string.
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
@ -257,7 +260,7 @@ static DATE_TIME_FORMAT time_24hrs_format= {{0}, '\0', 0,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static bool extract_date_time(DATE_TIME_FORMAT *format,
|
static bool extract_date_time(DATE_TIME_FORMAT *format,
|
||||||
const char *val, uint length, TIME *l_time,
|
const char *val, uint length, MYSQL_TIME *l_time,
|
||||||
timestamp_type cached_timestamp_type,
|
timestamp_type cached_timestamp_type,
|
||||||
const char **sub_pattern_end,
|
const char **sub_pattern_end,
|
||||||
const char *date_time_type)
|
const char *date_time_type)
|
||||||
@ -305,13 +308,15 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
|
|||||||
case 'Y':
|
case 'Y':
|
||||||
tmp= (char*) val + min(4, val_len);
|
tmp= (char*) val + min(4, val_len);
|
||||||
l_time->year= (int) my_strtoll10(val, &tmp, &error);
|
l_time->year= (int) my_strtoll10(val, &tmp, &error);
|
||||||
|
if ((int) (tmp-val) <= 2)
|
||||||
|
l_time->year= year_2000_handling(l_time->year);
|
||||||
val= tmp;
|
val= tmp;
|
||||||
break;
|
break;
|
||||||
case 'y':
|
case 'y':
|
||||||
tmp= (char*) val + min(2, val_len);
|
tmp= (char*) val + min(2, val_len);
|
||||||
l_time->year= (int) my_strtoll10(val, &tmp, &error);
|
l_time->year= (int) my_strtoll10(val, &tmp, &error);
|
||||||
val= tmp;
|
val= tmp;
|
||||||
l_time->year+= (l_time->year < YY_PART_YEAR ? 2000 : 1900);
|
l_time->year= year_2000_handling(l_time->year);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Month */
|
/* Month */
|
||||||
@ -514,7 +519,8 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
|
|||||||
|
|
||||||
if (yearday > 0)
|
if (yearday > 0)
|
||||||
{
|
{
|
||||||
uint days= calc_daynr(l_time->year,1,1) + yearday - 1;
|
uint days;
|
||||||
|
days= calc_daynr(l_time->year,1,1) + yearday - 1;
|
||||||
if (days <= 0 || days > MAX_DAY_NUMBER)
|
if (days <= 0 || days > MAX_DAY_NUMBER)
|
||||||
goto err;
|
goto err;
|
||||||
get_date_from_daynr(days,&l_time->year,&l_time->month,&l_time->day);
|
get_date_from_daynr(days,&l_time->year,&l_time->month,&l_time->day);
|
||||||
@ -576,7 +582,8 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
|
|||||||
{
|
{
|
||||||
if (!my_isspace(&my_charset_latin1,*val))
|
if (!my_isspace(&my_charset_latin1,*val))
|
||||||
{
|
{
|
||||||
make_truncated_value_warning(current_thd, val_begin, length,
|
make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
|
val_begin, length,
|
||||||
cached_timestamp_type, NullS);
|
cached_timestamp_type, NullS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -600,7 +607,7 @@ err:
|
|||||||
Create a formated date/time value in a string
|
Create a formated date/time value in a string
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool make_date_time(DATE_TIME_FORMAT *format, TIME *l_time,
|
bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
|
||||||
timestamp_type type, String *str)
|
timestamp_type type, String *str)
|
||||||
{
|
{
|
||||||
char intbuff[15];
|
char intbuff[15];
|
||||||
@ -921,7 +928,7 @@ longlong Item_func_period_diff::val_int()
|
|||||||
longlong Item_func_to_days::val_int()
|
longlong Item_func_to_days::val_int()
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
if (get_arg0_date(<ime, TIME_NO_ZERO_DATE))
|
if (get_arg0_date(<ime, TIME_NO_ZERO_DATE))
|
||||||
return 0;
|
return 0;
|
||||||
return (longlong) calc_daynr(ltime.year,ltime.month,ltime.day);
|
return (longlong) calc_daynr(ltime.year,ltime.month,ltime.day);
|
||||||
@ -958,7 +965,7 @@ enum_monotonicity_info Item_func_to_days::get_monotonicity_info() const
|
|||||||
longlong Item_func_dayofyear::val_int()
|
longlong Item_func_dayofyear::val_int()
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
if (get_arg0_date(<ime,TIME_NO_ZERO_DATE))
|
if (get_arg0_date(<ime,TIME_NO_ZERO_DATE))
|
||||||
return 0;
|
return 0;
|
||||||
return (longlong) calc_daynr(ltime.year,ltime.month,ltime.day) -
|
return (longlong) calc_daynr(ltime.year,ltime.month,ltime.day) -
|
||||||
@ -968,7 +975,7 @@ longlong Item_func_dayofyear::val_int()
|
|||||||
longlong Item_func_dayofmonth::val_int()
|
longlong Item_func_dayofmonth::val_int()
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
(void) get_arg0_date(<ime, TIME_FUZZY_DATE);
|
(void) get_arg0_date(<ime, TIME_FUZZY_DATE);
|
||||||
return (longlong) ltime.day;
|
return (longlong) ltime.day;
|
||||||
}
|
}
|
||||||
@ -976,7 +983,7 @@ longlong Item_func_dayofmonth::val_int()
|
|||||||
longlong Item_func_month::val_int()
|
longlong Item_func_month::val_int()
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
(void) get_arg0_date(<ime, TIME_FUZZY_DATE);
|
(void) get_arg0_date(<ime, TIME_FUZZY_DATE);
|
||||||
return (longlong) ltime.month;
|
return (longlong) ltime.month;
|
||||||
}
|
}
|
||||||
@ -1006,7 +1013,7 @@ String* Item_func_monthname::val_str(String* str)
|
|||||||
longlong Item_func_quarter::val_int()
|
longlong Item_func_quarter::val_int()
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
if (get_arg0_date(<ime, TIME_FUZZY_DATE))
|
if (get_arg0_date(<ime, TIME_FUZZY_DATE))
|
||||||
return 0;
|
return 0;
|
||||||
return (longlong) ((ltime.month+2)/3);
|
return (longlong) ((ltime.month+2)/3);
|
||||||
@ -1015,7 +1022,7 @@ longlong Item_func_quarter::val_int()
|
|||||||
longlong Item_func_hour::val_int()
|
longlong Item_func_hour::val_int()
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
(void) get_arg0_time(<ime);
|
(void) get_arg0_time(<ime);
|
||||||
return ltime.hour;
|
return ltime.hour;
|
||||||
}
|
}
|
||||||
@ -1023,7 +1030,7 @@ longlong Item_func_hour::val_int()
|
|||||||
longlong Item_func_minute::val_int()
|
longlong Item_func_minute::val_int()
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
(void) get_arg0_time(<ime);
|
(void) get_arg0_time(<ime);
|
||||||
return ltime.minute;
|
return ltime.minute;
|
||||||
}
|
}
|
||||||
@ -1032,7 +1039,7 @@ longlong Item_func_minute::val_int()
|
|||||||
longlong Item_func_second::val_int()
|
longlong Item_func_second::val_int()
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
(void) get_arg0_time(<ime);
|
(void) get_arg0_time(<ime);
|
||||||
return ltime.second;
|
return ltime.second;
|
||||||
}
|
}
|
||||||
@ -1079,7 +1086,7 @@ longlong Item_func_week::val_int()
|
|||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
uint year;
|
uint year;
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
if (get_arg0_date(<ime, TIME_NO_ZERO_DATE))
|
if (get_arg0_date(<ime, TIME_NO_ZERO_DATE))
|
||||||
return 0;
|
return 0;
|
||||||
return (longlong) calc_week(<ime,
|
return (longlong) calc_week(<ime,
|
||||||
@ -1092,7 +1099,7 @@ longlong Item_func_yearweek::val_int()
|
|||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
uint year,week;
|
uint year,week;
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
if (get_arg0_date(<ime, TIME_NO_ZERO_DATE))
|
if (get_arg0_date(<ime, TIME_NO_ZERO_DATE))
|
||||||
return 0;
|
return 0;
|
||||||
week= calc_week(<ime,
|
week= calc_week(<ime,
|
||||||
@ -1105,7 +1112,7 @@ longlong Item_func_yearweek::val_int()
|
|||||||
longlong Item_func_weekday::val_int()
|
longlong Item_func_weekday::val_int()
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
|
|
||||||
if (get_arg0_date(<ime, TIME_NO_ZERO_DATE))
|
if (get_arg0_date(<ime, TIME_NO_ZERO_DATE))
|
||||||
return 0;
|
return 0;
|
||||||
@ -1135,7 +1142,7 @@ String* Item_func_dayname::val_str(String* str)
|
|||||||
longlong Item_func_year::val_int()
|
longlong Item_func_year::val_int()
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
(void) get_arg0_date(<ime, TIME_FUZZY_DATE);
|
(void) get_arg0_date(<ime, TIME_FUZZY_DATE);
|
||||||
return (longlong) ltime.year;
|
return (longlong) ltime.year;
|
||||||
}
|
}
|
||||||
@ -1166,7 +1173,7 @@ enum_monotonicity_info Item_func_year::get_monotonicity_info() const
|
|||||||
|
|
||||||
longlong Item_func_unix_timestamp::val_int()
|
longlong Item_func_unix_timestamp::val_int()
|
||||||
{
|
{
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
my_bool not_used;
|
my_bool not_used;
|
||||||
|
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
@ -1197,7 +1204,7 @@ longlong Item_func_unix_timestamp::val_int()
|
|||||||
longlong Item_func_time_to_sec::val_int()
|
longlong Item_func_time_to_sec::val_int()
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
longlong seconds;
|
longlong seconds;
|
||||||
(void) get_arg0_time(<ime);
|
(void) get_arg0_time(<ime);
|
||||||
seconds=ltime.hour*3600L+ltime.minute*60+ltime.second;
|
seconds=ltime.hour*3600L+ltime.minute*60+ltime.second;
|
||||||
@ -1369,7 +1376,7 @@ bool get_interval_value(Item *args,interval_type int_type,
|
|||||||
String *Item_date::val_str(String *str)
|
String *Item_date::val_str(String *str)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
if (get_date(<ime, TIME_FUZZY_DATE))
|
if (get_date(<ime, TIME_FUZZY_DATE))
|
||||||
return (String *) 0;
|
return (String *) 0;
|
||||||
if (str->alloc(11))
|
if (str->alloc(11))
|
||||||
@ -1385,19 +1392,19 @@ String *Item_date::val_str(String *str)
|
|||||||
longlong Item_date::val_int()
|
longlong Item_date::val_int()
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
if (get_date(<ime, TIME_FUZZY_DATE))
|
if (get_date(<ime, TIME_FUZZY_DATE))
|
||||||
return 0;
|
return 0;
|
||||||
return (longlong) (ltime.year*10000L+ltime.month*100+ltime.day);
|
return (longlong) (ltime.year*10000L+ltime.month*100+ltime.day);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Item_func_from_days::get_date(TIME *ltime, uint fuzzy_date)
|
bool Item_func_from_days::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
|
||||||
{
|
{
|
||||||
longlong value=args[0]->val_int();
|
longlong value=args[0]->val_int();
|
||||||
if ((null_value=args[0]->null_value))
|
if ((null_value=args[0]->null_value))
|
||||||
return 1;
|
return 1;
|
||||||
bzero(ltime, sizeof(TIME));
|
bzero(ltime, sizeof(MYSQL_TIME));
|
||||||
get_date_from_daynr((long) value, <ime->year, <ime->month, <ime->day);
|
get_date_from_daynr((long) value, <ime->year, <ime->month, <ime->day);
|
||||||
ltime->time_type= MYSQL_TIMESTAMP_DATE;
|
ltime->time_type= MYSQL_TIMESTAMP_DATE;
|
||||||
return 0;
|
return 0;
|
||||||
@ -1431,10 +1438,10 @@ String *Item_func_curdate::val_str(String *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Converts current time in my_time_t to TIME represenatation for local
|
Converts current time in my_time_t to MYSQL_TIME represenatation for local
|
||||||
time zone. Defines time zone (local) used for whole CURDATE function.
|
time zone. Defines time zone (local) used for whole CURDATE function.
|
||||||
*/
|
*/
|
||||||
void Item_func_curdate_local::store_now_in_TIME(TIME *now_time)
|
void Item_func_curdate_local::store_now_in_TIME(MYSQL_TIME *now_time)
|
||||||
{
|
{
|
||||||
THD *thd= current_thd;
|
THD *thd= current_thd;
|
||||||
thd->variables.time_zone->gmt_sec_to_TIME(now_time,
|
thd->variables.time_zone->gmt_sec_to_TIME(now_time,
|
||||||
@ -1444,10 +1451,10 @@ void Item_func_curdate_local::store_now_in_TIME(TIME *now_time)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Converts current time in my_time_t to TIME represenatation for UTC
|
Converts current time in my_time_t to MYSQL_TIME represenatation for UTC
|
||||||
time zone. Defines time zone (UTC) used for whole UTC_DATE function.
|
time zone. Defines time zone (UTC) used for whole UTC_DATE function.
|
||||||
*/
|
*/
|
||||||
void Item_func_curdate_utc::store_now_in_TIME(TIME *now_time)
|
void Item_func_curdate_utc::store_now_in_TIME(MYSQL_TIME *now_time)
|
||||||
{
|
{
|
||||||
my_tz_UTC->gmt_sec_to_TIME(now_time,
|
my_tz_UTC->gmt_sec_to_TIME(now_time,
|
||||||
(my_time_t)(current_thd->query_start()));
|
(my_time_t)(current_thd->query_start()));
|
||||||
@ -1458,7 +1465,7 @@ void Item_func_curdate_utc::store_now_in_TIME(TIME *now_time)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Item_func_curdate::get_date(TIME *res,
|
bool Item_func_curdate::get_date(MYSQL_TIME *res,
|
||||||
uint fuzzy_date __attribute__((unused)))
|
uint fuzzy_date __attribute__((unused)))
|
||||||
{
|
{
|
||||||
*res=ltime;
|
*res=ltime;
|
||||||
@ -1476,7 +1483,7 @@ String *Item_func_curtime::val_str(String *str)
|
|||||||
|
|
||||||
void Item_func_curtime::fix_length_and_dec()
|
void Item_func_curtime::fix_length_and_dec()
|
||||||
{
|
{
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
|
|
||||||
decimals= DATETIME_DEC;
|
decimals= DATETIME_DEC;
|
||||||
collation.set(&my_charset_bin);
|
collation.set(&my_charset_bin);
|
||||||
@ -1488,10 +1495,10 @@ void Item_func_curtime::fix_length_and_dec()
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Converts current time in my_time_t to TIME represenatation for local
|
Converts current time in my_time_t to MYSQL_TIME represenatation for local
|
||||||
time zone. Defines time zone (local) used for whole CURTIME function.
|
time zone. Defines time zone (local) used for whole CURTIME function.
|
||||||
*/
|
*/
|
||||||
void Item_func_curtime_local::store_now_in_TIME(TIME *now_time)
|
void Item_func_curtime_local::store_now_in_TIME(MYSQL_TIME *now_time)
|
||||||
{
|
{
|
||||||
THD *thd= current_thd;
|
THD *thd= current_thd;
|
||||||
thd->variables.time_zone->gmt_sec_to_TIME(now_time,
|
thd->variables.time_zone->gmt_sec_to_TIME(now_time,
|
||||||
@ -1501,10 +1508,10 @@ void Item_func_curtime_local::store_now_in_TIME(TIME *now_time)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Converts current time in my_time_t to TIME represenatation for UTC
|
Converts current time in my_time_t to MYSQL_TIME represenatation for UTC
|
||||||
time zone. Defines time zone (UTC) used for whole UTC_TIME function.
|
time zone. Defines time zone (UTC) used for whole UTC_TIME function.
|
||||||
*/
|
*/
|
||||||
void Item_func_curtime_utc::store_now_in_TIME(TIME *now_time)
|
void Item_func_curtime_utc::store_now_in_TIME(MYSQL_TIME *now_time)
|
||||||
{
|
{
|
||||||
my_tz_UTC->gmt_sec_to_TIME(now_time,
|
my_tz_UTC->gmt_sec_to_TIME(now_time,
|
||||||
(my_time_t)(current_thd->query_start()));
|
(my_time_t)(current_thd->query_start()));
|
||||||
@ -1537,10 +1544,10 @@ void Item_func_now::fix_length_and_dec()
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Converts current time in my_time_t to TIME represenatation for local
|
Converts current time in my_time_t to MYSQL_TIME represenatation for local
|
||||||
time zone. Defines time zone (local) used for whole NOW function.
|
time zone. Defines time zone (local) used for whole NOW function.
|
||||||
*/
|
*/
|
||||||
void Item_func_now_local::store_now_in_TIME(TIME *now_time)
|
void Item_func_now_local::store_now_in_TIME(MYSQL_TIME *now_time)
|
||||||
{
|
{
|
||||||
THD *thd= current_thd;
|
THD *thd= current_thd;
|
||||||
thd->variables.time_zone->gmt_sec_to_TIME(now_time,
|
thd->variables.time_zone->gmt_sec_to_TIME(now_time,
|
||||||
@ -1550,10 +1557,10 @@ void Item_func_now_local::store_now_in_TIME(TIME *now_time)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Converts current time in my_time_t to TIME represenatation for UTC
|
Converts current time in my_time_t to MYSQL_TIME represenatation for UTC
|
||||||
time zone. Defines time zone (UTC) used for whole UTC_TIMESTAMP function.
|
time zone. Defines time zone (UTC) used for whole UTC_TIMESTAMP function.
|
||||||
*/
|
*/
|
||||||
void Item_func_now_utc::store_now_in_TIME(TIME *now_time)
|
void Item_func_now_utc::store_now_in_TIME(MYSQL_TIME *now_time)
|
||||||
{
|
{
|
||||||
my_tz_UTC->gmt_sec_to_TIME(now_time,
|
my_tz_UTC->gmt_sec_to_TIME(now_time,
|
||||||
(my_time_t)(current_thd->query_start()));
|
(my_time_t)(current_thd->query_start()));
|
||||||
@ -1564,7 +1571,7 @@ void Item_func_now_utc::store_now_in_TIME(TIME *now_time)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Item_func_now::get_date(TIME *res,
|
bool Item_func_now::get_date(MYSQL_TIME *res,
|
||||||
uint fuzzy_date __attribute__((unused)))
|
uint fuzzy_date __attribute__((unused)))
|
||||||
{
|
{
|
||||||
*res= ltime;
|
*res= ltime;
|
||||||
@ -1581,10 +1588,10 @@ int Item_func_now::save_in_field(Field *to, bool no_conversions)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Converts current time in my_time_t to TIME represenatation for local
|
Converts current time in my_time_t to MYSQL_TIME represenatation for local
|
||||||
time zone. Defines time zone (local) used for whole SYSDATE function.
|
time zone. Defines time zone (local) used for whole SYSDATE function.
|
||||||
*/
|
*/
|
||||||
void Item_func_sysdate_local::store_now_in_TIME(TIME *now_time)
|
void Item_func_sysdate_local::store_now_in_TIME(MYSQL_TIME *now_time)
|
||||||
{
|
{
|
||||||
THD *thd= current_thd;
|
THD *thd= current_thd;
|
||||||
thd->variables.time_zone->gmt_sec_to_TIME(now_time, (my_time_t) time(NULL));
|
thd->variables.time_zone->gmt_sec_to_TIME(now_time, (my_time_t) time(NULL));
|
||||||
@ -1626,7 +1633,7 @@ void Item_func_sysdate_local::fix_length_and_dec()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Item_func_sysdate_local::get_date(TIME *res,
|
bool Item_func_sysdate_local::get_date(MYSQL_TIME *res,
|
||||||
uint fuzzy_date __attribute__((unused)))
|
uint fuzzy_date __attribute__((unused)))
|
||||||
{
|
{
|
||||||
store_now_in_TIME(<ime);
|
store_now_in_TIME(<ime);
|
||||||
@ -1647,7 +1654,7 @@ int Item_func_sysdate_local::save_in_field(Field *to, bool no_conversions)
|
|||||||
String *Item_func_sec_to_time::val_str(String *str)
|
String *Item_func_sec_to_time::val_str(String *str)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
longlong arg_val= args[0]->val_int();
|
longlong arg_val= args[0]->val_int();
|
||||||
|
|
||||||
if ((null_value=args[0]->null_value) || str->alloc(19))
|
if ((null_value=args[0]->null_value) || str->alloc(19))
|
||||||
@ -1666,7 +1673,7 @@ String *Item_func_sec_to_time::val_str(String *str)
|
|||||||
longlong Item_func_sec_to_time::val_int()
|
longlong Item_func_sec_to_time::val_int()
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
longlong arg_val= args[0]->val_int();
|
longlong arg_val= args[0]->val_int();
|
||||||
|
|
||||||
if ((null_value=args[0]->null_value))
|
if ((null_value=args[0]->null_value))
|
||||||
@ -1808,7 +1815,7 @@ uint Item_func_date_format::format_length(const String *format)
|
|||||||
String *Item_func_date_format::val_str(String *str)
|
String *Item_func_date_format::val_str(String *str)
|
||||||
{
|
{
|
||||||
String *format;
|
String *format;
|
||||||
TIME l_time;
|
MYSQL_TIME l_time;
|
||||||
uint size;
|
uint size;
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
|
|
||||||
@ -1871,7 +1878,7 @@ void Item_func_from_unixtime::fix_length_and_dec()
|
|||||||
|
|
||||||
String *Item_func_from_unixtime::val_str(String *str)
|
String *Item_func_from_unixtime::val_str(String *str)
|
||||||
{
|
{
|
||||||
TIME time_tmp;
|
MYSQL_TIME time_tmp;
|
||||||
|
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
|
|
||||||
@ -1891,7 +1898,7 @@ String *Item_func_from_unixtime::val_str(String *str)
|
|||||||
|
|
||||||
longlong Item_func_from_unixtime::val_int()
|
longlong Item_func_from_unixtime::val_int()
|
||||||
{
|
{
|
||||||
TIME time_tmp;
|
MYSQL_TIME time_tmp;
|
||||||
|
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
|
|
||||||
@ -1901,7 +1908,7 @@ longlong Item_func_from_unixtime::val_int()
|
|||||||
return (longlong) TIME_to_ulonglong_datetime(&time_tmp);
|
return (longlong) TIME_to_ulonglong_datetime(&time_tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Item_func_from_unixtime::get_date(TIME *ltime,
|
bool Item_func_from_unixtime::get_date(MYSQL_TIME *ltime,
|
||||||
uint fuzzy_date __attribute__((unused)))
|
uint fuzzy_date __attribute__((unused)))
|
||||||
{
|
{
|
||||||
ulonglong tmp= (ulonglong)(args[0]->val_int());
|
ulonglong tmp= (ulonglong)(args[0]->val_int());
|
||||||
@ -1929,7 +1936,7 @@ void Item_func_convert_tz::fix_length_and_dec()
|
|||||||
|
|
||||||
String *Item_func_convert_tz::val_str(String *str)
|
String *Item_func_convert_tz::val_str(String *str)
|
||||||
{
|
{
|
||||||
TIME time_tmp;
|
MYSQL_TIME time_tmp;
|
||||||
|
|
||||||
if (get_date(&time_tmp, 0))
|
if (get_date(&time_tmp, 0))
|
||||||
return 0;
|
return 0;
|
||||||
@ -1947,7 +1954,7 @@ String *Item_func_convert_tz::val_str(String *str)
|
|||||||
|
|
||||||
longlong Item_func_convert_tz::val_int()
|
longlong Item_func_convert_tz::val_int()
|
||||||
{
|
{
|
||||||
TIME time_tmp;
|
MYSQL_TIME time_tmp;
|
||||||
|
|
||||||
if (get_date(&time_tmp, 0))
|
if (get_date(&time_tmp, 0))
|
||||||
return 0;
|
return 0;
|
||||||
@ -1956,7 +1963,7 @@ longlong Item_func_convert_tz::val_int()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Item_func_convert_tz::get_date(TIME *ltime,
|
bool Item_func_convert_tz::get_date(MYSQL_TIME *ltime,
|
||||||
uint fuzzy_date __attribute__((unused)))
|
uint fuzzy_date __attribute__((unused)))
|
||||||
{
|
{
|
||||||
my_time_t my_time_tmp;
|
my_time_t my_time_tmp;
|
||||||
@ -2018,7 +2025,7 @@ void Item_date_add_interval::fix_length_and_dec()
|
|||||||
- If first arg is a MYSQL_TYPE_DATE and the interval type uses hours,
|
- If first arg is a MYSQL_TYPE_DATE and the interval type uses hours,
|
||||||
minutes or seconds then type is MYSQL_TYPE_DATETIME.
|
minutes or seconds then type is MYSQL_TYPE_DATETIME.
|
||||||
- Otherwise the result is MYSQL_TYPE_STRING
|
- Otherwise the result is MYSQL_TYPE_STRING
|
||||||
(This is because you can't know if the string contains a DATE, TIME or
|
(This is because you can't know if the string contains a DATE, MYSQL_TIME or
|
||||||
DATETIME argument)
|
DATETIME argument)
|
||||||
*/
|
*/
|
||||||
cached_field_type= MYSQL_TYPE_STRING;
|
cached_field_type= MYSQL_TYPE_STRING;
|
||||||
@ -2038,7 +2045,7 @@ void Item_date_add_interval::fix_length_and_dec()
|
|||||||
|
|
||||||
/* Here arg[1] is a Item_interval object */
|
/* Here arg[1] is a Item_interval object */
|
||||||
|
|
||||||
bool Item_date_add_interval::get_date(TIME *ltime, uint fuzzy_date)
|
bool Item_date_add_interval::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
|
||||||
{
|
{
|
||||||
INTERVAL interval;
|
INTERVAL interval;
|
||||||
|
|
||||||
@ -2048,8 +2055,6 @@ bool Item_date_add_interval::get_date(TIME *ltime, uint fuzzy_date)
|
|||||||
|
|
||||||
if (date_sub_interval)
|
if (date_sub_interval)
|
||||||
interval.neg = !interval.neg;
|
interval.neg = !interval.neg;
|
||||||
if (ltime->year < YY_MAGIC_BELOW)
|
|
||||||
return (null_value=1);
|
|
||||||
|
|
||||||
return (null_value= date_add_interval(ltime, int_type, interval));
|
return (null_value= date_add_interval(ltime, int_type, interval));
|
||||||
}
|
}
|
||||||
@ -2058,7 +2063,7 @@ bool Item_date_add_interval::get_date(TIME *ltime, uint fuzzy_date)
|
|||||||
String *Item_date_add_interval::val_str(String *str)
|
String *Item_date_add_interval::val_str(String *str)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
enum date_time_format_types format;
|
enum date_time_format_types format;
|
||||||
|
|
||||||
if (Item_date_add_interval::get_date(<ime, TIME_NO_ZERO_DATE))
|
if (Item_date_add_interval::get_date(<ime, TIME_NO_ZERO_DATE))
|
||||||
@ -2082,7 +2087,7 @@ String *Item_date_add_interval::val_str(String *str)
|
|||||||
longlong Item_date_add_interval::val_int()
|
longlong Item_date_add_interval::val_int()
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
longlong date;
|
longlong date;
|
||||||
if (Item_date_add_interval::get_date(<ime, TIME_NO_ZERO_DATE))
|
if (Item_date_add_interval::get_date(<ime, TIME_NO_ZERO_DATE))
|
||||||
return (longlong) 0;
|
return (longlong) 0;
|
||||||
@ -2172,7 +2177,7 @@ void Item_extract::fix_length_and_dec()
|
|||||||
longlong Item_extract::val_int()
|
longlong Item_extract::val_int()
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
uint year;
|
uint year;
|
||||||
ulong week_format;
|
ulong week_format;
|
||||||
long neg;
|
long neg;
|
||||||
@ -2425,7 +2430,7 @@ void Item_char_typecast::fix_length_and_dec()
|
|||||||
String *Item_datetime_typecast::val_str(String *str)
|
String *Item_datetime_typecast::val_str(String *str)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
if (!get_arg0_date(<ime, TIME_FUZZY_DATE) &&
|
if (!get_arg0_date(<ime, TIME_FUZZY_DATE) &&
|
||||||
!make_datetime(ltime.second_part ? DATE_TIME_MICROSECOND : DATE_TIME,
|
!make_datetime(ltime.second_part ? DATE_TIME_MICROSECOND : DATE_TIME,
|
||||||
<ime, str))
|
<ime, str))
|
||||||
@ -2439,7 +2444,7 @@ String *Item_datetime_typecast::val_str(String *str)
|
|||||||
longlong Item_datetime_typecast::val_int()
|
longlong Item_datetime_typecast::val_int()
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
if (get_arg0_date(<ime,1))
|
if (get_arg0_date(<ime,1))
|
||||||
{
|
{
|
||||||
null_value= 1;
|
null_value= 1;
|
||||||
@ -2450,7 +2455,7 @@ longlong Item_datetime_typecast::val_int()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Item_time_typecast::get_time(TIME *ltime)
|
bool Item_time_typecast::get_time(MYSQL_TIME *ltime)
|
||||||
{
|
{
|
||||||
bool res= get_arg0_time(ltime);
|
bool res= get_arg0_time(ltime);
|
||||||
/*
|
/*
|
||||||
@ -2466,7 +2471,7 @@ bool Item_time_typecast::get_time(TIME *ltime)
|
|||||||
|
|
||||||
longlong Item_time_typecast::val_int()
|
longlong Item_time_typecast::val_int()
|
||||||
{
|
{
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
if (get_time(<ime))
|
if (get_time(<ime))
|
||||||
{
|
{
|
||||||
null_value= 1;
|
null_value= 1;
|
||||||
@ -2478,7 +2483,7 @@ longlong Item_time_typecast::val_int()
|
|||||||
String *Item_time_typecast::val_str(String *str)
|
String *Item_time_typecast::val_str(String *str)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
|
|
||||||
if (!get_arg0_time(<ime) &&
|
if (!get_arg0_time(<ime) &&
|
||||||
!make_datetime(ltime.second_part ? TIME_MICROSECOND : TIME_ONLY,
|
!make_datetime(ltime.second_part ? TIME_MICROSECOND : TIME_ONLY,
|
||||||
@ -2490,7 +2495,7 @@ String *Item_time_typecast::val_str(String *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Item_date_typecast::get_date(TIME *ltime, uint fuzzy_date)
|
bool Item_date_typecast::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
|
||||||
{
|
{
|
||||||
bool res= get_arg0_date(ltime, TIME_FUZZY_DATE);
|
bool res= get_arg0_date(ltime, TIME_FUZZY_DATE);
|
||||||
ltime->hour= ltime->minute= ltime->second= ltime->second_part= 0;
|
ltime->hour= ltime->minute= ltime->second= ltime->second_part= 0;
|
||||||
@ -2502,7 +2507,7 @@ bool Item_date_typecast::get_date(TIME *ltime, uint fuzzy_date)
|
|||||||
String *Item_date_typecast::val_str(String *str)
|
String *Item_date_typecast::val_str(String *str)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
|
|
||||||
if (!get_arg0_date(<ime, TIME_FUZZY_DATE) && !str->alloc(11))
|
if (!get_arg0_date(<ime, TIME_FUZZY_DATE) && !str->alloc(11))
|
||||||
{
|
{
|
||||||
@ -2517,7 +2522,7 @@ String *Item_date_typecast::val_str(String *str)
|
|||||||
longlong Item_date_typecast::val_int()
|
longlong Item_date_typecast::val_int()
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
if (args[0]->get_date(<ime, TIME_FUZZY_DATE))
|
if (args[0]->get_date(<ime, TIME_FUZZY_DATE))
|
||||||
{
|
{
|
||||||
null_value= 1;
|
null_value= 1;
|
||||||
@ -2529,21 +2534,29 @@ longlong Item_date_typecast::val_int()
|
|||||||
/*
|
/*
|
||||||
MAKEDATE(a,b) is a date function that creates a date value
|
MAKEDATE(a,b) is a date function that creates a date value
|
||||||
from a year and day value.
|
from a year and day value.
|
||||||
|
|
||||||
|
NOTES:
|
||||||
|
As arguments are integers, we can't know if the year is a 2 digit or 4 digit year.
|
||||||
|
In this case we treat all years < 100 as 2 digit years. Ie, this is not safe
|
||||||
|
for dates between 0000-01-01 and 0099-12-31
|
||||||
*/
|
*/
|
||||||
|
|
||||||
String *Item_func_makedate::val_str(String *str)
|
String *Item_func_makedate::val_str(String *str)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME l_time;
|
MYSQL_TIME l_time;
|
||||||
long daynr= (long) args[1]->val_int();
|
long daynr= (long) args[1]->val_int();
|
||||||
long yearnr= (long) args[0]->val_int();
|
long year= (long) args[0]->val_int();
|
||||||
long days;
|
long days;
|
||||||
|
|
||||||
if (args[0]->null_value || args[1]->null_value ||
|
if (args[0]->null_value || args[1]->null_value ||
|
||||||
yearnr < 0 || daynr <= 0)
|
year < 0 || daynr <= 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
days= calc_daynr(yearnr,1,1) + daynr - 1;
|
if (year < 100)
|
||||||
|
year= year_2000_handling(year);
|
||||||
|
|
||||||
|
days= calc_daynr(year,1,1) + daynr - 1;
|
||||||
/* Day number from year 0 to 9999-12-31 */
|
/* Day number from year 0 to 9999-12-31 */
|
||||||
if (days >= 0 && days <= MAX_DAY_NUMBER)
|
if (days >= 0 && days <= MAX_DAY_NUMBER)
|
||||||
{
|
{
|
||||||
@ -2561,19 +2574,32 @@ err:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
MAKEDATE(a,b) is a date function that creates a date value
|
||||||
|
from a year and day value.
|
||||||
|
|
||||||
|
NOTES:
|
||||||
|
As arguments are integers, we can't know if the year is a 2 digit or 4 digit year.
|
||||||
|
In this case we treat all years < 100 as 2 digit years. Ie, this is not safe
|
||||||
|
for dates between 0000-01-01 and 0099-12-31
|
||||||
|
*/
|
||||||
|
|
||||||
longlong Item_func_makedate::val_int()
|
longlong Item_func_makedate::val_int()
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME l_time;
|
MYSQL_TIME l_time;
|
||||||
long daynr= (long) args[1]->val_int();
|
long daynr= (long) args[1]->val_int();
|
||||||
long yearnr= (long) args[0]->val_int();
|
long year= (long) args[0]->val_int();
|
||||||
long days;
|
long days;
|
||||||
|
|
||||||
if (args[0]->null_value || args[1]->null_value ||
|
if (args[0]->null_value || args[1]->null_value ||
|
||||||
yearnr < 0 || daynr <= 0)
|
year < 0 || daynr <= 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
days= calc_daynr(yearnr,1,1) + daynr - 1;
|
if (year < 100)
|
||||||
|
year= year_2000_handling(year);
|
||||||
|
|
||||||
|
days= calc_daynr(year,1,1) + daynr - 1;
|
||||||
/* Day number from year 0 to 9999-12-31 */
|
/* Day number from year 0 to 9999-12-31 */
|
||||||
if (days >= 0 && days < MAX_DAY_NUMBER)
|
if (days >= 0 && days < MAX_DAY_NUMBER)
|
||||||
{
|
{
|
||||||
@ -2628,7 +2654,7 @@ void Item_func_add_time::fix_length_and_dec()
|
|||||||
String *Item_func_add_time::val_str(String *str)
|
String *Item_func_add_time::val_str(String *str)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME l_time1, l_time2, l_time3;
|
MYSQL_TIME l_time1, l_time2, l_time3;
|
||||||
bool is_time= 0;
|
bool is_time= 0;
|
||||||
long days, microseconds;
|
long days, microseconds;
|
||||||
longlong seconds;
|
longlong seconds;
|
||||||
@ -2730,7 +2756,7 @@ String *Item_func_timediff::val_str(String *str)
|
|||||||
longlong seconds;
|
longlong seconds;
|
||||||
long microseconds;
|
long microseconds;
|
||||||
int l_sign= 1;
|
int l_sign= 1;
|
||||||
TIME l_time1 ,l_time2, l_time3;
|
MYSQL_TIME l_time1 ,l_time2, l_time3;
|
||||||
|
|
||||||
null_value= 0;
|
null_value= 0;
|
||||||
if (args[0]->get_time(&l_time1) ||
|
if (args[0]->get_time(&l_time1) ||
|
||||||
@ -2775,7 +2801,7 @@ null_date:
|
|||||||
String *Item_func_maketime::val_str(String *str)
|
String *Item_func_maketime::val_str(String *str)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
bool overflow= 0;
|
bool overflow= 0;
|
||||||
|
|
||||||
longlong hour= args[0]->val_int();
|
longlong hour= args[0]->val_int();
|
||||||
@ -2819,7 +2845,8 @@ String *Item_func_maketime::val_str(String *str)
|
|||||||
char *ptr= longlong10_to_str(hour, buf, args[0]->unsigned_flag ? 10 : -10);
|
char *ptr= longlong10_to_str(hour, buf, args[0]->unsigned_flag ? 10 : -10);
|
||||||
int len = (int)(ptr - buf) +
|
int len = (int)(ptr - buf) +
|
||||||
my_sprintf(ptr, (ptr, ":%02u:%02u", (uint)minute, (uint)second));
|
my_sprintf(ptr, (ptr, ":%02u:%02u", (uint)minute, (uint)second));
|
||||||
make_truncated_value_warning(current_thd, buf, len, MYSQL_TIMESTAMP_TIME,
|
make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
|
buf, len, MYSQL_TIMESTAMP_TIME,
|
||||||
NullS);
|
NullS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2843,7 +2870,7 @@ String *Item_func_maketime::val_str(String *str)
|
|||||||
longlong Item_func_microsecond::val_int()
|
longlong Item_func_microsecond::val_int()
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
if (!get_arg0_time(<ime))
|
if (!get_arg0_time(<ime))
|
||||||
return ltime.second_part;
|
return ltime.second_part;
|
||||||
return 0;
|
return 0;
|
||||||
@ -2852,7 +2879,7 @@ longlong Item_func_microsecond::val_int()
|
|||||||
|
|
||||||
longlong Item_func_timestamp_diff::val_int()
|
longlong Item_func_timestamp_diff::val_int()
|
||||||
{
|
{
|
||||||
TIME ltime1, ltime2;
|
MYSQL_TIME ltime1, ltime2;
|
||||||
longlong seconds;
|
longlong seconds;
|
||||||
long microseconds;
|
long microseconds;
|
||||||
long months= 0;
|
long months= 0;
|
||||||
@ -3158,7 +3185,7 @@ void Item_func_str_to_date::fix_length_and_dec()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Item_func_str_to_date::get_date(TIME *ltime, uint fuzzy_date)
|
bool Item_func_str_to_date::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
|
||||||
{
|
{
|
||||||
DATE_TIME_FORMAT date_time_format;
|
DATE_TIME_FORMAT date_time_format;
|
||||||
char val_buff[64], format_buff[64];
|
char val_buff[64], format_buff[64];
|
||||||
@ -3199,7 +3226,7 @@ null_date:
|
|||||||
String *Item_func_str_to_date::val_str(String *str)
|
String *Item_func_str_to_date::val_str(String *str)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
|
|
||||||
if (Item_func_str_to_date::get_date(<ime, TIME_FUZZY_DATE))
|
if (Item_func_str_to_date::get_date(<ime, TIME_FUZZY_DATE))
|
||||||
return 0;
|
return 0;
|
||||||
@ -3212,7 +3239,7 @@ String *Item_func_str_to_date::val_str(String *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Item_func_last_day::get_date(TIME *ltime, uint fuzzy_date)
|
bool Item_func_last_day::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
|
||||||
{
|
{
|
||||||
if (get_arg0_date(ltime, fuzzy_date & ~TIME_FUZZY_DATE) ||
|
if (get_arg0_date(ltime, fuzzy_date & ~TIME_FUZZY_DATE) ||
|
||||||
(ltime->month == 0))
|
(ltime->month == 0))
|
||||||
|
@ -449,9 +449,9 @@ public:
|
|||||||
/*
|
/*
|
||||||
Abstract method that defines which time zone is used for conversion.
|
Abstract method that defines which time zone is used for conversion.
|
||||||
Converts time current time in my_time_t representation to broken-down
|
Converts time current time in my_time_t representation to broken-down
|
||||||
TIME representation using UTC-SYSTEM or per-thread time zone.
|
MYSQL_TIME representation using UTC-SYSTEM or per-thread time zone.
|
||||||
*/
|
*/
|
||||||
virtual void store_now_in_TIME(TIME *now_time)=0;
|
virtual void store_now_in_TIME(MYSQL_TIME *now_time)=0;
|
||||||
bool result_as_longlong() { return TRUE; }
|
bool result_as_longlong() { return TRUE; }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -462,7 +462,7 @@ public:
|
|||||||
Item_func_curtime_local() :Item_func_curtime() {}
|
Item_func_curtime_local() :Item_func_curtime() {}
|
||||||
Item_func_curtime_local(Item *a) :Item_func_curtime(a) {}
|
Item_func_curtime_local(Item *a) :Item_func_curtime(a) {}
|
||||||
const char *func_name() const { return "curtime"; }
|
const char *func_name() const { return "curtime"; }
|
||||||
virtual void store_now_in_TIME(TIME *now_time);
|
virtual void store_now_in_TIME(MYSQL_TIME *now_time);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -472,7 +472,7 @@ public:
|
|||||||
Item_func_curtime_utc() :Item_func_curtime() {}
|
Item_func_curtime_utc() :Item_func_curtime() {}
|
||||||
Item_func_curtime_utc(Item *a) :Item_func_curtime(a) {}
|
Item_func_curtime_utc(Item *a) :Item_func_curtime(a) {}
|
||||||
const char *func_name() const { return "utc_time"; }
|
const char *func_name() const { return "utc_time"; }
|
||||||
virtual void store_now_in_TIME(TIME *now_time);
|
virtual void store_now_in_TIME(MYSQL_TIME *now_time);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -481,14 +481,14 @@ public:
|
|||||||
class Item_func_curdate :public Item_date
|
class Item_func_curdate :public Item_date
|
||||||
{
|
{
|
||||||
longlong value;
|
longlong value;
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
public:
|
public:
|
||||||
Item_func_curdate() :Item_date() {}
|
Item_func_curdate() :Item_date() {}
|
||||||
longlong val_int() { DBUG_ASSERT(fixed == 1); return (value) ; }
|
longlong val_int() { DBUG_ASSERT(fixed == 1); return (value) ; }
|
||||||
String *val_str(String *str);
|
String *val_str(String *str);
|
||||||
void fix_length_and_dec();
|
void fix_length_and_dec();
|
||||||
bool get_date(TIME *res, uint fuzzy_date);
|
bool get_date(MYSQL_TIME *res, uint fuzzy_date);
|
||||||
virtual void store_now_in_TIME(TIME *now_time)=0;
|
virtual void store_now_in_TIME(MYSQL_TIME *now_time)=0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -497,7 +497,7 @@ class Item_func_curdate_local :public Item_func_curdate
|
|||||||
public:
|
public:
|
||||||
Item_func_curdate_local() :Item_func_curdate() {}
|
Item_func_curdate_local() :Item_func_curdate() {}
|
||||||
const char *func_name() const { return "curdate"; }
|
const char *func_name() const { return "curdate"; }
|
||||||
void store_now_in_TIME(TIME *now_time);
|
void store_now_in_TIME(MYSQL_TIME *now_time);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -506,7 +506,7 @@ class Item_func_curdate_utc :public Item_func_curdate
|
|||||||
public:
|
public:
|
||||||
Item_func_curdate_utc() :Item_func_curdate() {}
|
Item_func_curdate_utc() :Item_func_curdate() {}
|
||||||
const char *func_name() const { return "utc_date"; }
|
const char *func_name() const { return "utc_date"; }
|
||||||
void store_now_in_TIME(TIME *now_time);
|
void store_now_in_TIME(MYSQL_TIME *now_time);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -518,7 +518,7 @@ protected:
|
|||||||
longlong value;
|
longlong value;
|
||||||
char buff[20*2+32]; // +32 to make my_snprintf_{8bit|ucs2} happy
|
char buff[20*2+32]; // +32 to make my_snprintf_{8bit|ucs2} happy
|
||||||
uint buff_length;
|
uint buff_length;
|
||||||
TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
public:
|
public:
|
||||||
Item_func_now() :Item_date_func() {}
|
Item_func_now() :Item_date_func() {}
|
||||||
Item_func_now(Item *a) :Item_date_func(a) {}
|
Item_func_now(Item *a) :Item_date_func(a) {}
|
||||||
@ -527,8 +527,8 @@ public:
|
|||||||
int save_in_field(Field *to, bool no_conversions);
|
int save_in_field(Field *to, bool no_conversions);
|
||||||
String *val_str(String *str);
|
String *val_str(String *str);
|
||||||
void fix_length_and_dec();
|
void fix_length_and_dec();
|
||||||
bool get_date(TIME *res, uint fuzzy_date);
|
bool get_date(MYSQL_TIME *res, uint fuzzy_date);
|
||||||
virtual void store_now_in_TIME(TIME *now_time)=0;
|
virtual void store_now_in_TIME(MYSQL_TIME *now_time)=0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -538,7 +538,7 @@ public:
|
|||||||
Item_func_now_local() :Item_func_now() {}
|
Item_func_now_local() :Item_func_now() {}
|
||||||
Item_func_now_local(Item *a) :Item_func_now(a) {}
|
Item_func_now_local(Item *a) :Item_func_now(a) {}
|
||||||
const char *func_name() const { return "now"; }
|
const char *func_name() const { return "now"; }
|
||||||
virtual void store_now_in_TIME(TIME *now_time);
|
virtual void store_now_in_TIME(MYSQL_TIME *now_time);
|
||||||
virtual enum Functype functype() const { return NOW_FUNC; }
|
virtual enum Functype functype() const { return NOW_FUNC; }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -549,7 +549,7 @@ public:
|
|||||||
Item_func_now_utc() :Item_func_now() {}
|
Item_func_now_utc() :Item_func_now() {}
|
||||||
Item_func_now_utc(Item *a) :Item_func_now(a) {}
|
Item_func_now_utc(Item *a) :Item_func_now(a) {}
|
||||||
const char *func_name() const { return "utc_timestamp"; }
|
const char *func_name() const { return "utc_timestamp"; }
|
||||||
virtual void store_now_in_TIME(TIME *now_time);
|
virtual void store_now_in_TIME(MYSQL_TIME *now_time);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -564,13 +564,13 @@ public:
|
|||||||
Item_func_sysdate_local(Item *a) :Item_func_now(a) {}
|
Item_func_sysdate_local(Item *a) :Item_func_now(a) {}
|
||||||
bool const_item() const { return 0; }
|
bool const_item() const { return 0; }
|
||||||
const char *func_name() const { return "sysdate"; }
|
const char *func_name() const { return "sysdate"; }
|
||||||
void store_now_in_TIME(TIME *now_time);
|
void store_now_in_TIME(MYSQL_TIME *now_time);
|
||||||
double val_real();
|
double val_real();
|
||||||
longlong val_int();
|
longlong val_int();
|
||||||
int save_in_field(Field *to, bool no_conversions);
|
int save_in_field(Field *to, bool no_conversions);
|
||||||
String *val_str(String *str);
|
String *val_str(String *str);
|
||||||
void fix_length_and_dec();
|
void fix_length_and_dec();
|
||||||
bool get_date(TIME *res, uint fuzzy_date);
|
bool get_date(MYSQL_TIME *res, uint fuzzy_date);
|
||||||
void update_used_tables()
|
void update_used_tables()
|
||||||
{
|
{
|
||||||
Item_func_now::update_used_tables();
|
Item_func_now::update_used_tables();
|
||||||
@ -584,7 +584,7 @@ class Item_func_from_days :public Item_date
|
|||||||
public:
|
public:
|
||||||
Item_func_from_days(Item *a) :Item_date(a) {}
|
Item_func_from_days(Item *a) :Item_date(a) {}
|
||||||
const char *func_name() const { return "from_days"; }
|
const char *func_name() const { return "from_days"; }
|
||||||
bool get_date(TIME *res, uint fuzzy_date);
|
bool get_date(MYSQL_TIME *res, uint fuzzy_date);
|
||||||
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -616,7 +616,7 @@ class Item_func_from_unixtime :public Item_date_func
|
|||||||
String *val_str(String *str);
|
String *val_str(String *str);
|
||||||
const char *func_name() const { return "from_unixtime"; }
|
const char *func_name() const { return "from_unixtime"; }
|
||||||
void fix_length_and_dec();
|
void fix_length_and_dec();
|
||||||
bool get_date(TIME *res, uint fuzzy_date);
|
bool get_date(MYSQL_TIME *res, uint fuzzy_date);
|
||||||
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -652,7 +652,7 @@ class Item_func_convert_tz :public Item_date_func
|
|||||||
String *val_str(String *str);
|
String *val_str(String *str);
|
||||||
const char *func_name() const { return "convert_tz"; }
|
const char *func_name() const { return "convert_tz"; }
|
||||||
void fix_length_and_dec();
|
void fix_length_and_dec();
|
||||||
bool get_date(TIME *res, uint fuzzy_date);
|
bool get_date(MYSQL_TIME *res, uint fuzzy_date);
|
||||||
void cleanup();
|
void cleanup();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -695,7 +695,7 @@ public:
|
|||||||
void fix_length_and_dec();
|
void fix_length_and_dec();
|
||||||
enum_field_types field_type() const { return cached_field_type; }
|
enum_field_types field_type() const { return cached_field_type; }
|
||||||
longlong val_int();
|
longlong val_int();
|
||||||
bool get_date(TIME *res, uint fuzzy_date);
|
bool get_date(MYSQL_TIME *res, uint fuzzy_date);
|
||||||
bool eq(const Item *item, bool binary_cmp) const;
|
bool eq(const Item *item, bool binary_cmp) const;
|
||||||
void print(String *str);
|
void print(String *str);
|
||||||
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
||||||
@ -783,7 +783,7 @@ public:
|
|||||||
Item_date_typecast(Item *a) :Item_typecast_maybe_null(a) {}
|
Item_date_typecast(Item *a) :Item_typecast_maybe_null(a) {}
|
||||||
const char *func_name() const { return "cast_as_date"; }
|
const char *func_name() const { return "cast_as_date"; }
|
||||||
String *val_str(String *str);
|
String *val_str(String *str);
|
||||||
bool get_date(TIME *ltime, uint fuzzy_date);
|
bool get_date(MYSQL_TIME *ltime, uint fuzzy_date);
|
||||||
const char *cast_type() const { return "date"; }
|
const char *cast_type() const { return "date"; }
|
||||||
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
|
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
|
||||||
Field *tmp_table_field(TABLE *table)
|
Field *tmp_table_field(TABLE *table)
|
||||||
@ -817,7 +817,7 @@ public:
|
|||||||
Item_time_typecast(Item *a) :Item_typecast_maybe_null(a) {}
|
Item_time_typecast(Item *a) :Item_typecast_maybe_null(a) {}
|
||||||
const char *func_name() const { return "cast_as_time"; }
|
const char *func_name() const { return "cast_as_time"; }
|
||||||
String *val_str(String *str);
|
String *val_str(String *str);
|
||||||
bool get_time(TIME *ltime);
|
bool get_time(MYSQL_TIME *ltime);
|
||||||
const char *cast_type() const { return "time"; }
|
const char *cast_type() const { return "time"; }
|
||||||
enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
|
enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
|
||||||
Field *tmp_table_field(TABLE *table)
|
Field *tmp_table_field(TABLE *table)
|
||||||
@ -1020,7 +1020,7 @@ public:
|
|||||||
:Item_str_func(a, b)
|
:Item_str_func(a, b)
|
||||||
{}
|
{}
|
||||||
String *val_str(String *str);
|
String *val_str(String *str);
|
||||||
bool get_date(TIME *ltime, uint fuzzy_date);
|
bool get_date(MYSQL_TIME *ltime, uint fuzzy_date);
|
||||||
const char *func_name() const { return "str_to_date"; }
|
const char *func_name() const { return "str_to_date"; }
|
||||||
enum_field_types field_type() const { return cached_field_type; }
|
enum_field_types field_type() const { return cached_field_type; }
|
||||||
void fix_length_and_dec();
|
void fix_length_and_dec();
|
||||||
@ -1037,5 +1037,5 @@ class Item_func_last_day :public Item_date
|
|||||||
public:
|
public:
|
||||||
Item_func_last_day(Item *a) :Item_date(a) {}
|
Item_func_last_day(Item *a) :Item_date(a) {}
|
||||||
const char *func_name() const { return "last_day"; }
|
const char *func_name() const { return "last_day"; }
|
||||||
bool get_date(TIME *res, uint fuzzy_date);
|
bool get_date(MYSQL_TIME *res, uint fuzzy_date);
|
||||||
};
|
};
|
||||||
|
@ -1587,8 +1587,7 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all)
|
|||||||
table. Such cases should be rare (updating a
|
table. Such cases should be rare (updating a
|
||||||
non-transactional table inside a transaction...)
|
non-transactional table inside a transaction...)
|
||||||
*/
|
*/
|
||||||
if (unlikely(thd->options & (OPTION_STATUS_NO_TRANS_UPDATE |
|
if (unlikely(thd->no_trans_update.all || (thd->options & OPTION_KEEP_LOG)))
|
||||||
OPTION_KEEP_LOG)))
|
|
||||||
{
|
{
|
||||||
Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), TRUE, FALSE);
|
Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), TRUE, FALSE);
|
||||||
qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE)
|
qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE)
|
||||||
@ -1643,8 +1642,7 @@ static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv)
|
|||||||
non-transactional table. Otherwise, truncate the binlog cache starting
|
non-transactional table. Otherwise, truncate the binlog cache starting
|
||||||
from the SAVEPOINT command.
|
from the SAVEPOINT command.
|
||||||
*/
|
*/
|
||||||
if (unlikely(thd->options &
|
if (unlikely(thd->no_trans_update.all || (thd->options & OPTION_KEEP_LOG)))
|
||||||
(OPTION_STATUS_NO_TRANS_UPDATE | OPTION_KEEP_LOG)))
|
|
||||||
{
|
{
|
||||||
int error=
|
int error=
|
||||||
thd->binlog_query(THD::STMT_QUERY_TYPE,
|
thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||||
|
@ -191,7 +191,7 @@ int str2my_decimal(uint mask, const char *from, uint length,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
my_decimal *date2my_decimal(TIME *ltime, my_decimal *dec)
|
my_decimal *date2my_decimal(MYSQL_TIME *ltime, my_decimal *dec)
|
||||||
{
|
{
|
||||||
longlong date;
|
longlong date;
|
||||||
date = (ltime->year*100L + ltime->month)*100L + ltime->day;
|
date = (ltime->year*100L + ltime->month)*100L + ltime->day;
|
||||||
|
@ -296,7 +296,7 @@ int string2my_decimal(uint mask, const String *str, my_decimal *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
my_decimal *date2my_decimal(TIME *ltime, my_decimal *dec);
|
my_decimal *date2my_decimal(MYSQL_TIME *ltime, my_decimal *dec);
|
||||||
|
|
||||||
|
|
||||||
#endif /*defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY) */
|
#endif /*defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY) */
|
||||||
|
@ -340,9 +340,6 @@ MY_LOCALE *my_locale_by_number(uint number);
|
|||||||
/* The following is used to detect a conflict with DISTINCT */
|
/* The following is used to detect a conflict with DISTINCT */
|
||||||
#define SELECT_ALL (ULL(1) << 24) // SELECT, user, parser
|
#define SELECT_ALL (ULL(1) << 24) // SELECT, user, parser
|
||||||
|
|
||||||
/* Set if we are updating a non-transaction safe table */
|
|
||||||
#define OPTION_STATUS_NO_TRANS_UPDATE (ULL(1) << 25) // THD, intern
|
|
||||||
|
|
||||||
/* The following can be set when importing tables in a 'wrong order'
|
/* The following can be set when importing tables in a 'wrong order'
|
||||||
to suppress foreign key checks */
|
to suppress foreign key checks */
|
||||||
#define OPTION_NO_FOREIGN_KEY_CHECKS (ULL(1) << 26) // THD, user, binlog
|
#define OPTION_NO_FOREIGN_KEY_CHECKS (ULL(1) << 26) // THD, user, binlog
|
||||||
@ -835,7 +832,8 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent);
|
|||||||
bool do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db,
|
bool do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db,
|
||||||
char *new_table_name, char *new_table_alias,
|
char *new_table_name, char *new_table_alias,
|
||||||
bool skip_error);
|
bool skip_error);
|
||||||
bool mysql_change_db(THD *thd,const char *name,bool no_access_check);
|
bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name,
|
||||||
|
bool force_switch);
|
||||||
void mysql_parse(THD *thd,char *inBuf,uint length);
|
void mysql_parse(THD *thd,char *inBuf,uint length);
|
||||||
bool mysql_test_parse_for_slave(THD *thd,char *inBuf,uint length);
|
bool mysql_test_parse_for_slave(THD *thd,char *inBuf,uint length);
|
||||||
bool is_update_query(enum enum_sql_command command);
|
bool is_update_query(enum enum_sql_command command);
|
||||||
@ -1114,7 +1112,7 @@ void init_status_vars();
|
|||||||
void free_status_vars();
|
void free_status_vars();
|
||||||
|
|
||||||
/* information schema */
|
/* information schema */
|
||||||
extern LEX_STRING information_schema_name;
|
extern LEX_STRING INFORMATION_SCHEMA_NAME;
|
||||||
extern const LEX_STRING partition_keywords[];
|
extern const LEX_STRING partition_keywords[];
|
||||||
LEX_STRING *make_lex_string(THD *thd, LEX_STRING *lex_str,
|
LEX_STRING *make_lex_string(THD *thd, LEX_STRING *lex_str,
|
||||||
const char* str, uint length,
|
const char* str, uint length,
|
||||||
@ -1133,7 +1131,7 @@ int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
|
|||||||
bool get_schema_tables_result(JOIN *join,
|
bool get_schema_tables_result(JOIN *join,
|
||||||
enum enum_schema_table_state executed_place);
|
enum enum_schema_table_state executed_place);
|
||||||
#define is_schema_db(X) \
|
#define is_schema_db(X) \
|
||||||
!my_strcasecmp(system_charset_info, information_schema_name.str, (X))
|
!my_strcasecmp(system_charset_info, INFORMATION_SCHEMA_NAME.str, (X))
|
||||||
|
|
||||||
/* sql_prepare.cc */
|
/* sql_prepare.cc */
|
||||||
|
|
||||||
@ -1838,19 +1836,20 @@ ulong convert_period_to_month(ulong period);
|
|||||||
ulong convert_month_to_period(ulong month);
|
ulong convert_month_to_period(ulong month);
|
||||||
void get_date_from_daynr(long daynr,uint *year, uint *month,
|
void get_date_from_daynr(long daynr,uint *year, uint *month,
|
||||||
uint *day);
|
uint *day);
|
||||||
my_time_t TIME_to_timestamp(THD *thd, const TIME *t, my_bool *not_exist);
|
my_time_t TIME_to_timestamp(THD *thd, const MYSQL_TIME *t, my_bool *not_exist);
|
||||||
bool str_to_time_with_warn(const char *str,uint length,TIME *l_time);
|
bool str_to_time_with_warn(const char *str,uint length,MYSQL_TIME *l_time);
|
||||||
timestamp_type str_to_datetime_with_warn(const char *str, uint length,
|
timestamp_type str_to_datetime_with_warn(const char *str, uint length,
|
||||||
TIME *l_time, uint flags);
|
MYSQL_TIME *l_time, uint flags);
|
||||||
void localtime_to_TIME(TIME *to, struct tm *from);
|
void localtime_to_TIME(MYSQL_TIME *to, struct tm *from);
|
||||||
void calc_time_from_sec(TIME *to, long seconds, long microseconds);
|
void calc_time_from_sec(MYSQL_TIME *to, long seconds, long microseconds);
|
||||||
|
|
||||||
void make_truncated_value_warning(THD *thd, const char *str_val,
|
void make_truncated_value_warning(THD *thd, MYSQL_ERROR::enum_warning_level level,
|
||||||
|
const char *str_val,
|
||||||
uint str_length, timestamp_type time_type,
|
uint str_length, timestamp_type time_type,
|
||||||
const char *field_name);
|
const char *field_name);
|
||||||
|
|
||||||
bool date_add_interval(TIME *ltime, interval_type int_type, INTERVAL interval);
|
bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type, INTERVAL interval);
|
||||||
bool calc_time_diff(TIME *l_time1, TIME *l_time2, int l_sign,
|
bool calc_time_diff(MYSQL_TIME *l_time1, MYSQL_TIME *l_time2, int l_sign,
|
||||||
longlong *seconds_out, long *microseconds_out);
|
longlong *seconds_out, long *microseconds_out);
|
||||||
|
|
||||||
extern LEX_STRING interval_type_to_name[];
|
extern LEX_STRING interval_type_to_name[];
|
||||||
@ -1862,15 +1861,15 @@ extern DATE_TIME_FORMAT *date_time_format_copy(THD *thd,
|
|||||||
DATE_TIME_FORMAT *format);
|
DATE_TIME_FORMAT *format);
|
||||||
const char *get_date_time_format_str(KNOWN_DATE_TIME_FORMAT *format,
|
const char *get_date_time_format_str(KNOWN_DATE_TIME_FORMAT *format,
|
||||||
timestamp_type type);
|
timestamp_type type);
|
||||||
extern bool make_date_time(DATE_TIME_FORMAT *format, TIME *l_time,
|
extern bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
|
||||||
timestamp_type type, String *str);
|
timestamp_type type, String *str);
|
||||||
void make_datetime(const DATE_TIME_FORMAT *format, const TIME *l_time,
|
void make_datetime(const DATE_TIME_FORMAT *format, const MYSQL_TIME *l_time,
|
||||||
String *str);
|
String *str);
|
||||||
void make_date(const DATE_TIME_FORMAT *format, const TIME *l_time,
|
void make_date(const DATE_TIME_FORMAT *format, const MYSQL_TIME *l_time,
|
||||||
String *str);
|
String *str);
|
||||||
void make_time(const DATE_TIME_FORMAT *format, const TIME *l_time,
|
void make_time(const DATE_TIME_FORMAT *format, const MYSQL_TIME *l_time,
|
||||||
String *str);
|
String *str);
|
||||||
int my_time_compare(TIME *a, TIME *b);
|
int my_time_compare(MYSQL_TIME *a, MYSQL_TIME *b);
|
||||||
|
|
||||||
int test_if_number(char *str,int *res,bool allow_wildcards);
|
int test_if_number(char *str,int *res,bool allow_wildcards);
|
||||||
void change_byte(byte *,uint,char,char);
|
void change_byte(byte *,uint,char,char);
|
||||||
@ -1890,7 +1889,7 @@ double my_double_round(double value, int dec, bool truncate);
|
|||||||
int get_quick_record(SQL_SELECT *select);
|
int get_quick_record(SQL_SELECT *select);
|
||||||
|
|
||||||
int calc_weekday(long daynr,bool sunday_first_day_of_week);
|
int calc_weekday(long daynr,bool sunday_first_day_of_week);
|
||||||
uint calc_week(TIME *l_time, uint week_behaviour, uint *year);
|
uint calc_week(MYSQL_TIME *l_time, uint week_behaviour, uint *year);
|
||||||
void find_date(char *pos,uint *vek,uint flag);
|
void find_date(char *pos,uint *vek,uint flag);
|
||||||
TYPELIB *convert_strings_to_array_type(my_string *typelibs, my_string *end);
|
TYPELIB *convert_strings_to_array_type(my_string *typelibs, my_string *end);
|
||||||
TYPELIB *typelib(MEM_ROOT *mem_root, List<String> &strings);
|
TYPELIB *typelib(MEM_ROOT *mem_root, List<String> &strings);
|
||||||
|
135
sql/mysqld.cc
135
sql/mysqld.cc
@ -274,7 +274,11 @@ static TYPELIB tc_heuristic_recover_typelib=
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const char *thread_handling_names[]=
|
static const char *thread_handling_names[]=
|
||||||
{ "one-thread-per-connection", "no-threads", "pool-of-threads", NullS};
|
{ "one-thread-per-connection", "no-threads",
|
||||||
|
#if HAVE_POOL_OF_THREADS == 1
|
||||||
|
"pool-of-threads",
|
||||||
|
#endif
|
||||||
|
NullS};
|
||||||
|
|
||||||
TYPELIB thread_handling_typelib=
|
TYPELIB thread_handling_typelib=
|
||||||
{
|
{
|
||||||
@ -732,6 +736,8 @@ pthread_handler_t handle_connections_shared_memory(void *arg);
|
|||||||
#endif
|
#endif
|
||||||
pthread_handler_t handle_slave(void *arg);
|
pthread_handler_t handle_slave(void *arg);
|
||||||
static ulong find_bit_type(const char *x, TYPELIB *bit_lib);
|
static ulong find_bit_type(const char *x, TYPELIB *bit_lib);
|
||||||
|
static ulong find_bit_type_or_exit(const char *x, TYPELIB *bit_lib,
|
||||||
|
const char *option);
|
||||||
static void clean_up(bool print_message);
|
static void clean_up(bool print_message);
|
||||||
static int test_if_case_insensitive(const char *dir_name);
|
static int test_if_case_insensitive(const char *dir_name);
|
||||||
|
|
||||||
@ -783,7 +789,6 @@ static void close_connections(void)
|
|||||||
DBUG_PRINT("info",("Waiting for select thread"));
|
DBUG_PRINT("info",("Waiting for select thread"));
|
||||||
|
|
||||||
#ifndef DONT_USE_THR_ALARM
|
#ifndef DONT_USE_THR_ALARM
|
||||||
if (pthread_kill(select_thread, thr_client_alarm))
|
|
||||||
break; // allready dead
|
break; // allready dead
|
||||||
#endif
|
#endif
|
||||||
set_timespec(abstime, 2);
|
set_timespec(abstime, 2);
|
||||||
@ -7444,11 +7449,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
case (int) OPT_INIT_RPL_ROLE:
|
case (int) OPT_INIT_RPL_ROLE:
|
||||||
{
|
{
|
||||||
int role;
|
int role;
|
||||||
if ((role=find_type(argument, &rpl_role_typelib, 2)) <= 0)
|
role= find_type_or_exit(argument, &rpl_role_typelib, opt->name);
|
||||||
{
|
|
||||||
fprintf(stderr, "Unknown replication role: %s\n", argument);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
rpl_status = (role == 1) ? RPL_AUTH_MASTER : RPL_IDLE_SLAVE;
|
rpl_status = (role == 1) ? RPL_AUTH_MASTER : RPL_IDLE_SLAVE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -7504,17 +7505,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
case OPT_BINLOG_FORMAT:
|
case OPT_BINLOG_FORMAT:
|
||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
if ((id= find_type(argument, &binlog_format_typelib, 2)) <= 0)
|
id= find_type_or_exit(argument, &binlog_format_typelib, opt->name);
|
||||||
{
|
|
||||||
fprintf(stderr,
|
|
||||||
"Unknown binary log format: '%s' "
|
|
||||||
"(should be one of '%s', '%s', '%s')\n",
|
|
||||||
argument,
|
|
||||||
binlog_format_names[BINLOG_FORMAT_STMT],
|
|
||||||
binlog_format_names[BINLOG_FORMAT_ROW],
|
|
||||||
binlog_format_names[BINLOG_FORMAT_MIXED]);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
global_system_variables.binlog_format= opt_binlog_format_id= id - 1;
|
global_system_variables.binlog_format= opt_binlog_format_id= id - 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -7574,12 +7565,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
log_output_str= argument;
|
log_output_str= argument;
|
||||||
if ((log_output_options=
|
log_output_options=
|
||||||
find_bit_type(argument, &log_output_typelib)) == ~(ulong) 0)
|
find_bit_type_or_exit(argument, &log_output_typelib, opt->name);
|
||||||
{
|
|
||||||
fprintf(stderr, "Unknown option to log-output: %s\n", argument);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -7594,10 +7581,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
type= 5 1 2 3 4
|
type= 5 1 2 3 4
|
||||||
(DISABLE ) - (OFF | ON) - (0 | 1)
|
(DISABLE ) - (OFF | ON) - (0 | 1)
|
||||||
*/
|
*/
|
||||||
switch ((type=find_type(argument, &Events::opt_typelib, 1))) {
|
type= find_type_or_exit(argument, &Events::opt_typelib, opt->name);
|
||||||
case 0:
|
switch (type) {
|
||||||
fprintf(stderr, "Unknown option to event-scheduler: %s\n",argument);
|
|
||||||
exit(1);
|
|
||||||
case 5: /* OPT_DISABLED */
|
case 5: /* OPT_DISABLED */
|
||||||
Events::opt_event_scheduler= Events::EVENTS_DISABLED;
|
Events::opt_event_scheduler= Events::EVENTS_DISABLED;
|
||||||
break;
|
break;
|
||||||
@ -7747,11 +7732,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
int type;
|
int type;
|
||||||
if ((type=find_type(argument, &delay_key_write_typelib, 2)) <= 0)
|
type= find_type_or_exit(argument, &delay_key_write_typelib, opt->name);
|
||||||
{
|
|
||||||
fprintf(stderr,"Unknown delay_key_write type: %s\n",argument);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
delay_key_write_options= (uint) type-1;
|
delay_key_write_options= (uint) type-1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -7762,11 +7743,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
case OPT_TX_ISOLATION:
|
case OPT_TX_ISOLATION:
|
||||||
{
|
{
|
||||||
int type;
|
int type;
|
||||||
if ((type=find_type(argument, &tx_isolation_typelib, 2)) <= 0)
|
type= find_type_or_exit(argument, &tx_isolation_typelib, opt->name);
|
||||||
{
|
|
||||||
fprintf(stderr,"Unknown transaction isolation type: %s\n",argument);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
global_system_variables.tx_isolation= (type-1);
|
global_system_variables.tx_isolation= (type-1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -7807,16 +7784,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
break;
|
break;
|
||||||
case OPT_NDB_DISTRIBUTION:
|
case OPT_NDB_DISTRIBUTION:
|
||||||
int id;
|
int id;
|
||||||
if ((id= find_type(argument, &ndb_distribution_typelib, 2)) <= 0)
|
id= find_type_or_exit(argument, &ndb_distribution_typelib, opt->name);
|
||||||
{
|
|
||||||
fprintf(stderr,
|
|
||||||
"Unknown ndb distribution type: '%s' "
|
|
||||||
"(should be '%s' or '%s')\n",
|
|
||||||
argument,
|
|
||||||
ndb_distribution_names[ND_KEYHASH],
|
|
||||||
ndb_distribution_names[ND_LINHASH]);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
opt_ndb_distribution_id= (enum ndb_distribution)(id-1);
|
opt_ndb_distribution_id= (enum ndb_distribution)(id-1);
|
||||||
break;
|
break;
|
||||||
case OPT_NDB_EXTRA_LOGGING:
|
case OPT_NDB_EXTRA_LOGGING:
|
||||||
@ -7856,12 +7824,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
myisam_recover_options_str=argument;
|
myisam_recover_options_str=argument;
|
||||||
if ((myisam_recover_options=
|
myisam_recover_options=
|
||||||
find_bit_type(argument, &myisam_recover_typelib)) == ~(ulong) 0)
|
find_bit_type_or_exit(argument, &myisam_recover_typelib, opt->name);
|
||||||
{
|
|
||||||
fprintf(stderr, "Unknown option to myisam-recover: %s\n",argument);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ha_open_options|=HA_OPEN_ABORT_IF_CRASHED;
|
ha_open_options|=HA_OPEN_ABORT_IF_CRASHED;
|
||||||
break;
|
break;
|
||||||
@ -7874,14 +7838,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
myisam_concurrent_insert= 0; /* --skip-concurrent-insert */
|
myisam_concurrent_insert= 0; /* --skip-concurrent-insert */
|
||||||
break;
|
break;
|
||||||
case OPT_TC_HEURISTIC_RECOVER:
|
case OPT_TC_HEURISTIC_RECOVER:
|
||||||
{
|
tc_heuristic_recover= find_type_or_exit(argument,
|
||||||
if ((tc_heuristic_recover=find_type(argument,
|
&tc_heuristic_recover_typelib,
|
||||||
&tc_heuristic_recover_typelib, 2)) <=0)
|
opt->name);
|
||||||
{
|
break;
|
||||||
fprintf(stderr, "Unknown option to tc-heuristic-recover: %s\n",argument);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case OPT_MYISAM_STATS_METHOD:
|
case OPT_MYISAM_STATS_METHOD:
|
||||||
{
|
{
|
||||||
ulong method_conv;
|
ulong method_conv;
|
||||||
@ -7889,11 +7849,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
LINT_INIT(method_conv);
|
LINT_INIT(method_conv);
|
||||||
|
|
||||||
myisam_stats_method_str= argument;
|
myisam_stats_method_str= argument;
|
||||||
if ((method=find_type(argument, &myisam_stats_method_typelib, 2)) <= 0)
|
method= find_type_or_exit(argument, &myisam_stats_method_typelib,
|
||||||
{
|
opt->name);
|
||||||
fprintf(stderr, "Invalid value of myisam_stats_method: %s.\n", argument);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
switch (method-1) {
|
switch (method-1) {
|
||||||
case 2:
|
case 2:
|
||||||
method_conv= MI_STATS_METHOD_IGNORE_NULLS;
|
method_conv= MI_STATS_METHOD_IGNORE_NULLS;
|
||||||
@ -7912,12 +7869,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
case OPT_SQL_MODE:
|
case OPT_SQL_MODE:
|
||||||
{
|
{
|
||||||
sql_mode_str= argument;
|
sql_mode_str= argument;
|
||||||
if ((global_system_variables.sql_mode=
|
global_system_variables.sql_mode=
|
||||||
find_bit_type(argument, &sql_mode_typelib)) == ~(ulong) 0)
|
find_bit_type_or_exit(argument, &sql_mode_typelib, opt->name);
|
||||||
{
|
|
||||||
fprintf(stderr, "Unknown option to sql-mode: %s\n", argument);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
global_system_variables.sql_mode= fix_sql_mode(global_system_variables.
|
global_system_variables.sql_mode= fix_sql_mode(global_system_variables.
|
||||||
sql_mode);
|
sql_mode);
|
||||||
break;
|
break;
|
||||||
@ -7927,16 +7880,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
break;
|
break;
|
||||||
case OPT_THREAD_HANDLING:
|
case OPT_THREAD_HANDLING:
|
||||||
{
|
{
|
||||||
if ((global_system_variables.thread_handling=
|
global_system_variables.thread_handling=
|
||||||
find_type(argument, &thread_handling_typelib, 2)) <= 0 ||
|
find_type_or_exit(argument, &thread_handling_typelib, opt->name);
|
||||||
(global_system_variables.thread_handling == SCHEDULER_POOL_OF_THREADS
|
|
||||||
&& !HAVE_POOL_OF_THREADS))
|
|
||||||
{
|
|
||||||
/* purecov: begin tested */
|
|
||||||
fprintf(stderr,"Unknown/unsupported thread-handling: %s\n",argument);
|
|
||||||
exit(1);
|
|
||||||
/* purecov: end */
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OPT_FT_BOOLEAN_SYNTAX:
|
case OPT_FT_BOOLEAN_SYNTAX:
|
||||||
@ -8225,6 +8170,30 @@ static void fix_paths(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static ulong find_bit_type_or_exit(const char *x, TYPELIB *bit_lib,
|
||||||
|
const char *option)
|
||||||
|
{
|
||||||
|
ulong res;
|
||||||
|
|
||||||
|
const char **ptr;
|
||||||
|
|
||||||
|
if ((res= find_bit_type(x, bit_lib)) == ~(ulong) 0)
|
||||||
|
{
|
||||||
|
ptr= bit_lib->type_names;
|
||||||
|
if (!*x)
|
||||||
|
fprintf(stderr, "No option given to %s\n", option);
|
||||||
|
else
|
||||||
|
fprintf(stderr, "Wrong option to %s. Option(s) given: %s\n", option, x);
|
||||||
|
fprintf(stderr, "Alternatives are: '%s'", *ptr);
|
||||||
|
while (*++ptr)
|
||||||
|
fprintf(stderr, ",'%s'", *ptr);
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Return a bitfield from a string of substrings separated by ','
|
Return a bitfield from a string of substrings separated by ','
|
||||||
returns ~(ulong) 0 on error.
|
returns ~(ulong) 0 on error.
|
||||||
|
@ -298,7 +298,7 @@ void net_clear(NET *net, my_bool clear_buffer)
|
|||||||
{
|
{
|
||||||
DBUG_PRINT("info",("skipped %d bytes from file: %s",
|
DBUG_PRINT("info",("skipped %d bytes from file: %s",
|
||||||
count, vio_description(net->vio)));
|
count, vio_description(net->vio)));
|
||||||
#if defined(EXTRA_DEBUG) && (MYSQL_VERSION_ID < 51000)
|
#if defined(EXTRA_DEBUG) && (MYSQL_VERSION_ID < 50100)
|
||||||
fprintf(stderr,"Error: net_clear() skipped %d bytes from file: %s\n",
|
fprintf(stderr,"Error: net_clear() skipped %d bytes from file: %s\n",
|
||||||
count, vio_description(net->vio));
|
count, vio_description(net->vio));
|
||||||
#endif
|
#endif
|
||||||
@ -818,7 +818,7 @@ my_real_read(NET *net, ulong *complen)
|
|||||||
{
|
{
|
||||||
my_bool interrupted = vio_should_retry(net->vio);
|
my_bool interrupted = vio_should_retry(net->vio);
|
||||||
|
|
||||||
DBUG_PRINT("info",("vio_read returned %ld, errno: %d",
|
DBUG_PRINT("info",("vio_read returned %ld errno: %d",
|
||||||
length, vio_errno(net->vio)));
|
length, vio_errno(net->vio)));
|
||||||
#if !defined(__WIN__) || defined(MYSQL_SERVER)
|
#if !defined(__WIN__) || defined(MYSQL_SERVER)
|
||||||
/*
|
/*
|
||||||
|
@ -961,7 +961,7 @@ bool Protocol_text::store(Field *field)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
bool Protocol_text::store(TIME *tm)
|
bool Protocol_text::store(MYSQL_TIME *tm)
|
||||||
{
|
{
|
||||||
#ifndef DBUG_OFF
|
#ifndef DBUG_OFF
|
||||||
DBUG_ASSERT(field_types == 0 ||
|
DBUG_ASSERT(field_types == 0 ||
|
||||||
@ -984,7 +984,7 @@ bool Protocol_text::store(TIME *tm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Protocol_text::store_date(TIME *tm)
|
bool Protocol_text::store_date(MYSQL_TIME *tm)
|
||||||
{
|
{
|
||||||
#ifndef DBUG_OFF
|
#ifndef DBUG_OFF
|
||||||
DBUG_ASSERT(field_types == 0 ||
|
DBUG_ASSERT(field_types == 0 ||
|
||||||
@ -1003,7 +1003,7 @@ bool Protocol_text::store_date(TIME *tm)
|
|||||||
we support 0-6 decimals for time.
|
we support 0-6 decimals for time.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool Protocol_text::store_time(TIME *tm)
|
bool Protocol_text::store_time(MYSQL_TIME *tm)
|
||||||
{
|
{
|
||||||
#ifndef DBUG_OFF
|
#ifndef DBUG_OFF
|
||||||
DBUG_ASSERT(field_types == 0 ||
|
DBUG_ASSERT(field_types == 0 ||
|
||||||
@ -1176,7 +1176,7 @@ bool Protocol_binary::store(Field *field)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Protocol_binary::store(TIME *tm)
|
bool Protocol_binary::store(MYSQL_TIME *tm)
|
||||||
{
|
{
|
||||||
char buff[12],*pos;
|
char buff[12],*pos;
|
||||||
uint length;
|
uint length;
|
||||||
@ -1202,7 +1202,7 @@ bool Protocol_binary::store(TIME *tm)
|
|||||||
return packet->append(buff, length+1, PACKET_BUFFER_EXTRA_ALLOC);
|
return packet->append(buff, length+1, PACKET_BUFFER_EXTRA_ALLOC);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Protocol_binary::store_date(TIME *tm)
|
bool Protocol_binary::store_date(MYSQL_TIME *tm)
|
||||||
{
|
{
|
||||||
tm->hour= tm->minute= tm->second=0;
|
tm->hour= tm->minute= tm->second=0;
|
||||||
tm->second_part= 0;
|
tm->second_part= 0;
|
||||||
@ -1210,7 +1210,7 @@ bool Protocol_binary::store_date(TIME *tm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Protocol_binary::store_time(TIME *tm)
|
bool Protocol_binary::store_time(MYSQL_TIME *tm)
|
||||||
{
|
{
|
||||||
char buff[13], *pos;
|
char buff[13], *pos;
|
||||||
uint length;
|
uint length;
|
||||||
|
@ -88,9 +88,9 @@ public:
|
|||||||
CHARSET_INFO *fromcs, CHARSET_INFO *tocs)=0;
|
CHARSET_INFO *fromcs, CHARSET_INFO *tocs)=0;
|
||||||
virtual bool store(float from, uint32 decimals, String *buffer)=0;
|
virtual bool store(float from, uint32 decimals, String *buffer)=0;
|
||||||
virtual bool store(double from, uint32 decimals, String *buffer)=0;
|
virtual bool store(double from, uint32 decimals, String *buffer)=0;
|
||||||
virtual bool store(TIME *time)=0;
|
virtual bool store(MYSQL_TIME *time)=0;
|
||||||
virtual bool store_date(TIME *time)=0;
|
virtual bool store_date(MYSQL_TIME *time)=0;
|
||||||
virtual bool store_time(TIME *time)=0;
|
virtual bool store_time(MYSQL_TIME *time)=0;
|
||||||
virtual bool store(Field *field)=0;
|
virtual bool store(Field *field)=0;
|
||||||
#ifdef EMBEDDED_LIBRARY
|
#ifdef EMBEDDED_LIBRARY
|
||||||
int begin_dataset();
|
int begin_dataset();
|
||||||
@ -127,9 +127,9 @@ public:
|
|||||||
virtual bool store(const char *from, uint length, CHARSET_INFO *cs);
|
virtual bool store(const char *from, uint length, CHARSET_INFO *cs);
|
||||||
virtual bool store(const char *from, uint length,
|
virtual bool store(const char *from, uint length,
|
||||||
CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
|
CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
|
||||||
virtual bool store(TIME *time);
|
virtual bool store(MYSQL_TIME *time);
|
||||||
virtual bool store_date(TIME *time);
|
virtual bool store_date(MYSQL_TIME *time);
|
||||||
virtual bool store_time(TIME *time);
|
virtual bool store_time(MYSQL_TIME *time);
|
||||||
virtual bool store(float nr, uint32 decimals, String *buffer);
|
virtual bool store(float nr, uint32 decimals, String *buffer);
|
||||||
virtual bool store(double from, uint32 decimals, String *buffer);
|
virtual bool store(double from, uint32 decimals, String *buffer);
|
||||||
virtual bool store(Field *field);
|
virtual bool store(Field *field);
|
||||||
@ -162,9 +162,9 @@ public:
|
|||||||
virtual bool store(const char *from,uint length, CHARSET_INFO *cs);
|
virtual bool store(const char *from,uint length, CHARSET_INFO *cs);
|
||||||
virtual bool store(const char *from, uint length,
|
virtual bool store(const char *from, uint length,
|
||||||
CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
|
CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
|
||||||
virtual bool store(TIME *time);
|
virtual bool store(MYSQL_TIME *time);
|
||||||
virtual bool store_date(TIME *time);
|
virtual bool store_date(MYSQL_TIME *time);
|
||||||
virtual bool store_time(TIME *time);
|
virtual bool store_time(MYSQL_TIME *time);
|
||||||
virtual bool store(float nr, uint32 decimals, String *buffer);
|
virtual bool store(float nr, uint32 decimals, String *buffer);
|
||||||
virtual bool store(double from, uint32 decimals, String *buffer);
|
virtual bool store(double from, uint32 decimals, String *buffer);
|
||||||
virtual bool store(Field *field);
|
virtual bool store(Field *field);
|
||||||
|
@ -3086,16 +3086,15 @@ static bool set_option_autocommit(THD *thd, set_var *var)
|
|||||||
if ((org_options & OPTION_NOT_AUTOCOMMIT))
|
if ((org_options & OPTION_NOT_AUTOCOMMIT))
|
||||||
{
|
{
|
||||||
/* We changed to auto_commit mode */
|
/* We changed to auto_commit mode */
|
||||||
thd->options&= ~(ulonglong) (OPTION_BEGIN |
|
thd->options&= ~(ulonglong) (OPTION_BEGIN | OPTION_KEEP_LOG);
|
||||||
OPTION_STATUS_NO_TRANS_UPDATE |
|
thd->no_trans_update.all= FALSE;
|
||||||
OPTION_KEEP_LOG);
|
|
||||||
thd->server_status|= SERVER_STATUS_AUTOCOMMIT;
|
thd->server_status|= SERVER_STATUS_AUTOCOMMIT;
|
||||||
if (ha_commit(thd))
|
if (ha_commit(thd))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
thd->options&= ~(ulonglong) (OPTION_STATUS_NO_TRANS_UPDATE);
|
thd->no_trans_update.all= FALSE;
|
||||||
thd->server_status&= ~SERVER_STATUS_AUTOCOMMIT;
|
thd->server_status&= ~SERVER_STATUS_AUTOCOMMIT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -391,14 +391,14 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
|
|||||||
{
|
{
|
||||||
sp_head *sp= newlex.sphead;
|
sp_head *sp= newlex.sphead;
|
||||||
|
|
||||||
if (dbchanged && (ret= mysql_change_db(thd, old_db.str, 1)))
|
if (dbchanged && (ret= mysql_change_db(thd, &old_db, TRUE)))
|
||||||
goto end;
|
goto end;
|
||||||
delete sp;
|
delete sp;
|
||||||
ret= SP_PARSE_ERROR;
|
ret= SP_PARSE_ERROR;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (dbchanged && (ret= mysql_change_db(thd, old_db.str, 1)))
|
if (dbchanged && (ret= mysql_change_db(thd, &old_db, TRUE)))
|
||||||
goto end;
|
goto end;
|
||||||
*sphp= newlex.sphead;
|
*sphp= newlex.sphead;
|
||||||
(*sphp)->set_definer(&definer_user_name, &definer_host_name);
|
(*sphp)->set_definer(&definer_user_name, &definer_host_name);
|
||||||
@ -724,7 +724,7 @@ print_field_values(THD *thd, TABLE *table,
|
|||||||
switch (used_field->field_type) {
|
switch (used_field->field_type) {
|
||||||
case MYSQL_TYPE_TIMESTAMP:
|
case MYSQL_TYPE_TIMESTAMP:
|
||||||
{
|
{
|
||||||
TIME tmp_time;
|
MYSQL_TIME tmp_time;
|
||||||
|
|
||||||
bzero((char *)&tmp_time, sizeof(tmp_time));
|
bzero((char *)&tmp_time, sizeof(tmp_time));
|
||||||
((Field_timestamp *) used_field->field)->get_time(&tmp_time);
|
((Field_timestamp *) used_field->field)->get_time(&tmp_time);
|
||||||
@ -1863,7 +1863,7 @@ sp_use_new_db(THD *thd, LEX_STRING new_db, LEX_STRING *old_db,
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret= mysql_change_db(thd, new_db.str, no_access_check);
|
ret= mysql_change_db(thd, &new_db, no_access_check);
|
||||||
|
|
||||||
*dbchangedp= ret == 0;
|
*dbchangedp= ret == 0;
|
||||||
DBUG_RETURN(ret);
|
DBUG_RETURN(ret);
|
||||||
|
@ -349,13 +349,13 @@ sp_eval_expr(THD *thd, Field *result_field, Item **expr_item_ptr)
|
|||||||
|
|
||||||
enum_check_fields save_count_cuted_fields= thd->count_cuted_fields;
|
enum_check_fields save_count_cuted_fields= thd->count_cuted_fields;
|
||||||
bool save_abort_on_warning= thd->abort_on_warning;
|
bool save_abort_on_warning= thd->abort_on_warning;
|
||||||
bool save_no_trans_update= thd->no_trans_update;
|
bool save_no_trans_update_stmt= thd->no_trans_update.stmt;
|
||||||
|
|
||||||
thd->count_cuted_fields= CHECK_FIELD_ERROR_FOR_NULL;
|
thd->count_cuted_fields= CHECK_FIELD_ERROR_FOR_NULL;
|
||||||
thd->abort_on_warning=
|
thd->abort_on_warning=
|
||||||
thd->variables.sql_mode &
|
thd->variables.sql_mode &
|
||||||
(MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES);
|
(MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES);
|
||||||
thd->no_trans_update= 0;
|
thd->no_trans_update.stmt= FALSE;
|
||||||
|
|
||||||
/* Save the value in the field. Convert the value if needed. */
|
/* Save the value in the field. Convert the value if needed. */
|
||||||
|
|
||||||
@ -363,7 +363,7 @@ sp_eval_expr(THD *thd, Field *result_field, Item **expr_item_ptr)
|
|||||||
|
|
||||||
thd->count_cuted_fields= save_count_cuted_fields;
|
thd->count_cuted_fields= save_count_cuted_fields;
|
||||||
thd->abort_on_warning= save_abort_on_warning;
|
thd->abort_on_warning= save_abort_on_warning;
|
||||||
thd->no_trans_update= save_no_trans_update;
|
thd->no_trans_update.stmt= save_no_trans_update_stmt;
|
||||||
|
|
||||||
if (thd->net.report_error)
|
if (thd->net.report_error)
|
||||||
{
|
{
|
||||||
@ -1170,7 +1170,7 @@ sp_head::execute(THD *thd)
|
|||||||
(It would generate an error from mysql_change_db() when old_db=="")
|
(It would generate an error from mysql_change_db() when old_db=="")
|
||||||
*/
|
*/
|
||||||
if (! thd->killed)
|
if (! thd->killed)
|
||||||
err_status|= mysql_change_db(thd, old_db.str, 1);
|
err_status|= mysql_change_db(thd, &old_db, TRUE);
|
||||||
}
|
}
|
||||||
m_flags&= ~IS_INVOKED;
|
m_flags&= ~IS_INVOKED;
|
||||||
DBUG_PRINT("info",
|
DBUG_PRINT("info",
|
||||||
|
@ -4052,6 +4052,26 @@ err2:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool check_grant_db_routine(THD *thd, const char *db, HASH *hash)
|
||||||
|
{
|
||||||
|
Security_context *sctx= thd->security_ctx;
|
||||||
|
|
||||||
|
for (uint idx= 0; idx < hash->records; ++idx)
|
||||||
|
{
|
||||||
|
GRANT_NAME *item= (GRANT_NAME*) hash_element(hash, idx);
|
||||||
|
|
||||||
|
if (strcmp(item->user, sctx->priv_user) == 0 &&
|
||||||
|
strcmp(item->db, db) == 0 &&
|
||||||
|
compare_hostname(&item->host, sctx->host, sctx->ip))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Check if a user has the right to access a database
|
Check if a user has the right to access a database
|
||||||
Access is accepted if he has a grant for any table/routine in the database
|
Access is accepted if he has a grant for any table/routine in the database
|
||||||
@ -4063,9 +4083,10 @@ bool check_grant_db(THD *thd,const char *db)
|
|||||||
Security_context *sctx= thd->security_ctx;
|
Security_context *sctx= thd->security_ctx;
|
||||||
char helping [NAME_LEN+USERNAME_LENGTH+2];
|
char helping [NAME_LEN+USERNAME_LENGTH+2];
|
||||||
uint len;
|
uint len;
|
||||||
bool error= 1;
|
bool error= TRUE;
|
||||||
|
|
||||||
len= (uint) (strmov(strmov(helping, sctx->priv_user) + 1, db) - helping) + 1;
|
len= (uint) (strmov(strmov(helping, sctx->priv_user) + 1, db) - helping) + 1;
|
||||||
|
|
||||||
rw_rdlock(&LOCK_grant);
|
rw_rdlock(&LOCK_grant);
|
||||||
|
|
||||||
for (uint idx=0 ; idx < column_priv_hash.records ; idx++)
|
for (uint idx=0 ; idx < column_priv_hash.records ; idx++)
|
||||||
@ -4076,11 +4097,17 @@ bool check_grant_db(THD *thd,const char *db)
|
|||||||
!memcmp(grant_table->hash_key,helping,len) &&
|
!memcmp(grant_table->hash_key,helping,len) &&
|
||||||
compare_hostname(&grant_table->host, sctx->host, sctx->ip))
|
compare_hostname(&grant_table->host, sctx->host, sctx->ip))
|
||||||
{
|
{
|
||||||
error=0; // Found match
|
error= FALSE; /* Found match. */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
error= check_grant_db_routine(thd, db, &proc_priv_hash) &&
|
||||||
|
check_grant_db_routine(thd, db, &func_priv_hash);
|
||||||
|
|
||||||
rw_unlock(&LOCK_grant);
|
rw_unlock(&LOCK_grant);
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4559,15 +4559,36 @@ find_field_in_tables(THD *thd, Item_ident *item,
|
|||||||
{
|
{
|
||||||
Field *cur_field= find_field_in_table_ref(thd, cur_table, name, length,
|
Field *cur_field= find_field_in_table_ref(thd, cur_table, name, length,
|
||||||
item->name, db, table_name, ref,
|
item->name, db, table_name, ref,
|
||||||
check_privileges, allow_rowid,
|
check_privileges,
|
||||||
|
allow_rowid,
|
||||||
&(item->cached_field_index),
|
&(item->cached_field_index),
|
||||||
register_tree_change,
|
register_tree_change,
|
||||||
&actual_table);
|
&actual_table);
|
||||||
if (cur_field)
|
if (cur_field)
|
||||||
{
|
{
|
||||||
if (cur_field == WRONG_GRANT)
|
if (cur_field == WRONG_GRANT)
|
||||||
|
{
|
||||||
|
if (thd->lex->sql_command != SQLCOM_SHOW_FIELDS)
|
||||||
return (Field*) 0;
|
return (Field*) 0;
|
||||||
|
|
||||||
|
thd->clear_error();
|
||||||
|
cur_field= find_field_in_table_ref(thd, cur_table, name, length,
|
||||||
|
item->name, db, table_name, ref,
|
||||||
|
false,
|
||||||
|
allow_rowid,
|
||||||
|
&(item->cached_field_index),
|
||||||
|
register_tree_change,
|
||||||
|
&actual_table);
|
||||||
|
if (cur_field)
|
||||||
|
{
|
||||||
|
Field *nf=new Field_null(NULL,0,Field::NONE,
|
||||||
|
cur_field->field_name,
|
||||||
|
&my_charset_bin);
|
||||||
|
nf->init(cur_table->table);
|
||||||
|
cur_field= nf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Store the original table of the field, which may be different from
|
Store the original table of the field, which may be different from
|
||||||
cur_table in the case of NATURAL/USING join.
|
cur_table in the case of NATURAL/USING join.
|
||||||
@ -6390,7 +6411,7 @@ fill_record(THD *thd, Field **ptr, List<Item> &values, bool ignore_errors)
|
|||||||
table= field->table;
|
table= field->table;
|
||||||
if (field == table->next_number_field)
|
if (field == table->next_number_field)
|
||||||
table->auto_increment_field_not_null= TRUE;
|
table->auto_increment_field_not_null= TRUE;
|
||||||
if (value->save_in_field(field, 0) == -1)
|
if (value->save_in_field(field, 0) < 0)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
DBUG_RETURN(thd->net.report_error);
|
DBUG_RETURN(thd->net.report_error);
|
||||||
|
@ -377,7 +377,7 @@ inline Query_cache_block * Query_cache_block_table::block()
|
|||||||
void Query_cache_block::init(ulong block_length)
|
void Query_cache_block::init(ulong block_length)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("Query_cache_block::init");
|
DBUG_ENTER("Query_cache_block::init");
|
||||||
DBUG_PRINT("qcache", ("init block 0x%lx length: %lu", (ulong) this,
|
DBUG_PRINT("qcache", ("init block: 0x%lx length: %lu", (ulong) this,
|
||||||
block_length));
|
block_length));
|
||||||
length = block_length;
|
length = block_length;
|
||||||
used = 0;
|
used = 0;
|
||||||
|
@ -841,7 +841,8 @@ void THD::add_changed_table(const char *key, long key_length)
|
|||||||
{
|
{
|
||||||
list_include(prev_changed, curr, changed_table_dup(key, key_length));
|
list_include(prev_changed, curr, changed_table_dup(key, key_length));
|
||||||
DBUG_PRINT("info",
|
DBUG_PRINT("info",
|
||||||
("key_length %ld %u", key_length, (*prev_changed)->key_length));
|
("key_length: %ld %u", key_length,
|
||||||
|
(*prev_changed)->key_length));
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
else if (cmp == 0)
|
else if (cmp == 0)
|
||||||
@ -851,7 +852,7 @@ void THD::add_changed_table(const char *key, long key_length)
|
|||||||
{
|
{
|
||||||
list_include(prev_changed, curr, changed_table_dup(key, key_length));
|
list_include(prev_changed, curr, changed_table_dup(key, key_length));
|
||||||
DBUG_PRINT("info",
|
DBUG_PRINT("info",
|
||||||
("key_length %ld %u", key_length,
|
("key_length: %ld %u", key_length,
|
||||||
(*prev_changed)->key_length));
|
(*prev_changed)->key_length));
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
@ -863,7 +864,7 @@ void THD::add_changed_table(const char *key, long key_length)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*prev_changed = changed_table_dup(key, key_length);
|
*prev_changed = changed_table_dup(key, key_length);
|
||||||
DBUG_PRINT("info", ("key_length %ld %u", key_length,
|
DBUG_PRINT("info", ("key_length: %ld %u", key_length,
|
||||||
(*prev_changed)->key_length));
|
(*prev_changed)->key_length));
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ struct system_variables
|
|||||||
|
|
||||||
Time_zone *time_zone;
|
Time_zone *time_zone;
|
||||||
|
|
||||||
/* DATE, DATETIME and TIME formats */
|
/* DATE, DATETIME and MYSQL_TIME formats */
|
||||||
DATE_TIME_FORMAT *date_format;
|
DATE_TIME_FORMAT *date_format;
|
||||||
DATE_TIME_FORMAT *datetime_format;
|
DATE_TIME_FORMAT *datetime_format;
|
||||||
DATE_TIME_FORMAT *time_format;
|
DATE_TIME_FORMAT *time_format;
|
||||||
@ -1356,7 +1356,11 @@ public:
|
|||||||
bool charset_is_system_charset, charset_is_collation_connection;
|
bool charset_is_system_charset, charset_is_collation_connection;
|
||||||
bool charset_is_character_set_filesystem;
|
bool charset_is_character_set_filesystem;
|
||||||
bool enable_slow_log; /* enable slow log for current statement */
|
bool enable_slow_log; /* enable slow log for current statement */
|
||||||
bool no_trans_update, abort_on_warning;
|
struct {
|
||||||
|
bool all:1;
|
||||||
|
bool stmt:1;
|
||||||
|
} no_trans_update;
|
||||||
|
bool abort_on_warning;
|
||||||
bool got_warning; /* Set on call to push_warning() */
|
bool got_warning; /* Set on call to push_warning() */
|
||||||
bool no_warnings_for_error; /* no warnings on call to my_error() */
|
bool no_warnings_for_error; /* no warnings on call to my_error() */
|
||||||
/* set during loop of derived table processing */
|
/* set during loop of derived table processing */
|
||||||
@ -1584,7 +1588,7 @@ public:
|
|||||||
inline bool really_abort_on_warning()
|
inline bool really_abort_on_warning()
|
||||||
{
|
{
|
||||||
return (abort_on_warning &&
|
return (abort_on_warning &&
|
||||||
(!no_trans_update ||
|
(!no_trans_update.stmt ||
|
||||||
(variables.sql_mode & MODE_STRICT_ALL_TABLES)));
|
(variables.sql_mode & MODE_STRICT_ALL_TABLES)));
|
||||||
}
|
}
|
||||||
void set_status_var_init();
|
void set_status_var_init();
|
||||||
|
@ -315,6 +315,7 @@ int check_user(THD *thd, enum enum_server_command command,
|
|||||||
bool check_count)
|
bool check_count)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("check_user");
|
DBUG_ENTER("check_user");
|
||||||
|
LEX_STRING db_str= { (char *) db, db ? strlen(db) : 0 };
|
||||||
|
|
||||||
#ifdef NO_EMBEDDED_ACCESS_CHECKS
|
#ifdef NO_EMBEDDED_ACCESS_CHECKS
|
||||||
thd->main_security_ctx.master_access= GLOBAL_ACLS; // Full rights
|
thd->main_security_ctx.master_access= GLOBAL_ACLS; // Full rights
|
||||||
@ -326,7 +327,7 @@ int check_user(THD *thd, enum enum_server_command command,
|
|||||||
function returns 0
|
function returns 0
|
||||||
*/
|
*/
|
||||||
thd->reset_db(NULL, 0);
|
thd->reset_db(NULL, 0);
|
||||||
if (mysql_change_db(thd, db, FALSE))
|
if (mysql_change_db(thd, &db_str, FALSE))
|
||||||
{
|
{
|
||||||
/* Send the error to the client */
|
/* Send the error to the client */
|
||||||
net_send_error(thd);
|
net_send_error(thd);
|
||||||
@ -472,7 +473,7 @@ int check_user(THD *thd, enum enum_server_command command,
|
|||||||
/* Change database if necessary */
|
/* Change database if necessary */
|
||||||
if (db && db[0])
|
if (db && db[0])
|
||||||
{
|
{
|
||||||
if (mysql_change_db(thd, db, FALSE))
|
if (mysql_change_db(thd, &db_str, FALSE))
|
||||||
{
|
{
|
||||||
/* Send error to the client */
|
/* Send error to the client */
|
||||||
net_send_error(thd);
|
net_send_error(thd);
|
||||||
|
356
sql/sql_db.cc
356
sql/sql_db.cc
@ -22,6 +22,7 @@
|
|||||||
#include "events.h"
|
#include "events.h"
|
||||||
#include <my_dir.h>
|
#include <my_dir.h>
|
||||||
#include <m_ctype.h>
|
#include <m_ctype.h>
|
||||||
|
#include "log.h"
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#endif
|
#endif
|
||||||
@ -577,7 +578,7 @@ bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
|
|||||||
DBUG_ENTER("mysql_create_db");
|
DBUG_ENTER("mysql_create_db");
|
||||||
|
|
||||||
/* do not create 'information_schema' db */
|
/* do not create 'information_schema' db */
|
||||||
if (!my_strcasecmp(system_charset_info, db, information_schema_name.str))
|
if (!my_strcasecmp(system_charset_info, db, INFORMATION_SCHEMA_NAME.str))
|
||||||
{
|
{
|
||||||
my_error(ER_DB_CREATE_EXISTS, MYF(0), db);
|
my_error(ER_DB_CREATE_EXISTS, MYF(0), db);
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
@ -1256,155 +1257,254 @@ err:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
Change the current database.
|
@brief Internal implementation: switch current database to a valid one.
|
||||||
|
|
||||||
SYNOPSIS
|
@param thd Thread context.
|
||||||
mysql_change_db()
|
@param new_db_name Name of the database to switch to. The function will
|
||||||
thd thread handle
|
take ownership of the name (the caller must not free
|
||||||
name database name
|
the allocated memory). If the name is NULL, we're
|
||||||
no_access_check if TRUE, don't do access check. In this
|
going to switch to NULL db.
|
||||||
case name may be ""
|
@param new_db_access Privileges of the new database.
|
||||||
|
@param new_db_charset Character set of the new database.
|
||||||
DESCRIPTION
|
|
||||||
Check that the database name corresponds to a valid and
|
|
||||||
existent database, check access rights (unless called with
|
|
||||||
no_access_check), and set the current database. This function
|
|
||||||
is called to change the current database upon user request
|
|
||||||
(COM_CHANGE_DB command) or temporarily, to execute a stored
|
|
||||||
routine.
|
|
||||||
|
|
||||||
NOTES
|
|
||||||
This function is not the only way to switch the database that
|
|
||||||
is currently employed. When the replication slave thread
|
|
||||||
switches the database before executing a query, it calls
|
|
||||||
thd->set_db directly. However, if the query, in turn, uses
|
|
||||||
a stored routine, the stored routine will use this function,
|
|
||||||
even if it's run on the slave.
|
|
||||||
|
|
||||||
This function allocates the name of the database on the system
|
|
||||||
heap: this is necessary to be able to uniformly change the
|
|
||||||
database from any module of the server. Up to 5.0 different
|
|
||||||
modules were using different memory to store the name of the
|
|
||||||
database, and this led to memory corruption: a stack pointer
|
|
||||||
set by Stored Procedures was used by replication after the
|
|
||||||
stack address was long gone.
|
|
||||||
|
|
||||||
This function does not send anything, including error
|
|
||||||
messages, to the client. If that should be sent to the client,
|
|
||||||
call net_send_error after this function.
|
|
||||||
|
|
||||||
RETURN VALUES
|
|
||||||
0 OK
|
|
||||||
1 error
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool mysql_change_db(THD *thd, const char *name, bool no_access_check)
|
static void mysql_change_db_impl(THD *thd,
|
||||||
|
LEX_STRING *new_db_name,
|
||||||
|
ulong new_db_access,
|
||||||
|
CHARSET_INFO *new_db_charset)
|
||||||
{
|
{
|
||||||
LEX_STRING db_name;
|
/* 1. Change current database in THD. */
|
||||||
bool system_db= 0;
|
|
||||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
|
||||||
ulong db_access;
|
|
||||||
Security_context *sctx= thd->security_ctx;
|
|
||||||
LINT_INIT(db_access);
|
|
||||||
#endif
|
|
||||||
DBUG_ENTER("mysql_change_db");
|
|
||||||
DBUG_PRINT("enter",("name: '%s'",name));
|
|
||||||
|
|
||||||
if (name == NULL || name[0] == '\0' && no_access_check == FALSE)
|
if (new_db_name == NULL)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
THD::set_db() does all the job -- it frees previous database name and
|
||||||
|
sets the new one.
|
||||||
|
*/
|
||||||
|
|
||||||
|
thd->set_db(NULL, 0);
|
||||||
|
}
|
||||||
|
else if (new_db_name == &INFORMATION_SCHEMA_NAME)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Here we must use THD::set_db(), because we want to copy
|
||||||
|
INFORMATION_SCHEMA_NAME constant.
|
||||||
|
*/
|
||||||
|
|
||||||
|
thd->set_db(INFORMATION_SCHEMA_NAME.str, INFORMATION_SCHEMA_NAME.length);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Here we already have a copy of database name to be used in THD. So,
|
||||||
|
we just call THD::reset_db(). Since THD::reset_db() does not releases
|
||||||
|
the previous database name, we should do it explicitly.
|
||||||
|
*/
|
||||||
|
|
||||||
|
x_free(thd->db);
|
||||||
|
|
||||||
|
thd->reset_db(new_db_name->str, new_db_name->length);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 2. Update security context. */
|
||||||
|
|
||||||
|
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||||
|
thd->security_ctx->db_access= new_db_access;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* 3. Update db-charset environment variables. */
|
||||||
|
|
||||||
|
thd->db_charset= new_db_charset;
|
||||||
|
thd->variables.collation_database= new_db_charset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Change the current database.
|
||||||
|
|
||||||
|
@param thd thread handle
|
||||||
|
@param name database name
|
||||||
|
@param force_switch if this flag is set (TRUE), mysql_change_db() will
|
||||||
|
switch to NULL db if the specified database is not
|
||||||
|
available anymore. Corresponding warning will be
|
||||||
|
thrown in this case. This flag is used to change
|
||||||
|
database in stored-routine-execution code.
|
||||||
|
|
||||||
|
@details Check that the database name corresponds to a valid and existent
|
||||||
|
database, check access rights (unless called with no_access_check), and
|
||||||
|
set the current database. This function is called to change the current
|
||||||
|
database upon user request (COM_CHANGE_DB command) or temporarily, to
|
||||||
|
execute a stored routine.
|
||||||
|
|
||||||
|
This function is not the only way to switch the database that is
|
||||||
|
currently employed. When the replication slave thread switches the
|
||||||
|
database before executing a query, it calls thd->set_db directly.
|
||||||
|
However, if the query, in turn, uses a stored routine, the stored routine
|
||||||
|
will use this function, even if it's run on the slave.
|
||||||
|
|
||||||
|
This function allocates the name of the database on the system heap: this
|
||||||
|
is necessary to be able to uniformly change the database from any module
|
||||||
|
of the server. Up to 5.0 different modules were using different memory to
|
||||||
|
store the name of the database, and this led to memory corruption:
|
||||||
|
a stack pointer set by Stored Procedures was used by replication after
|
||||||
|
the stack address was long gone.
|
||||||
|
|
||||||
|
@return Operation status
|
||||||
|
@retval FALSE Success
|
||||||
|
@retval TRUE Error
|
||||||
|
*/
|
||||||
|
|
||||||
|
bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch)
|
||||||
|
{
|
||||||
|
LEX_STRING new_db_file_name;
|
||||||
|
|
||||||
|
Security_context *sctx= thd->security_ctx;
|
||||||
|
ulong db_access= sctx->db_access;
|
||||||
|
|
||||||
|
DBUG_ENTER("mysql_change_db");
|
||||||
|
DBUG_PRINT("enter",("name: '%s'", new_db_name->str));
|
||||||
|
|
||||||
|
if (new_db_name == NULL ||
|
||||||
|
new_db_name->length == 0)
|
||||||
|
{
|
||||||
|
if (force_switch)
|
||||||
|
{
|
||||||
|
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
|
||||||
|
ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR));
|
||||||
|
|
||||||
|
/* Change db to NULL. */
|
||||||
|
|
||||||
|
mysql_change_db_impl(thd, NULL, 0, thd->variables.collation_server);
|
||||||
|
|
||||||
|
DBUG_RETURN(FALSE);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0));
|
my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0));
|
||||||
DBUG_RETURN(1); /* purecov: inspected */
|
|
||||||
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
else if (name[0] == '\0')
|
|
||||||
{
|
|
||||||
/* Called from SP to restore the original database, which was NULL */
|
|
||||||
DBUG_ASSERT(no_access_check);
|
|
||||||
system_db= 1;
|
|
||||||
db_name.str= NULL;
|
|
||||||
db_name.length= 0;
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
Now we need to make a copy because check_db_name requires a
|
|
||||||
non-constant argument. TODO: fix check_db_name.
|
|
||||||
*/
|
|
||||||
if ((db_name.str= my_strdup(name, MYF(MY_WME))) == NULL)
|
|
||||||
DBUG_RETURN(1); /* the error is set */
|
|
||||||
db_name.length= strlen(db_name.str);
|
|
||||||
if (check_db_name(&db_name))
|
|
||||||
{
|
|
||||||
my_error(ER_WRONG_DB_NAME, MYF(0), db_name.str);
|
|
||||||
my_free(db_name.str, MYF(0));
|
|
||||||
DBUG_RETURN(1);
|
|
||||||
}
|
|
||||||
DBUG_PRINT("info",("Use database: %s", db_name.str));
|
|
||||||
if (!my_strcasecmp(system_charset_info, db_name.str,
|
|
||||||
information_schema_name.str))
|
|
||||||
{
|
|
||||||
system_db= 1;
|
|
||||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
|
||||||
db_access= SELECT_ACL;
|
|
||||||
#endif
|
|
||||||
goto end;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
if (my_strcasecmp(system_charset_info, new_db_name->str,
|
||||||
if (!no_access_check)
|
INFORMATION_SCHEMA_NAME.str) == 0)
|
||||||
{
|
{
|
||||||
if (test_all_bits(sctx->master_access, DB_ACLS))
|
/* Switch database to INFORMATION_SCHEMA. */
|
||||||
db_access=DB_ACLS;
|
|
||||||
else
|
mysql_change_db_impl(thd, &INFORMATION_SCHEMA_NAME, SELECT_ACL,
|
||||||
db_access= (acl_get(sctx->host, sctx->ip, sctx->priv_user,
|
system_charset_info);
|
||||||
db_name.str, 0) |
|
|
||||||
sctx->master_access);
|
DBUG_RETURN(FALSE);
|
||||||
if (!(db_access & DB_ACLS) && (!grant_option ||
|
}
|
||||||
check_grant_db(thd, db_name.str)))
|
|
||||||
|
/*
|
||||||
|
Now we need to make a copy because check_db_name requires a
|
||||||
|
non-constant argument. Actually, it takes database file name.
|
||||||
|
|
||||||
|
TODO: fix check_db_name().
|
||||||
|
*/
|
||||||
|
|
||||||
|
new_db_file_name.str= my_strndup(new_db_name->str, new_db_name->length,
|
||||||
|
MYF(MY_WME));
|
||||||
|
new_db_file_name.length= new_db_name->length;
|
||||||
|
|
||||||
|
if (new_db_file_name.str == NULL)
|
||||||
|
DBUG_RETURN(TRUE); /* the error is set */
|
||||||
|
|
||||||
|
/*
|
||||||
|
NOTE: if check_db_name() fails, we should throw an error in any case,
|
||||||
|
even if we are called from sp_head::execute().
|
||||||
|
|
||||||
|
It's next to impossible however to get this error when we are called
|
||||||
|
from sp_head::execute(). But let's switch database to NULL in this case
|
||||||
|
to be sure.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (check_db_name(&new_db_file_name))
|
||||||
|
{
|
||||||
|
my_error(ER_WRONG_DB_NAME, MYF(0), new_db_file_name.str);
|
||||||
|
my_free(new_db_file_name.str, MYF(0));
|
||||||
|
|
||||||
|
if (force_switch)
|
||||||
|
{
|
||||||
|
/* Change db to NULL. */
|
||||||
|
mysql_change_db_impl(thd, NULL, 0, thd->variables.collation_server);
|
||||||
|
}
|
||||||
|
DBUG_RETURN(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
DBUG_PRINT("info",("Use database: %s", new_db_file_name.str));
|
||||||
|
|
||||||
|
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||||
|
if (!force_switch) /* FIXME: this is BUG#27337. */
|
||||||
|
{
|
||||||
|
db_access= (test_all_bits(sctx->master_access, DB_ACLS) ?
|
||||||
|
DB_ACLS :
|
||||||
|
acl_get(sctx->host,
|
||||||
|
sctx->ip,
|
||||||
|
sctx->priv_user,
|
||||||
|
new_db_file_name.str,
|
||||||
|
FALSE) | sctx->master_access);
|
||||||
|
|
||||||
|
if (!force_switch &&
|
||||||
|
!(db_access & DB_ACLS) &&
|
||||||
|
(!grant_option || check_grant_db(thd, new_db_file_name.str)))
|
||||||
{
|
{
|
||||||
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
|
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
|
||||||
sctx->priv_user,
|
sctx->priv_user,
|
||||||
sctx->priv_host,
|
sctx->priv_host,
|
||||||
db_name.str);
|
new_db_file_name.str);
|
||||||
general_log_print(thd, COM_INIT_DB, ER(ER_DBACCESS_DENIED_ERROR),
|
general_log_print(thd, COM_INIT_DB, ER(ER_DBACCESS_DENIED_ERROR),
|
||||||
sctx->priv_user, sctx->priv_host, db_name.str);
|
sctx->priv_user, sctx->priv_host,
|
||||||
my_free(db_name.str, MYF(0));
|
new_db_file_name.str);
|
||||||
DBUG_RETURN(1);
|
my_free(new_db_file_name.str, MYF(0));
|
||||||
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (check_db_dir_existence(db_name.str))
|
if (check_db_dir_existence(new_db_file_name.str))
|
||||||
{
|
{
|
||||||
my_error(ER_BAD_DB_ERROR, MYF(0), db_name.str);
|
if (force_switch)
|
||||||
my_free(db_name.str, MYF(0));
|
{
|
||||||
DBUG_RETURN(1);
|
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
|
||||||
}
|
ER_BAD_DB_ERROR, ER(ER_BAD_DB_ERROR),
|
||||||
|
new_db_file_name.str);
|
||||||
|
|
||||||
end:
|
my_free(new_db_file_name.str, MYF(0));
|
||||||
x_free(thd->db);
|
|
||||||
DBUG_ASSERT(db_name.str == NULL || db_name.str[0] != '\0');
|
/* Change db to NULL. */
|
||||||
thd->reset_db(db_name.str, db_name.length); // THD::~THD will free this
|
|
||||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
mysql_change_db_impl(thd, NULL, 0, thd->variables.collation_server);
|
||||||
if (!no_access_check)
|
|
||||||
sctx->db_access= db_access;
|
DBUG_RETURN(FALSE);
|
||||||
#endif
|
|
||||||
if (system_db)
|
|
||||||
{
|
|
||||||
thd->db_charset= system_charset_info;
|
|
||||||
thd->variables.collation_database= system_charset_info;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HA_CREATE_INFO create;
|
my_error(ER_BAD_DB_ERROR, MYF(0), new_db_file_name.str);
|
||||||
|
my_free(new_db_file_name.str, MYF(0));
|
||||||
load_db_opt_by_name(thd, db_name.str, &create);
|
DBUG_RETURN(TRUE);
|
||||||
|
|
||||||
thd->db_charset= create.default_table_charset ?
|
|
||||||
create.default_table_charset :
|
|
||||||
thd->variables.collation_server;
|
|
||||||
thd->variables.collation_database= thd->db_charset;
|
|
||||||
}
|
}
|
||||||
DBUG_RETURN(0);
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
NOTE: in mysql_change_db_impl() new_db_file_name is assigned to THD
|
||||||
|
attributes and will be freed in THD::~THD().
|
||||||
|
*/
|
||||||
|
|
||||||
|
{
|
||||||
|
HA_CREATE_INFO db_options;
|
||||||
|
|
||||||
|
load_db_opt_by_name(thd, new_db_name->str, &db_options);
|
||||||
|
|
||||||
|
mysql_change_db_impl(thd, &new_db_file_name, db_access,
|
||||||
|
db_options.default_table_charset ?
|
||||||
|
db_options.default_table_charset :
|
||||||
|
thd->variables.collation_server);
|
||||||
|
}
|
||||||
|
|
||||||
|
DBUG_RETURN(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1581,8 +1681,8 @@ bool mysql_rename_db(THD *thd, LEX_STRING *old_db, LEX_STRING *new_db)
|
|||||||
Failed to move all tables from the old database to the new one.
|
Failed to move all tables from the old database to the new one.
|
||||||
In the best case mysql_rename_tables() moved all tables back to the old
|
In the best case mysql_rename_tables() moved all tables back to the old
|
||||||
database. In the worst case mysql_rename_tables() moved some tables
|
database. In the worst case mysql_rename_tables() moved some tables
|
||||||
to the new database, then failed, then started to move the tables back, and
|
to the new database, then failed, then started to move the tables back,
|
||||||
then failed again. In this situation we have some tables in the
|
and then failed again. In this situation we have some tables in the
|
||||||
old database and some tables in the new database.
|
old database and some tables in the new database.
|
||||||
Let's delete the option file, and then the new database directory.
|
Let's delete the option file, and then the new database directory.
|
||||||
If some tables were left in the new directory, rmdir() will fail.
|
If some tables were left in the new directory, rmdir() will fail.
|
||||||
@ -1703,7 +1803,7 @@ bool mysql_rename_db(THD *thd, LEX_STRING *old_db, LEX_STRING *new_db)
|
|||||||
|
|
||||||
/* Step9: Let's do "use newdb" if we renamed the current database */
|
/* Step9: Let's do "use newdb" if we renamed the current database */
|
||||||
if (change_to_newdb)
|
if (change_to_newdb)
|
||||||
error|= mysql_change_db(thd, new_db->str, 0);
|
error|= mysql_change_db(thd, new_db, 0);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
pthread_mutex_lock(&LOCK_lock_db);
|
pthread_mutex_lock(&LOCK_lock_db);
|
||||||
@ -1718,6 +1818,8 @@ exit:
|
|||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Check if there is directory for the database name.
|
Check if there is directory for the database name.
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ cleanup:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!transactional_table)
|
if (!transactional_table)
|
||||||
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
|
thd->no_trans_update.all= TRUE;
|
||||||
}
|
}
|
||||||
free_underlaid_joins(thd, select_lex);
|
free_underlaid_joins(thd, select_lex);
|
||||||
if (transactional_table)
|
if (transactional_table)
|
||||||
@ -832,7 +832,7 @@ bool multi_delete::send_eof()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!transactional_tables)
|
if (!transactional_tables)
|
||||||
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
|
thd->no_trans_update.all= TRUE;
|
||||||
}
|
}
|
||||||
/* Commit or rollback the current SQL statement */
|
/* Commit or rollback the current SQL statement */
|
||||||
if (transactional_tables)
|
if (transactional_tables)
|
||||||
|
@ -570,7 +570,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
|
|||||||
if (lock_type != TL_WRITE_DELAYED && !thd->prelocked_mode)
|
if (lock_type != TL_WRITE_DELAYED && !thd->prelocked_mode)
|
||||||
table->file->ha_start_bulk_insert(values_list.elements);
|
table->file->ha_start_bulk_insert(values_list.elements);
|
||||||
|
|
||||||
thd->no_trans_update= 0;
|
thd->no_trans_update.stmt= FALSE;
|
||||||
thd->abort_on_warning= (!ignore && (thd->variables.sql_mode &
|
thd->abort_on_warning= (!ignore && (thd->variables.sql_mode &
|
||||||
(MODE_STRICT_TRANS_TABLES |
|
(MODE_STRICT_TRANS_TABLES |
|
||||||
MODE_STRICT_ALL_TABLES)));
|
MODE_STRICT_ALL_TABLES)));
|
||||||
@ -712,7 +712,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!transactional_table)
|
if (!transactional_table)
|
||||||
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
|
thd->no_trans_update.all= TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (transactional_table)
|
if (transactional_table)
|
||||||
@ -1120,7 +1120,7 @@ static int last_uniq_key(TABLE *table,uint keynr)
|
|||||||
then both on update triggers will work instead. Similarly both on
|
then both on update triggers will work instead. Similarly both on
|
||||||
delete triggers will be invoked if we will delete conflicting records.
|
delete triggers will be invoked if we will delete conflicting records.
|
||||||
|
|
||||||
Sets thd->no_trans_update if table which is updated didn't have
|
Sets thd->no_trans_update.stmt to TRUE if table which is updated didn't have
|
||||||
transactions.
|
transactions.
|
||||||
|
|
||||||
RETURN VALUE
|
RETURN VALUE
|
||||||
@ -1323,7 +1323,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
|
|||||||
goto err;
|
goto err;
|
||||||
info->deleted++;
|
info->deleted++;
|
||||||
if (!table->file->has_transactions())
|
if (!table->file->has_transactions())
|
||||||
thd->no_trans_update= 1;
|
thd->no_trans_update.stmt= TRUE;
|
||||||
if (table->triggers &&
|
if (table->triggers &&
|
||||||
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
|
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
|
||||||
TRG_ACTION_AFTER, TRUE))
|
TRG_ACTION_AFTER, TRUE))
|
||||||
@ -1364,7 +1364,7 @@ ok_or_after_trg_err:
|
|||||||
if (key)
|
if (key)
|
||||||
my_safe_afree(key,table->s->max_unique_length,MAX_KEY_LENGTH);
|
my_safe_afree(key,table->s->max_unique_length,MAX_KEY_LENGTH);
|
||||||
if (!table->file->has_transactions())
|
if (!table->file->has_transactions())
|
||||||
thd->no_trans_update= 1;
|
thd->no_trans_update.stmt= TRUE;
|
||||||
DBUG_RETURN(trg_error);
|
DBUG_RETURN(trg_error);
|
||||||
|
|
||||||
err:
|
err:
|
||||||
@ -2637,7 +2637,7 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
|
|||||||
if (info.handle_duplicates == DUP_REPLACE &&
|
if (info.handle_duplicates == DUP_REPLACE &&
|
||||||
(!table->triggers || !table->triggers->has_delete_triggers()))
|
(!table->triggers || !table->triggers->has_delete_triggers()))
|
||||||
table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE);
|
table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE);
|
||||||
thd->no_trans_update= 0;
|
thd->no_trans_update.stmt= FALSE;
|
||||||
thd->abort_on_warning= (!info.ignore &&
|
thd->abort_on_warning= (!info.ignore &&
|
||||||
(thd->variables.sql_mode &
|
(thd->variables.sql_mode &
|
||||||
(MODE_STRICT_TRANS_TABLES |
|
(MODE_STRICT_TRANS_TABLES |
|
||||||
@ -2818,7 +2818,7 @@ void select_insert::send_error(uint errcode,const char *err)
|
|||||||
table->file->has_transactions(), FALSE);
|
table->file->has_transactions(), FALSE);
|
||||||
if (!thd->current_stmt_binlog_row_based && !table->s->tmp_table &&
|
if (!thd->current_stmt_binlog_row_based && !table->s->tmp_table &&
|
||||||
!can_rollback_data())
|
!can_rollback_data())
|
||||||
thd->options|= OPTION_STATUS_NO_TRANS_UPDATE;
|
thd->no_trans_update.all= TRUE;
|
||||||
query_cache_invalidate3(thd, table, 1);
|
query_cache_invalidate3(thd, table, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2859,7 +2859,7 @@ bool select_insert::send_eof()
|
|||||||
*/
|
*/
|
||||||
if (!trans_table &&
|
if (!trans_table &&
|
||||||
(!table->s->tmp_table || !thd->current_stmt_binlog_row_based))
|
(!table->s->tmp_table || !thd->current_stmt_binlog_row_based))
|
||||||
thd->options|= OPTION_STATUS_NO_TRANS_UPDATE;
|
thd->no_trans_update.all= TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3166,7 +3166,7 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
|
|||||||
table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE);
|
table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE);
|
||||||
if (!thd->prelocked_mode)
|
if (!thd->prelocked_mode)
|
||||||
table->file->ha_start_bulk_insert((ha_rows) 0);
|
table->file->ha_start_bulk_insert((ha_rows) 0);
|
||||||
thd->no_trans_update= 0;
|
thd->no_trans_update.stmt= FALSE;
|
||||||
thd->abort_on_warning= (!info.ignore &&
|
thd->abort_on_warning= (!info.ignore &&
|
||||||
(thd->variables.sql_mode &
|
(thd->variables.sql_mode &
|
||||||
(MODE_STRICT_TRANS_TABLES |
|
(MODE_STRICT_TRANS_TABLES |
|
||||||
|
@ -376,7 +376,7 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
|||||||
table->file->ha_start_bulk_insert((ha_rows) 0);
|
table->file->ha_start_bulk_insert((ha_rows) 0);
|
||||||
table->copy_blobs=1;
|
table->copy_blobs=1;
|
||||||
|
|
||||||
thd->no_trans_update= 0;
|
thd->no_trans_update.stmt= FALSE;
|
||||||
thd->abort_on_warning= (!ignore &&
|
thd->abort_on_warning= (!ignore &&
|
||||||
(thd->variables.sql_mode &
|
(thd->variables.sql_mode &
|
||||||
(MODE_STRICT_TRANS_TABLES |
|
(MODE_STRICT_TRANS_TABLES |
|
||||||
@ -470,7 +470,7 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
|||||||
(ulong) (info.records - info.copied), (ulong) thd->cuted_fields);
|
(ulong) (info.records - info.copied), (ulong) thd->cuted_fields);
|
||||||
|
|
||||||
if (!transactional_table)
|
if (!transactional_table)
|
||||||
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
|
thd->no_trans_update.all= TRUE;
|
||||||
#ifndef EMBEDDED_LIBRARY
|
#ifndef EMBEDDED_LIBRARY
|
||||||
if (mysql_bin_log.is_open())
|
if (mysql_bin_log.is_open())
|
||||||
{
|
{
|
||||||
@ -552,7 +552,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
|
|||||||
Item_field *sql_field;
|
Item_field *sql_field;
|
||||||
TABLE *table= table_list->table;
|
TABLE *table= table_list->table;
|
||||||
ulonglong id;
|
ulonglong id;
|
||||||
bool no_trans_update;
|
bool no_trans_update_stmt;
|
||||||
DBUG_ENTER("read_fixed_length");
|
DBUG_ENTER("read_fixed_length");
|
||||||
|
|
||||||
id= 0;
|
id= 0;
|
||||||
@ -580,7 +580,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
|
|||||||
#ifdef HAVE_purify
|
#ifdef HAVE_purify
|
||||||
read_info.row_end[0]=0;
|
read_info.row_end[0]=0;
|
||||||
#endif
|
#endif
|
||||||
no_trans_update= !table->file->has_transactions();
|
no_trans_update_stmt= !table->file->has_transactions();
|
||||||
|
|
||||||
restore_record(table, s->default_values);
|
restore_record(table, s->default_values);
|
||||||
/*
|
/*
|
||||||
@ -646,7 +646,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
|
|||||||
|
|
||||||
if (write_record(thd, table, &info))
|
if (write_record(thd, table, &info))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
thd->no_trans_update= no_trans_update;
|
thd->no_trans_update.stmt= no_trans_update_stmt;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
We don't need to reset auto-increment field since we are restoring
|
We don't need to reset auto-increment field since we are restoring
|
||||||
@ -681,12 +681,12 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
|
|||||||
TABLE *table= table_list->table;
|
TABLE *table= table_list->table;
|
||||||
uint enclosed_length;
|
uint enclosed_length;
|
||||||
ulonglong id;
|
ulonglong id;
|
||||||
bool no_trans_update;
|
bool no_trans_update_stmt;
|
||||||
DBUG_ENTER("read_sep_field");
|
DBUG_ENTER("read_sep_field");
|
||||||
|
|
||||||
enclosed_length=enclosed.length();
|
enclosed_length=enclosed.length();
|
||||||
id= 0;
|
id= 0;
|
||||||
no_trans_update= !table->file->has_transactions();
|
no_trans_update_stmt= !table->file->has_transactions();
|
||||||
|
|
||||||
for (;;it.rewind())
|
for (;;it.rewind())
|
||||||
{
|
{
|
||||||
@ -822,7 +822,7 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
|
|||||||
We don't need to reset auto-increment field since we are restoring
|
We don't need to reset auto-increment field since we are restoring
|
||||||
its default value at the beginning of each loop iteration.
|
its default value at the beginning of each loop iteration.
|
||||||
*/
|
*/
|
||||||
thd->no_trans_update= no_trans_update;
|
thd->no_trans_update.stmt= no_trans_update_stmt;
|
||||||
if (read_info.next_line()) // Skip to next line
|
if (read_info.next_line()) // Skip to next line
|
||||||
break;
|
break;
|
||||||
if (read_info.line_cuted)
|
if (read_info.line_cuted)
|
||||||
|
@ -119,8 +119,8 @@ bool end_active_trans(THD *thd)
|
|||||||
if (ha_commit(thd))
|
if (ha_commit(thd))
|
||||||
error=1;
|
error=1;
|
||||||
}
|
}
|
||||||
thd->options&= ~(OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE |
|
thd->options&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
|
||||||
OPTION_KEEP_LOG);
|
thd->no_trans_update.all= FALSE;
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -546,8 +546,8 @@ int end_trans(THD *thd, enum enum_mysql_completiontype completion)
|
|||||||
*/
|
*/
|
||||||
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
||||||
res= ha_commit(thd);
|
res= ha_commit(thd);
|
||||||
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE |
|
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_KEEP_LOG);
|
||||||
OPTION_KEEP_LOG);
|
thd->no_trans_update.all= FALSE;
|
||||||
break;
|
break;
|
||||||
case COMMIT_RELEASE:
|
case COMMIT_RELEASE:
|
||||||
do_release= 1; /* fall through */
|
do_release= 1; /* fall through */
|
||||||
@ -564,8 +564,8 @@ int end_trans(THD *thd, enum enum_mysql_completiontype completion)
|
|||||||
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
||||||
if (ha_rollback(thd))
|
if (ha_rollback(thd))
|
||||||
res= -1;
|
res= -1;
|
||||||
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE |
|
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_KEEP_LOG);
|
||||||
OPTION_KEEP_LOG);
|
thd->no_trans_update.all= FALSE;
|
||||||
if (!res && (completion == ROLLBACK_AND_CHAIN))
|
if (!res && (completion == ROLLBACK_AND_CHAIN))
|
||||||
res= begin_trans(thd);
|
res= begin_trans(thd);
|
||||||
break;
|
break;
|
||||||
@ -720,7 +720,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||||||
&LOCK_status);
|
&LOCK_status);
|
||||||
thd->convert_string(&tmp, system_charset_info,
|
thd->convert_string(&tmp, system_charset_info,
|
||||||
packet, packet_length-1, thd->charset());
|
packet, packet_length-1, thd->charset());
|
||||||
if (!mysql_change_db(thd, tmp.str, FALSE))
|
if (!mysql_change_db(thd, &tmp, FALSE))
|
||||||
{
|
{
|
||||||
general_log_print(thd, command, "%s",thd->db);
|
general_log_print(thd, command, "%s",thd->db);
|
||||||
send_ok(thd);
|
send_ok(thd);
|
||||||
@ -961,7 +961,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||||||
packet= arg_end + 1;
|
packet= arg_end + 1;
|
||||||
|
|
||||||
if (!my_strcasecmp(system_charset_info, table_list.db,
|
if (!my_strcasecmp(system_charset_info, table_list.db,
|
||||||
information_schema_name.str))
|
INFORMATION_SCHEMA_NAME.str))
|
||||||
{
|
{
|
||||||
ST_SCHEMA_TABLE *schema_table= find_schema_table(thd, table_list.alias);
|
ST_SCHEMA_TABLE *schema_table= find_schema_table(thd, table_list.alias);
|
||||||
if (schema_table)
|
if (schema_table)
|
||||||
@ -2901,9 +2901,14 @@ end_with_restore_list:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
case SQLCOM_CHANGE_DB:
|
case SQLCOM_CHANGE_DB:
|
||||||
if (!mysql_change_db(thd,select_lex->db,FALSE))
|
{
|
||||||
|
LEX_STRING db_str= { (char *) select_lex->db, strlen(select_lex->db) };
|
||||||
|
|
||||||
|
if (!mysql_change_db(thd, &db_str, FALSE))
|
||||||
send_ok(thd);
|
send_ok(thd);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case SQLCOM_LOAD:
|
case SQLCOM_LOAD:
|
||||||
{
|
{
|
||||||
@ -3566,8 +3571,7 @@ end_with_restore_list:
|
|||||||
res= TRUE; // cannot happen
|
res= TRUE; // cannot happen
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((thd->options &
|
if (((thd->options & OPTION_KEEP_LOG) || thd->no_trans_update.all) &&
|
||||||
(OPTION_STATUS_NO_TRANS_UPDATE | OPTION_KEEP_LOG)) &&
|
|
||||||
!thd->slave_thread)
|
!thd->slave_thread)
|
||||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
ER_WARNING_NOT_COMPLETE_ROLLBACK,
|
ER_WARNING_NOT_COMPLETE_ROLLBACK,
|
||||||
@ -4139,9 +4143,8 @@ create_sp_error:
|
|||||||
thd->transaction.xid_state.xa_state=XA_ACTIVE;
|
thd->transaction.xid_state.xa_state=XA_ACTIVE;
|
||||||
thd->transaction.xid_state.xid.set(thd->lex->xid);
|
thd->transaction.xid_state.xid.set(thd->lex->xid);
|
||||||
xid_cache_insert(&thd->transaction.xid_state);
|
xid_cache_insert(&thd->transaction.xid_state);
|
||||||
thd->options= ((thd->options & ~(OPTION_STATUS_NO_TRANS_UPDATE |
|
thd->options= ((thd->options & ~(OPTION_KEEP_LOG)) | OPTION_BEGIN);
|
||||||
OPTION_KEEP_LOG)) |
|
thd->no_trans_update.all= FALSE;
|
||||||
OPTION_BEGIN);
|
|
||||||
thd->server_status|= SERVER_STATUS_IN_TRANS;
|
thd->server_status|= SERVER_STATUS_IN_TRANS;
|
||||||
send_ok(thd);
|
send_ok(thd);
|
||||||
break;
|
break;
|
||||||
@ -4234,8 +4237,8 @@ create_sp_error:
|
|||||||
xa_state_names[thd->transaction.xid_state.xa_state]);
|
xa_state_names[thd->transaction.xid_state.xa_state]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
thd->options&= ~(OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE |
|
thd->options&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
|
||||||
OPTION_KEEP_LOG);
|
thd->no_trans_update.all= FALSE;
|
||||||
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
||||||
xid_cache_delete(&thd->transaction.xid_state);
|
xid_cache_delete(&thd->transaction.xid_state);
|
||||||
thd->transaction.xid_state.xa_state=XA_NOTR;
|
thd->transaction.xid_state.xa_state=XA_NOTR;
|
||||||
@ -4265,8 +4268,8 @@ create_sp_error:
|
|||||||
my_error(ER_XAER_RMERR, MYF(0));
|
my_error(ER_XAER_RMERR, MYF(0));
|
||||||
else
|
else
|
||||||
send_ok(thd);
|
send_ok(thd);
|
||||||
thd->options&= ~(OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE |
|
thd->options&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
|
||||||
OPTION_KEEP_LOG);
|
thd->no_trans_update.all= FALSE;
|
||||||
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
||||||
xid_cache_delete(&thd->transaction.xid_state);
|
xid_cache_delete(&thd->transaction.xid_state);
|
||||||
thd->transaction.xid_state.xa_state=XA_NOTR;
|
thd->transaction.xid_state.xa_state=XA_NOTR;
|
||||||
@ -4501,7 +4504,10 @@ bool check_single_table_access(THD *thd, ulong privilege,
|
|||||||
goto deny;
|
goto deny;
|
||||||
|
|
||||||
/* Show only 1 table for check_grant */
|
/* Show only 1 table for check_grant */
|
||||||
if (grant_option && check_grant(thd, privilege, all_tables, 0, 1, 0))
|
if (grant_option &&
|
||||||
|
!(all_tables->belong_to_view &&
|
||||||
|
(thd->lex->sql_command == SQLCOM_SHOW_FIELDS)) &&
|
||||||
|
check_grant(thd, privilege, all_tables, 0, 1, 0))
|
||||||
goto deny;
|
goto deny;
|
||||||
|
|
||||||
thd->security_ctx= backup_ctx;
|
thd->security_ctx= backup_ctx;
|
||||||
@ -4770,7 +4776,7 @@ check_table_access(THD *thd, ulong want_access,TABLE_LIST *tables,
|
|||||||
if (!no_errors)
|
if (!no_errors)
|
||||||
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
|
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
|
||||||
sctx->priv_user, sctx->priv_host,
|
sctx->priv_user, sctx->priv_host,
|
||||||
information_schema_name.str);
|
INFORMATION_SCHEMA_NAME.str);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -5058,8 +5064,10 @@ void mysql_reset_thd_for_next_command(THD *thd)
|
|||||||
in ha_rollback_trans() about some tables couldn't be rolled back.
|
in ha_rollback_trans() about some tables couldn't be rolled back.
|
||||||
*/
|
*/
|
||||||
if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
|
if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
|
||||||
thd->options&= ~(OPTION_STATUS_NO_TRANS_UPDATE | OPTION_KEEP_LOG);
|
{
|
||||||
|
thd->options&= ~OPTION_KEEP_LOG;
|
||||||
|
thd->no_trans_update.all= FALSE;
|
||||||
|
}
|
||||||
DBUG_ASSERT(thd->security_ctx== &thd->main_security_ctx);
|
DBUG_ASSERT(thd->security_ctx== &thd->main_security_ctx);
|
||||||
thd->tmp_table_used= 0;
|
thd->tmp_table_used= 0;
|
||||||
if (!thd->in_sub_stmt)
|
if (!thd->in_sub_stmt)
|
||||||
@ -5559,7 +5567,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
|
|||||||
ptr->ignore_leaves= test(table_options & TL_OPTION_IGNORE_LEAVES);
|
ptr->ignore_leaves= test(table_options & TL_OPTION_IGNORE_LEAVES);
|
||||||
ptr->derived= table->sel;
|
ptr->derived= table->sel;
|
||||||
if (!ptr->derived && !my_strcasecmp(system_charset_info, ptr->db,
|
if (!ptr->derived && !my_strcasecmp(system_charset_info, ptr->db,
|
||||||
information_schema_name.str))
|
INFORMATION_SCHEMA_NAME.str))
|
||||||
{
|
{
|
||||||
ST_SCHEMA_TABLE *schema_table= find_schema_table(thd, ptr->table_name);
|
ST_SCHEMA_TABLE *schema_table= find_schema_table(thd, ptr->table_name);
|
||||||
if (!schema_table ||
|
if (!schema_table ||
|
||||||
@ -5567,7 +5575,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
|
|||||||
(sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND) == 0))
|
(sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND) == 0))
|
||||||
{
|
{
|
||||||
my_error(ER_UNKNOWN_TABLE, MYF(0),
|
my_error(ER_UNKNOWN_TABLE, MYF(0),
|
||||||
ptr->table_name, information_schema_name.str);
|
ptr->table_name, INFORMATION_SCHEMA_NAME.str);
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
ptr->schema_table_name= ptr->table_name;
|
ptr->schema_table_name= ptr->table_name;
|
||||||
|
@ -1670,7 +1670,7 @@ static bool check_prepared_statement(Prepared_statement *stmt,
|
|||||||
enum enum_sql_command sql_command= lex->sql_command;
|
enum enum_sql_command sql_command= lex->sql_command;
|
||||||
int res= 0;
|
int res= 0;
|
||||||
DBUG_ENTER("check_prepared_statement");
|
DBUG_ENTER("check_prepared_statement");
|
||||||
DBUG_PRINT("enter",("command: %d, param_count: %u",
|
DBUG_PRINT("enter",("command: %d param_count: %u",
|
||||||
sql_command, stmt->param_count));
|
sql_command, stmt->param_count));
|
||||||
|
|
||||||
lex->first_lists_tables_same();
|
lex->first_lists_tables_same();
|
||||||
|
@ -715,9 +715,9 @@ bool mysqld_show_create_db(THD *thd, char *dbname,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!my_strcasecmp(system_charset_info, dbname,
|
if (!my_strcasecmp(system_charset_info, dbname,
|
||||||
information_schema_name.str))
|
INFORMATION_SCHEMA_NAME.str))
|
||||||
{
|
{
|
||||||
dbname= information_schema_name.str;
|
dbname= INFORMATION_SCHEMA_NAME.str;
|
||||||
create.default_table_charset= system_charset_info;
|
create.default_table_charset= system_charset_info;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1800,7 +1800,7 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
|
|||||||
else
|
else
|
||||||
table->field[4]->store(command_name[tmp->command].str,
|
table->field[4]->store(command_name[tmp->command].str,
|
||||||
command_name[tmp->command].length, cs);
|
command_name[tmp->command].length, cs);
|
||||||
/* TIME */
|
/* MYSQL_TIME */
|
||||||
table->field[5]->store((uint32)(tmp->start_time ?
|
table->field[5]->store((uint32)(tmp->start_time ?
|
||||||
now - tmp->start_time : 0), TRUE);
|
now - tmp->start_time : 0), TRUE);
|
||||||
/* STATE */
|
/* STATE */
|
||||||
@ -2197,7 +2197,7 @@ LEX_STRING *make_lex_string(THD *thd, LEX_STRING *lex_str,
|
|||||||
|
|
||||||
|
|
||||||
/* INFORMATION_SCHEMA name */
|
/* INFORMATION_SCHEMA name */
|
||||||
LEX_STRING information_schema_name= { C_STRING_WITH_LEN("information_schema")};
|
LEX_STRING INFORMATION_SCHEMA_NAME= { C_STRING_WITH_LEN("information_schema")};
|
||||||
|
|
||||||
/* This is only used internally, but we need it here as a forward reference */
|
/* This is only used internally, but we need it here as a forward reference */
|
||||||
extern ST_SCHEMA_TABLE schema_tables[];
|
extern ST_SCHEMA_TABLE schema_tables[];
|
||||||
@ -2413,11 +2413,11 @@ int make_db_list(THD *thd, List<char> *files,
|
|||||||
*/
|
*/
|
||||||
if (!idx_field_vals->db_value ||
|
if (!idx_field_vals->db_value ||
|
||||||
!wild_case_compare(system_charset_info,
|
!wild_case_compare(system_charset_info,
|
||||||
information_schema_name.str,
|
INFORMATION_SCHEMA_NAME.str,
|
||||||
idx_field_vals->db_value))
|
idx_field_vals->db_value))
|
||||||
{
|
{
|
||||||
*with_i_schema= 1;
|
*with_i_schema= 1;
|
||||||
if (files->push_back(thd->strdup(information_schema_name.str)))
|
if (files->push_back(thd->strdup(INFORMATION_SCHEMA_NAME.str)))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return (find_files(thd, files, NullS, mysql_data_home,
|
return (find_files(thd, files, NullS, mysql_data_home,
|
||||||
@ -2431,11 +2431,11 @@ int make_db_list(THD *thd, List<char> *files,
|
|||||||
*/
|
*/
|
||||||
if (sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND)
|
if (sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND)
|
||||||
{
|
{
|
||||||
if (!my_strcasecmp(system_charset_info, information_schema_name.str,
|
if (!my_strcasecmp(system_charset_info, INFORMATION_SCHEMA_NAME.str,
|
||||||
idx_field_vals->db_value))
|
idx_field_vals->db_value))
|
||||||
{
|
{
|
||||||
*with_i_schema= 1;
|
*with_i_schema= 1;
|
||||||
return files->push_back(thd->strdup(information_schema_name.str));
|
return files->push_back(thd->strdup(INFORMATION_SCHEMA_NAME.str));
|
||||||
}
|
}
|
||||||
return files->push_back(thd->strdup(idx_field_vals->db_value));
|
return files->push_back(thd->strdup(idx_field_vals->db_value));
|
||||||
}
|
}
|
||||||
@ -2444,7 +2444,7 @@ int make_db_list(THD *thd, List<char> *files,
|
|||||||
Create list of existing databases. It is used in case
|
Create list of existing databases. It is used in case
|
||||||
of select from information schema table
|
of select from information schema table
|
||||||
*/
|
*/
|
||||||
if (files->push_back(thd->strdup(information_schema_name.str)))
|
if (files->push_back(thd->strdup(INFORMATION_SCHEMA_NAME.str)))
|
||||||
return 1;
|
return 1;
|
||||||
*with_i_schema= 1;
|
*with_i_schema= 1;
|
||||||
return (find_files(thd, files, NullS,
|
return (find_files(thd, files, NullS,
|
||||||
@ -2837,7 +2837,7 @@ static int get_schema_tables_record(THD *thd, struct st_table_list *tables,
|
|||||||
const char *file_name)
|
const char *file_name)
|
||||||
{
|
{
|
||||||
const char *tmp_buff;
|
const char *tmp_buff;
|
||||||
TIME time;
|
MYSQL_TIME time;
|
||||||
CHARSET_INFO *cs= system_charset_info;
|
CHARSET_INFO *cs= system_charset_info;
|
||||||
DBUG_ENTER("get_schema_tables_record");
|
DBUG_ENTER("get_schema_tables_record");
|
||||||
|
|
||||||
@ -3396,7 +3396,7 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table,
|
|||||||
{
|
{
|
||||||
String tmp_string;
|
String tmp_string;
|
||||||
String sp_db, sp_name, definer;
|
String sp_db, sp_name, definer;
|
||||||
TIME time;
|
MYSQL_TIME time;
|
||||||
LEX *lex= thd->lex;
|
LEX *lex= thd->lex;
|
||||||
CHARSET_INFO *cs= system_charset_info;
|
CHARSET_INFO *cs= system_charset_info;
|
||||||
get_field(thd->mem_root, proc_table->field[0], &sp_db);
|
get_field(thd->mem_root, proc_table->field[0], &sp_db);
|
||||||
@ -3968,7 +3968,7 @@ static void store_schema_partitions_record(THD *thd, TABLE *schema_table,
|
|||||||
TABLE* table= schema_table;
|
TABLE* table= schema_table;
|
||||||
CHARSET_INFO *cs= system_charset_info;
|
CHARSET_INFO *cs= system_charset_info;
|
||||||
PARTITION_INFO stat_info;
|
PARTITION_INFO stat_info;
|
||||||
TIME time;
|
MYSQL_TIME time;
|
||||||
file->get_dynamic_partition_info(&stat_info, part_id);
|
file->get_dynamic_partition_info(&stat_info, part_id);
|
||||||
table->field[12]->store((longlong) stat_info.records, TRUE);
|
table->field[12]->store((longlong) stat_info.records, TRUE);
|
||||||
table->field[13]->store((longlong) stat_info.mean_rec_length, TRUE);
|
table->field[13]->store((longlong) stat_info.mean_rec_length, TRUE);
|
||||||
@ -4306,7 +4306,7 @@ copy_event_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table)
|
|||||||
{
|
{
|
||||||
const char *wild= thd->lex->wild ? thd->lex->wild->ptr() : NullS;
|
const char *wild= thd->lex->wild ? thd->lex->wild->ptr() : NullS;
|
||||||
CHARSET_INFO *scs= system_charset_info;
|
CHARSET_INFO *scs= system_charset_info;
|
||||||
TIME time;
|
MYSQL_TIME time;
|
||||||
Event_timed et;
|
Event_timed et;
|
||||||
DBUG_ENTER("fill_events_copy_to_schema_tab");
|
DBUG_ENTER("fill_events_copy_to_schema_tab");
|
||||||
|
|
||||||
@ -5048,8 +5048,8 @@ int make_schema_select(THD *thd, SELECT_LEX *sel,
|
|||||||
We have to make non const db_name & table_name
|
We have to make non const db_name & table_name
|
||||||
because of lower_case_table_names
|
because of lower_case_table_names
|
||||||
*/
|
*/
|
||||||
make_lex_string(thd, &db, information_schema_name.str,
|
make_lex_string(thd, &db, INFORMATION_SCHEMA_NAME.str,
|
||||||
information_schema_name.length, 0);
|
INFORMATION_SCHEMA_NAME.length, 0);
|
||||||
make_lex_string(thd, &table, schema_table->table_name,
|
make_lex_string(thd, &table, schema_table->table_name,
|
||||||
strlen(schema_table->table_name), 0);
|
strlen(schema_table->table_name), 0);
|
||||||
if (schema_table->old_format(thd, schema_table) || /* Handle old syntax */
|
if (schema_table->old_format(thd, schema_table) || /* Handle old syntax */
|
||||||
|
@ -6751,7 +6751,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
|
|||||||
alter_table_manage_keys(to, from->file->indexes_are_disabled(), keys_onoff);
|
alter_table_manage_keys(to, from->file->indexes_are_disabled(), keys_onoff);
|
||||||
|
|
||||||
/* We can abort alter table for any table type */
|
/* We can abort alter table for any table type */
|
||||||
thd->no_trans_update= 0;
|
thd->no_trans_update.stmt= FALSE;
|
||||||
thd->abort_on_warning= !ignore && test(thd->variables.sql_mode &
|
thd->abort_on_warning= !ignore && test(thd->variables.sql_mode &
|
||||||
(MODE_STRICT_TRANS_TABLES |
|
(MODE_STRICT_TRANS_TABLES |
|
||||||
MODE_STRICT_ALL_TABLES));
|
MODE_STRICT_ALL_TABLES));
|
||||||
|
@ -447,7 +447,7 @@ int mysql_update(THD *thd,
|
|||||||
thd->proc_info="Updating";
|
thd->proc_info="Updating";
|
||||||
|
|
||||||
transactional_table= table->file->has_transactions();
|
transactional_table= table->file->has_transactions();
|
||||||
thd->no_trans_update= 0;
|
thd->no_trans_update.stmt= FALSE;
|
||||||
thd->abort_on_warning= test(!ignore &&
|
thd->abort_on_warning= test(!ignore &&
|
||||||
(thd->variables.sql_mode &
|
(thd->variables.sql_mode &
|
||||||
(MODE_STRICT_TRANS_TABLES |
|
(MODE_STRICT_TRANS_TABLES |
|
||||||
@ -535,7 +535,7 @@ int mysql_update(THD *thd,
|
|||||||
if (!error)
|
if (!error)
|
||||||
{
|
{
|
||||||
updated++;
|
updated++;
|
||||||
thd->no_trans_update= !transactional_table;
|
thd->no_trans_update.stmt= !transactional_table;
|
||||||
|
|
||||||
if (table->triggers &&
|
if (table->triggers &&
|
||||||
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
|
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
|
||||||
@ -665,7 +665,7 @@ int mysql_update(THD *thd,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!transactional_table)
|
if (!transactional_table)
|
||||||
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
|
thd->no_trans_update.all= TRUE;
|
||||||
}
|
}
|
||||||
free_underlaid_joins(thd, select_lex);
|
free_underlaid_joins(thd, select_lex);
|
||||||
if (transactional_table)
|
if (transactional_table)
|
||||||
@ -1030,7 +1030,7 @@ bool mysql_multi_update(THD *thd,
|
|||||||
handle_duplicates, ignore)))
|
handle_duplicates, ignore)))
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
|
|
||||||
thd->no_trans_update= 0;
|
thd->no_trans_update.stmt= FALSE;
|
||||||
thd->abort_on_warning= test(thd->variables.sql_mode &
|
thd->abort_on_warning= test(thd->variables.sql_mode &
|
||||||
(MODE_STRICT_TRANS_TABLES |
|
(MODE_STRICT_TRANS_TABLES |
|
||||||
MODE_STRICT_ALL_TABLES));
|
MODE_STRICT_ALL_TABLES));
|
||||||
@ -1344,7 +1344,7 @@ multi_update::~multi_update()
|
|||||||
delete [] copy_field;
|
delete [] copy_field;
|
||||||
thd->count_cuted_fields= CHECK_FIELD_IGNORE; // Restore this setting
|
thd->count_cuted_fields= CHECK_FIELD_IGNORE; // Restore this setting
|
||||||
if (!trans_safe)
|
if (!trans_safe)
|
||||||
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
|
thd->no_trans_update.all= TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1434,7 +1434,7 @@ bool multi_update::send_data(List<Item> ¬_used_values)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!table->file->has_transactions())
|
if (!table->file->has_transactions())
|
||||||
thd->no_trans_update= 1;
|
thd->no_trans_update.stmt= TRUE;
|
||||||
if (table->triggers &&
|
if (table->triggers &&
|
||||||
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
|
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
|
||||||
TRG_ACTION_AFTER, TRUE))
|
TRG_ACTION_AFTER, TRUE))
|
||||||
@ -1674,7 +1674,7 @@ bool multi_update::send_eof()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!transactional_tables)
|
if (!transactional_tables)
|
||||||
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
|
thd->no_trans_update.all= TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transactional_tables)
|
if (transactional_tables)
|
||||||
|
@ -496,37 +496,48 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
|
|||||||
/*
|
/*
|
||||||
Compare/check grants on view with grants of underlying tables
|
Compare/check grants on view with grants of underlying tables
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
fill_effective_table_privileges(thd, &view->grant, view->db,
|
||||||
|
view->table_name);
|
||||||
|
|
||||||
|
{
|
||||||
|
Item *report_item= NULL;
|
||||||
|
uint final_priv= VIEW_ANY_ACL;
|
||||||
|
|
||||||
for (sl= select_lex; sl; sl= sl->next_select())
|
for (sl= select_lex; sl; sl= sl->next_select())
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(view->db); /* Must be set in the parser */
|
DBUG_ASSERT(view->db); /* Must be set in the parser */
|
||||||
List_iterator_fast<Item> it(sl->item_list);
|
List_iterator_fast<Item> it(sl->item_list);
|
||||||
Item *item;
|
Item *item;
|
||||||
fill_effective_table_privileges(thd, &view->grant, view->db,
|
|
||||||
view->table_name);
|
|
||||||
while ((item= it++))
|
while ((item= it++))
|
||||||
{
|
{
|
||||||
Item_field *fld;
|
Item_field *fld= item->filed_for_view_update();
|
||||||
uint priv= (get_column_grant(thd, &view->grant, view->db,
|
uint priv= (get_column_grant(thd, &view->grant, view->db,
|
||||||
view->table_name, item->name) &
|
view->table_name, item->name) &
|
||||||
VIEW_ANY_ACL);
|
VIEW_ANY_ACL);
|
||||||
if ((fld= item->filed_for_view_update()))
|
|
||||||
|
if (fld && !fld->field->table->s->tmp_table)
|
||||||
{
|
{
|
||||||
/*
|
final_priv&= fld->have_privileges;
|
||||||
Do we have more privileges on view field then underlying table field?
|
|
||||||
*/
|
if (~fld->have_privileges & priv)
|
||||||
if (!fld->field->table->s->tmp_table && (~fld->have_privileges & priv))
|
report_item= item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!final_priv)
|
||||||
{
|
{
|
||||||
/* VIEW column has more privileges */
|
DBUG_ASSERT(report_item);
|
||||||
|
|
||||||
my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0),
|
my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0),
|
||||||
"create view", thd->security_ctx->priv_user,
|
"create view", thd->security_ctx->priv_user,
|
||||||
thd->security_ctx->priv_host, item->name,
|
thd->security_ctx->priv_host, report_item->name,
|
||||||
view->table_name);
|
view->table_name);
|
||||||
res= TRUE;
|
res= TRUE;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (wait_if_global_read_lock(thd, 0, 0))
|
if (wait_if_global_read_lock(thd, 0, 0))
|
||||||
@ -1008,6 +1019,11 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
|
|||||||
CHARSET_INFO *save_cs= thd->variables.character_set_client;
|
CHARSET_INFO *save_cs= thd->variables.character_set_client;
|
||||||
thd->variables.character_set_client= system_charset_info;
|
thd->variables.character_set_client= system_charset_info;
|
||||||
res= MYSQLparse((void *)thd);
|
res= MYSQLparse((void *)thd);
|
||||||
|
|
||||||
|
if ((old_lex->sql_command == SQLCOM_SHOW_FIELDS) ||
|
||||||
|
(old_lex->sql_command == SQLCOM_SHOW_CREATE))
|
||||||
|
lex->sql_command= old_lex->sql_command;
|
||||||
|
|
||||||
thd->variables.character_set_client= save_cs;
|
thd->variables.character_set_client= save_cs;
|
||||||
thd->variables.sql_mode= save_mode;
|
thd->variables.sql_mode= save_mode;
|
||||||
}
|
}
|
||||||
@ -1033,7 +1049,7 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!table->prelocking_placeholder &&
|
else if (!table->prelocking_placeholder &&
|
||||||
old_lex->sql_command == SQLCOM_SHOW_CREATE &&
|
(old_lex->sql_command == SQLCOM_SHOW_CREATE) &&
|
||||||
!table->belong_to_view)
|
!table->belong_to_view)
|
||||||
{
|
{
|
||||||
if (check_table_access(thd, SHOW_VIEW_ACL, table, 0))
|
if (check_table_access(thd, SHOW_VIEW_ACL, table, 0))
|
||||||
|
@ -136,12 +136,11 @@ typedef struct st_read_record { /* Parameter to read_record */
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Originally MySQL used TIME structure inside server only, but since
|
Originally MySQL used MYSQL_TIME structure inside server only, but since
|
||||||
4.1 it's exported to user in the new client API. Define aliases for
|
4.1 it's exported to user in the new client API. Define aliases for
|
||||||
new names to keep existing code simple.
|
new names to keep existing code simple.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct st_mysql_time TIME;
|
|
||||||
typedef enum enum_mysql_timestamp_type timestamp_type;
|
typedef enum enum_mysql_timestamp_type timestamp_type;
|
||||||
|
|
||||||
|
|
||||||
|
@ -3317,7 +3317,8 @@ bool st_table_list::prepare_view_securety_context(THD *thd)
|
|||||||
definer.host.str,
|
definer.host.str,
|
||||||
thd->db))
|
thd->db))
|
||||||
{
|
{
|
||||||
if (thd->lex->sql_command == SQLCOM_SHOW_CREATE)
|
if ((thd->lex->sql_command == SQLCOM_SHOW_CREATE) ||
|
||||||
|
(thd->lex->sql_command == SQLCOM_SHOW_FIELDS))
|
||||||
{
|
{
|
||||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
|
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
|
||||||
ER_NO_SUCH_USER,
|
ER_NO_SUCH_USER,
|
||||||
|
48
sql/time.cc
48
sql/time.cc
@ -96,7 +96,7 @@ int calc_weekday(long daynr,bool sunday_first_day_of_week)
|
|||||||
next week is week 1.
|
next week is week 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uint calc_week(TIME *l_time, uint week_behaviour, uint *year)
|
uint calc_week(MYSQL_TIME *l_time, uint week_behaviour, uint *year)
|
||||||
{
|
{
|
||||||
uint days;
|
uint days;
|
||||||
ulong daynr=calc_daynr(l_time->year,l_time->month,l_time->day);
|
ulong daynr=calc_daynr(l_time->year,l_time->month,l_time->day);
|
||||||
@ -214,7 +214,7 @@ ulong convert_month_to_period(ulong month)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Convert a timestamp string to a TIME value and produce a warning
|
Convert a timestamp string to a MYSQL_TIME value and produce a warning
|
||||||
if string was truncated during conversion.
|
if string was truncated during conversion.
|
||||||
|
|
||||||
NOTE
|
NOTE
|
||||||
@ -222,7 +222,7 @@ ulong convert_month_to_period(ulong month)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
timestamp_type
|
timestamp_type
|
||||||
str_to_datetime_with_warn(const char *str, uint length, TIME *l_time,
|
str_to_datetime_with_warn(const char *str, uint length, MYSQL_TIME *l_time,
|
||||||
uint flags)
|
uint flags)
|
||||||
{
|
{
|
||||||
int was_cut;
|
int was_cut;
|
||||||
@ -235,13 +235,14 @@ str_to_datetime_with_warn(const char *str, uint length, TIME *l_time,
|
|||||||
MODE_NO_ZERO_DATE))),
|
MODE_NO_ZERO_DATE))),
|
||||||
&was_cut);
|
&was_cut);
|
||||||
if (was_cut || ts_type <= MYSQL_TIMESTAMP_ERROR)
|
if (was_cut || ts_type <= MYSQL_TIMESTAMP_ERROR)
|
||||||
make_truncated_value_warning(current_thd, str, length, ts_type, NullS);
|
make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
|
str, length, ts_type, NullS);
|
||||||
return ts_type;
|
return ts_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Convert a datetime from broken-down TIME representation to corresponding
|
Convert a datetime from broken-down MYSQL_TIME representation to corresponding
|
||||||
TIMESTAMP value.
|
TIMESTAMP value.
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
@ -257,7 +258,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.
|
0 - t contains datetime value which is out of TIMESTAMP range.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
my_time_t TIME_to_timestamp(THD *thd, const TIME *t, my_bool *in_dst_time_gap)
|
my_time_t TIME_to_timestamp(THD *thd, const MYSQL_TIME *t, my_bool *in_dst_time_gap)
|
||||||
{
|
{
|
||||||
my_time_t timestamp;
|
my_time_t timestamp;
|
||||||
|
|
||||||
@ -276,20 +277,20 @@ my_time_t TIME_to_timestamp(THD *thd, const TIME *t, my_bool *in_dst_time_gap)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Convert a time string to a TIME struct and produce a warning
|
Convert a time string to a MYSQL_TIME struct and produce a warning
|
||||||
if string was cut during conversion.
|
if string was cut during conversion.
|
||||||
|
|
||||||
NOTE
|
NOTE
|
||||||
See str_to_time() for more info.
|
See str_to_time() for more info.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
str_to_time_with_warn(const char *str, uint length, TIME *l_time)
|
str_to_time_with_warn(const char *str, uint length, MYSQL_TIME *l_time)
|
||||||
{
|
{
|
||||||
int warning;
|
int warning;
|
||||||
bool ret_val= str_to_time(str, length, l_time, &warning);
|
bool ret_val= str_to_time(str, length, l_time, &warning);
|
||||||
if (ret_val || warning)
|
if (ret_val || warning)
|
||||||
make_truncated_value_warning(current_thd, str, length,
|
make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
MYSQL_TIMESTAMP_TIME, NullS);
|
str, length, MYSQL_TIMESTAMP_TIME, NullS);
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,7 +299,7 @@ str_to_time_with_warn(const char *str, uint length, TIME *l_time)
|
|||||||
Convert a system time structure to TIME
|
Convert a system time structure to TIME
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void localtime_to_TIME(TIME *to, struct tm *from)
|
void localtime_to_TIME(MYSQL_TIME *to, struct tm *from)
|
||||||
{
|
{
|
||||||
to->neg=0;
|
to->neg=0;
|
||||||
to->second_part=0;
|
to->second_part=0;
|
||||||
@ -310,7 +311,7 @@ void localtime_to_TIME(TIME *to, struct tm *from)
|
|||||||
to->second= (int) from->tm_sec;
|
to->second= (int) from->tm_sec;
|
||||||
}
|
}
|
||||||
|
|
||||||
void calc_time_from_sec(TIME *to, long seconds, long microseconds)
|
void calc_time_from_sec(MYSQL_TIME *to, long seconds, long microseconds)
|
||||||
{
|
{
|
||||||
long t_seconds;
|
long t_seconds;
|
||||||
to->hour= seconds/3600L;
|
to->hour= seconds/3600L;
|
||||||
@ -679,7 +680,7 @@ const char *get_date_time_format_str(KNOWN_DATE_TIME_FORMAT *format,
|
|||||||
MySQL doesn't support comparing of date/time/datetime strings that
|
MySQL doesn't support comparing of date/time/datetime strings that
|
||||||
are not in arbutary order as dates are compared as strings in some
|
are not in arbutary order as dates are compared as strings in some
|
||||||
context)
|
context)
|
||||||
This functions don't check that given TIME structure members are
|
This functions don't check that given MYSQL_TIME structure members are
|
||||||
in valid range. If they are not, return value won't reflect any
|
in valid range. If they are not, return value won't reflect any
|
||||||
valid date either. Additionally, make_time doesn't take into
|
valid date either. Additionally, make_time doesn't take into
|
||||||
account time->day member: it's assumed that days have been converted
|
account time->day member: it's assumed that days have been converted
|
||||||
@ -687,7 +688,7 @@ const char *get_date_time_format_str(KNOWN_DATE_TIME_FORMAT *format,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void make_time(const DATE_TIME_FORMAT *format __attribute__((unused)),
|
void make_time(const DATE_TIME_FORMAT *format __attribute__((unused)),
|
||||||
const TIME *l_time, String *str)
|
const MYSQL_TIME *l_time, String *str)
|
||||||
{
|
{
|
||||||
uint length= (uint) my_time_to_str(l_time, (char*) str->ptr());
|
uint length= (uint) my_time_to_str(l_time, (char*) str->ptr());
|
||||||
str->length(length);
|
str->length(length);
|
||||||
@ -696,7 +697,7 @@ void make_time(const DATE_TIME_FORMAT *format __attribute__((unused)),
|
|||||||
|
|
||||||
|
|
||||||
void make_date(const DATE_TIME_FORMAT *format __attribute__((unused)),
|
void make_date(const DATE_TIME_FORMAT *format __attribute__((unused)),
|
||||||
const TIME *l_time, String *str)
|
const MYSQL_TIME *l_time, String *str)
|
||||||
{
|
{
|
||||||
uint length= (uint) my_date_to_str(l_time, (char*) str->ptr());
|
uint length= (uint) my_date_to_str(l_time, (char*) str->ptr());
|
||||||
str->length(length);
|
str->length(length);
|
||||||
@ -705,7 +706,7 @@ void make_date(const DATE_TIME_FORMAT *format __attribute__((unused)),
|
|||||||
|
|
||||||
|
|
||||||
void make_datetime(const DATE_TIME_FORMAT *format __attribute__((unused)),
|
void make_datetime(const DATE_TIME_FORMAT *format __attribute__((unused)),
|
||||||
const TIME *l_time, String *str)
|
const MYSQL_TIME *l_time, String *str)
|
||||||
{
|
{
|
||||||
uint length= (uint) my_datetime_to_str(l_time, (char*) str->ptr());
|
uint length= (uint) my_datetime_to_str(l_time, (char*) str->ptr());
|
||||||
str->length(length);
|
str->length(length);
|
||||||
@ -713,7 +714,8 @@ void make_datetime(const DATE_TIME_FORMAT *format __attribute__((unused)),
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void make_truncated_value_warning(THD *thd, const char *str_val,
|
void make_truncated_value_warning(THD *thd, MYSQL_ERROR::enum_warning_level level,
|
||||||
|
const char *str_val,
|
||||||
uint str_length, timestamp_type time_type,
|
uint str_length, timestamp_type time_type,
|
||||||
const char *field_name)
|
const char *field_name)
|
||||||
{
|
{
|
||||||
@ -752,14 +754,14 @@ void make_truncated_value_warning(THD *thd, const char *str_val,
|
|||||||
cs->cset->snprintf(cs, warn_buff, sizeof(warn_buff),
|
cs->cset->snprintf(cs, warn_buff, sizeof(warn_buff),
|
||||||
ER(ER_WRONG_VALUE), type_str, str.c_ptr());
|
ER(ER_WRONG_VALUE), type_str, str.c_ptr());
|
||||||
}
|
}
|
||||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
push_warning(thd, level,
|
||||||
ER_TRUNCATED_WRONG_VALUE, warn_buff);
|
ER_TRUNCATED_WRONG_VALUE, warn_buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Daynumber from year 0 to 9999-12-31 */
|
/* Daynumber from year 0 to 9999-12-31 */
|
||||||
#define MAX_DAY_NUMBER 3652424L
|
#define MAX_DAY_NUMBER 3652424L
|
||||||
|
|
||||||
bool date_add_interval(TIME *ltime, interval_type int_type, INTERVAL interval)
|
bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type, INTERVAL interval)
|
||||||
{
|
{
|
||||||
long period, sign;
|
long period, sign;
|
||||||
|
|
||||||
@ -883,7 +885,7 @@ invalid_date:
|
|||||||
NOTE
|
NOTE
|
||||||
This function calculates difference between l_time1 and l_time2 absolute
|
This function calculates difference between l_time1 and l_time2 absolute
|
||||||
values. So one should set l_sign and correct result if he want to take
|
values. So one should set l_sign and correct result if he want to take
|
||||||
signs into account (i.e. for TIME values).
|
signs into account (i.e. for MYSQL_TIME values).
|
||||||
|
|
||||||
RETURN VALUES
|
RETURN VALUES
|
||||||
Returns sign of difference.
|
Returns sign of difference.
|
||||||
@ -893,7 +895,7 @@ invalid_date:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool
|
||||||
calc_time_diff(TIME *l_time1, TIME *l_time2, int l_sign, longlong *seconds_out,
|
calc_time_diff(MYSQL_TIME *l_time1, MYSQL_TIME *l_time2, int l_sign, longlong *seconds_out,
|
||||||
long *microseconds_out)
|
long *microseconds_out)
|
||||||
{
|
{
|
||||||
long days;
|
long days;
|
||||||
@ -943,7 +945,7 @@ calc_time_diff(TIME *l_time1, TIME *l_time2, int l_sign, longlong *seconds_out,
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Compares 2 TIME structures
|
Compares 2 MYSQL_TIME structures
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
my_time_compare()
|
my_time_compare()
|
||||||
@ -961,7 +963,7 @@ calc_time_diff(TIME *l_time1, TIME *l_time2, int l_sign, longlong *seconds_out,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
my_time_compare(TIME *a, TIME *b)
|
my_time_compare(MYSQL_TIME *a, MYSQL_TIME *b)
|
||||||
{
|
{
|
||||||
my_ulonglong a_t= TIME_to_ulonglong_datetime(a);
|
my_ulonglong a_t= TIME_to_ulonglong_datetime(a);
|
||||||
my_ulonglong b_t= TIME_to_ulonglong_datetime(b);
|
my_ulonglong b_t= TIME_to_ulonglong_datetime(b);
|
||||||
|
@ -77,7 +77,7 @@ typedef struct lsinfo
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Structure with information describing ranges of my_time_t shifted to local
|
Structure with information describing ranges of my_time_t shifted to local
|
||||||
time (my_time_t + offset). Used for local TIME -> my_time_t conversion.
|
time (my_time_t + offset). Used for local MYSQL_TIME -> my_time_t conversion.
|
||||||
See comments for TIME_to_gmt_sec() for more info.
|
See comments for TIME_to_gmt_sec() for more info.
|
||||||
*/
|
*/
|
||||||
typedef struct revtinfo
|
typedef struct revtinfo
|
||||||
@ -292,9 +292,9 @@ tz_load(const char *name, TIME_ZONE_INFO *sp, MEM_ROOT *storage)
|
|||||||
be used if there are no transitions or we have moment in time before
|
be used if there are no transitions or we have moment in time before
|
||||||
any transitions.
|
any transitions.
|
||||||
Second task is to build "shifted my_time_t" -> my_time_t map used in
|
Second task is to build "shifted my_time_t" -> my_time_t map used in
|
||||||
TIME -> my_time_t conversion.
|
MYSQL_TIME -> my_time_t conversion.
|
||||||
Note: See description of TIME_to_gmt_sec() function first.
|
Note: See description of TIME_to_gmt_sec() function first.
|
||||||
In order to perform TIME -> my_time_t conversion we need to build table
|
In order to perform MYSQL_TIME -> my_time_t conversion we need to build table
|
||||||
which defines "shifted by tz offset and leap seconds my_time_t" ->
|
which defines "shifted by tz offset and leap seconds my_time_t" ->
|
||||||
my_time_t function wich is almost the same (except ranges of ambiguity)
|
my_time_t function wich is almost the same (except ranges of ambiguity)
|
||||||
as reverse function to piecewise linear function used for my_time_t ->
|
as reverse function to piecewise linear function used for my_time_t ->
|
||||||
@ -531,14 +531,14 @@ static const uint year_lengths[2]=
|
|||||||
offset - local time zone offset
|
offset - local time zone offset
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
Convert my_time_t with offset to TIME struct. Differs from timesub
|
Convert my_time_t with offset to MYSQL_TIME struct. Differs from timesub
|
||||||
(from elsie code) because doesn't contain any leap correction and
|
(from elsie code) because doesn't contain any leap correction and
|
||||||
TM_GMTOFF and is_dst setting and contains some MySQL specific
|
TM_GMTOFF and is_dst setting and contains some MySQL specific
|
||||||
initialization. Funny but with removing of these we almost have
|
initialization. Funny but with removing of these we almost have
|
||||||
glibc's offtime function.
|
glibc's offtime function.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
sec_to_TIME(TIME * tmp, my_time_t t, long offset)
|
sec_to_TIME(MYSQL_TIME * tmp, my_time_t t, long offset)
|
||||||
{
|
{
|
||||||
long days;
|
long days;
|
||||||
long rem;
|
long rem;
|
||||||
@ -594,7 +594,7 @@ sec_to_TIME(TIME * tmp, my_time_t t, long offset)
|
|||||||
tmp->month++;
|
tmp->month++;
|
||||||
tmp->day= (uint)(days + 1);
|
tmp->day= (uint)(days + 1);
|
||||||
|
|
||||||
/* filling MySQL specific TIME members */
|
/* filling MySQL specific MYSQL_TIME members */
|
||||||
tmp->neg= 0; tmp->second_part= 0;
|
tmp->neg= 0; tmp->second_part= 0;
|
||||||
tmp->time_type= MYSQL_TIMESTAMP_DATETIME;
|
tmp->time_type= MYSQL_TIMESTAMP_DATETIME;
|
||||||
}
|
}
|
||||||
@ -686,7 +686,7 @@ find_transition_type(my_time_t t, const TIME_ZONE_INFO *sp)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Converts time in my_time_t representation (seconds in UTC since Epoch) to
|
Converts time in my_time_t representation (seconds in UTC since Epoch) to
|
||||||
broken down TIME representation in local time zone.
|
broken down MYSQL_TIME representation in local time zone.
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
gmt_sec_to_TIME()
|
gmt_sec_to_TIME()
|
||||||
@ -701,12 +701,12 @@ find_transition_type(my_time_t t, const TIME_ZONE_INFO *sp)
|
|||||||
(60th and 61st second, look how we calculate them as "hit" in this
|
(60th and 61st second, look how we calculate them as "hit" in this
|
||||||
function).
|
function).
|
||||||
Under realistic assumptions about frequency of transitions the same array
|
Under realistic assumptions about frequency of transitions the same array
|
||||||
can be used fot TIME -> my_time_t conversion. For this we need to
|
can be used fot MYSQL_TIME -> my_time_t conversion. For this we need to
|
||||||
implement tweaked binary search which will take into account that some
|
implement tweaked binary search which will take into account that some
|
||||||
TIME has two matching my_time_t ranges and some of them have none.
|
MYSQL_TIME has two matching my_time_t ranges and some of them have none.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
gmt_sec_to_TIME(TIME *tmp, my_time_t sec_in_utc, const TIME_ZONE_INFO *sp)
|
gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t sec_in_utc, const TIME_ZONE_INFO *sp)
|
||||||
{
|
{
|
||||||
const TRAN_TYPE_INFO *ttisp;
|
const TRAN_TYPE_INFO *ttisp;
|
||||||
const LS_INFO *lp;
|
const LS_INFO *lp;
|
||||||
@ -809,11 +809,11 @@ sec_since_epoch(int year, int mon, int mday, int hour, int min ,int sec)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Works like sec_since_epoch but expects TIME structure as parameter.
|
Works like sec_since_epoch but expects MYSQL_TIME structure as parameter.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
my_time_t
|
my_time_t
|
||||||
sec_since_epoch_TIME(TIME *t)
|
sec_since_epoch_TIME(MYSQL_TIME *t)
|
||||||
{
|
{
|
||||||
return sec_since_epoch(t->year, t->month, t->day,
|
return sec_since_epoch(t->year, t->month, t->day,
|
||||||
t->hour, t->minute, t->second);
|
t->hour, t->minute, t->second);
|
||||||
@ -821,7 +821,7 @@ sec_since_epoch_TIME(TIME *t)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Converts local time in broken down TIME representation to my_time_t
|
Converts local time in broken down MYSQL_TIME representation to my_time_t
|
||||||
representation.
|
representation.
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
@ -863,7 +863,7 @@ sec_since_epoch_TIME(TIME *t)
|
|||||||
|
|
||||||
We use completely different approach. It is better since it is both
|
We use completely different approach. It is better since it is both
|
||||||
faster than iterative implementations and fully determenistic. If you
|
faster than iterative implementations and fully determenistic. If you
|
||||||
look at my_time_t to TIME conversion then you'll find that it consist
|
look at my_time_t to MYSQL_TIME conversion then you'll find that it consist
|
||||||
of two steps:
|
of two steps:
|
||||||
The first is calculating shifted my_time_t value and the second - TIME
|
The first is calculating shifted my_time_t value and the second - TIME
|
||||||
calculation from shifted my_time_t value (well it is a bit simplified
|
calculation from shifted my_time_t value (well it is a bit simplified
|
||||||
@ -893,7 +893,7 @@ sec_since_epoch_TIME(TIME *t)
|
|||||||
0 in case of error.
|
0 in case of error.
|
||||||
*/
|
*/
|
||||||
static my_time_t
|
static my_time_t
|
||||||
TIME_to_gmt_sec(const TIME *t, const TIME_ZONE_INFO *sp,
|
TIME_to_gmt_sec(const MYSQL_TIME *t, const TIME_ZONE_INFO *sp,
|
||||||
my_bool *in_dst_time_gap)
|
my_bool *in_dst_time_gap)
|
||||||
{
|
{
|
||||||
my_time_t local_t;
|
my_time_t local_t;
|
||||||
@ -1020,20 +1020,20 @@ class Time_zone_system : public Time_zone
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Time_zone_system() {} /* Remove gcc warning */
|
Time_zone_system() {} /* Remove gcc warning */
|
||||||
virtual my_time_t TIME_to_gmt_sec(const TIME *t,
|
virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t,
|
||||||
my_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 void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const;
|
||||||
virtual const String * get_name() const;
|
virtual const String * get_name() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Converts local time in system time zone in TIME representation
|
Converts local time in system time zone in MYSQL_TIME representation
|
||||||
to its my_time_t representation.
|
to its my_time_t representation.
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
TIME_to_gmt_sec()
|
TIME_to_gmt_sec()
|
||||||
t - pointer to TIME structure with local time in
|
t - pointer to MYSQL_TIME structure with local time in
|
||||||
broken-down representation.
|
broken-down representation.
|
||||||
in_dst_time_gap - pointer to bool which is set to true if datetime
|
in_dst_time_gap - pointer to bool which is set to true if datetime
|
||||||
value passed doesn't really exist (i.e. falls into
|
value passed doesn't really exist (i.e. falls into
|
||||||
@ -1041,7 +1041,7 @@ public:
|
|||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
This method uses system function (localtime_r()) for conversion
|
This method uses system function (localtime_r()) for conversion
|
||||||
local time in system time zone in TIME structure to its my_time_t
|
local time in system time zone in MYSQL_TIME structure to its my_time_t
|
||||||
representation. Unlike the same function for Time_zone_db class
|
representation. Unlike the same function for Time_zone_db class
|
||||||
it it won't handle unnormalized input properly. Still it will
|
it it won't handle unnormalized input properly. Still it will
|
||||||
return lowest possible my_time_t in case of ambiguity or if we
|
return lowest possible my_time_t in case of ambiguity or if we
|
||||||
@ -1053,7 +1053,7 @@ public:
|
|||||||
Corresponding my_time_t value or 0 in case of error
|
Corresponding my_time_t value or 0 in case of error
|
||||||
*/
|
*/
|
||||||
my_time_t
|
my_time_t
|
||||||
Time_zone_system::TIME_to_gmt_sec(const TIME *t, my_bool *in_dst_time_gap) const
|
Time_zone_system::TIME_to_gmt_sec(const MYSQL_TIME *t, my_bool *in_dst_time_gap) const
|
||||||
{
|
{
|
||||||
long not_used;
|
long not_used;
|
||||||
return my_system_gmt_sec(t, ¬_used, in_dst_time_gap);
|
return my_system_gmt_sec(t, ¬_used, in_dst_time_gap);
|
||||||
@ -1066,7 +1066,7 @@ Time_zone_system::TIME_to_gmt_sec(const TIME *t, my_bool *in_dst_time_gap) const
|
|||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
gmt_sec_to_TIME()
|
gmt_sec_to_TIME()
|
||||||
tmp - pointer to TIME structure to fill-in
|
tmp - pointer to MYSQL_TIME structure to fill-in
|
||||||
t - my_time_t value to be converted
|
t - my_time_t value to be converted
|
||||||
|
|
||||||
NOTE
|
NOTE
|
||||||
@ -1077,7 +1077,7 @@ Time_zone_system::TIME_to_gmt_sec(const TIME *t, my_bool *in_dst_time_gap) const
|
|||||||
the 1902 easily.
|
the 1902 easily.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Time_zone_system::gmt_sec_to_TIME(TIME *tmp, my_time_t t) const
|
Time_zone_system::gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const
|
||||||
{
|
{
|
||||||
struct tm tmp_tm;
|
struct tm tmp_tm;
|
||||||
time_t tmp_t= (time_t)t;
|
time_t tmp_t= (time_t)t;
|
||||||
@ -1107,26 +1107,26 @@ Time_zone_system::get_name() const
|
|||||||
/*
|
/*
|
||||||
Instance of this class represents UTC time zone. It uses system gmtime_r
|
Instance of this class represents UTC time zone. It uses system gmtime_r
|
||||||
function for conversions and is always available. It is used only for
|
function for conversions and is always available. It is used only for
|
||||||
my_time_t -> TIME conversions in various UTC_... functions, it is not
|
my_time_t -> MYSQL_TIME conversions in various UTC_... functions, it is not
|
||||||
intended for TIME -> my_time_t conversions and shouldn't be exposed to user.
|
intended for MYSQL_TIME -> my_time_t conversions and shouldn't be exposed to user.
|
||||||
*/
|
*/
|
||||||
class Time_zone_utc : public Time_zone
|
class Time_zone_utc : public Time_zone
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Time_zone_utc() {} /* Remove gcc warning */
|
Time_zone_utc() {} /* Remove gcc warning */
|
||||||
virtual my_time_t TIME_to_gmt_sec(const TIME *t,
|
virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t,
|
||||||
my_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 void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const;
|
||||||
virtual const String * get_name() const;
|
virtual const String * get_name() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Convert UTC time from TIME representation to its my_time_t representation.
|
Convert UTC time from MYSQL_TIME representation to its my_time_t representation.
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
TIME_to_gmt_sec()
|
TIME_to_gmt_sec()
|
||||||
t - pointer to TIME structure with local time
|
t - pointer to MYSQL_TIME structure with local time
|
||||||
in broken-down representation.
|
in broken-down representation.
|
||||||
in_dst_time_gap - pointer to bool which is set to true if datetime
|
in_dst_time_gap - pointer to bool which is set to true if datetime
|
||||||
value passed doesn't really exist (i.e. falls into
|
value passed doesn't really exist (i.e. falls into
|
||||||
@ -1141,7 +1141,7 @@ public:
|
|||||||
0
|
0
|
||||||
*/
|
*/
|
||||||
my_time_t
|
my_time_t
|
||||||
Time_zone_utc::TIME_to_gmt_sec(const TIME *t, my_bool *in_dst_time_gap) const
|
Time_zone_utc::TIME_to_gmt_sec(const MYSQL_TIME *t, my_bool *in_dst_time_gap) const
|
||||||
{
|
{
|
||||||
/* Should be never called */
|
/* Should be never called */
|
||||||
DBUG_ASSERT(0);
|
DBUG_ASSERT(0);
|
||||||
@ -1155,14 +1155,14 @@ Time_zone_utc::TIME_to_gmt_sec(const TIME *t, my_bool *in_dst_time_gap) const
|
|||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
gmt_sec_to_TIME()
|
gmt_sec_to_TIME()
|
||||||
tmp - pointer to TIME structure to fill-in
|
tmp - pointer to MYSQL_TIME structure to fill-in
|
||||||
t - my_time_t value to be converted
|
t - my_time_t value to be converted
|
||||||
|
|
||||||
NOTE
|
NOTE
|
||||||
See note for apropriate Time_zone_system method.
|
See note for apropriate Time_zone_system method.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Time_zone_utc::gmt_sec_to_TIME(TIME *tmp, my_time_t t) const
|
Time_zone_utc::gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const
|
||||||
{
|
{
|
||||||
struct tm tmp_tm;
|
struct tm tmp_tm;
|
||||||
time_t tmp_t= (time_t)t;
|
time_t tmp_t= (time_t)t;
|
||||||
@ -1203,9 +1203,9 @@ class Time_zone_db : public Time_zone
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Time_zone_db(TIME_ZONE_INFO *tz_info_arg, const String * tz_name_arg);
|
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,
|
virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t,
|
||||||
my_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 void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const;
|
||||||
virtual const String * get_name() const;
|
virtual const String * get_name() const;
|
||||||
private:
|
private:
|
||||||
TIME_ZONE_INFO *tz_info;
|
TIME_ZONE_INFO *tz_info;
|
||||||
@ -1239,7 +1239,7 @@ Time_zone_db::Time_zone_db(TIME_ZONE_INFO *tz_info_arg,
|
|||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
TIME_to_gmt_sec()
|
TIME_to_gmt_sec()
|
||||||
t - pointer to TIME structure with local time
|
t - pointer to MYSQL_TIME structure with local time
|
||||||
in broken-down representation.
|
in broken-down representation.
|
||||||
in_dst_time_gap - pointer to bool which is set to true if datetime
|
in_dst_time_gap - pointer to bool which is set to true if datetime
|
||||||
value passed doesn't really exist (i.e. falls into
|
value passed doesn't really exist (i.e. falls into
|
||||||
@ -1253,7 +1253,7 @@ Time_zone_db::Time_zone_db(TIME_ZONE_INFO *tz_info_arg,
|
|||||||
Corresponding my_time_t value or 0 in case of error
|
Corresponding my_time_t value or 0 in case of error
|
||||||
*/
|
*/
|
||||||
my_time_t
|
my_time_t
|
||||||
Time_zone_db::TIME_to_gmt_sec(const TIME *t, my_bool *in_dst_time_gap) const
|
Time_zone_db::TIME_to_gmt_sec(const MYSQL_TIME *t, my_bool *in_dst_time_gap) const
|
||||||
{
|
{
|
||||||
return ::TIME_to_gmt_sec(t, tz_info, in_dst_time_gap);
|
return ::TIME_to_gmt_sec(t, tz_info, in_dst_time_gap);
|
||||||
}
|
}
|
||||||
@ -1265,11 +1265,11 @@ Time_zone_db::TIME_to_gmt_sec(const TIME *t, my_bool *in_dst_time_gap) const
|
|||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
gmt_sec_to_TIME()
|
gmt_sec_to_TIME()
|
||||||
tmp - pointer to TIME structure to fill-in
|
tmp - pointer to MYSQL_TIME structure to fill-in
|
||||||
t - my_time_t value to be converted
|
t - my_time_t value to be converted
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Time_zone_db::gmt_sec_to_TIME(TIME *tmp, my_time_t t) const
|
Time_zone_db::gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const
|
||||||
{
|
{
|
||||||
::gmt_sec_to_TIME(tmp, t, tz_info);
|
::gmt_sec_to_TIME(tmp, t, tz_info);
|
||||||
}
|
}
|
||||||
@ -1299,9 +1299,9 @@ class Time_zone_offset : public Time_zone
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Time_zone_offset(long tz_offset_arg);
|
Time_zone_offset(long tz_offset_arg);
|
||||||
virtual my_time_t TIME_to_gmt_sec(const TIME *t,
|
virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t,
|
||||||
my_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 void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const;
|
||||||
virtual const String * get_name() const;
|
virtual const String * get_name() const;
|
||||||
/*
|
/*
|
||||||
This have to be public because we want to be able to access it from
|
This have to be public because we want to be able to access it from
|
||||||
@ -1336,11 +1336,11 @@ Time_zone_offset::Time_zone_offset(long tz_offset_arg):
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Converts local time in time zone described as offset from UTC
|
Converts local time in time zone described as offset from UTC
|
||||||
from TIME representation to its my_time_t representation.
|
from MYSQL_TIME representation to its my_time_t representation.
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
TIME_to_gmt_sec()
|
TIME_to_gmt_sec()
|
||||||
t - pointer to TIME structure with local time
|
t - pointer to MYSQL_TIME structure with local time
|
||||||
in broken-down representation.
|
in broken-down representation.
|
||||||
in_dst_time_gap - pointer to bool which should be set to true if
|
in_dst_time_gap - pointer to bool which should be set to true if
|
||||||
datetime value passed doesn't really exist
|
datetime value passed doesn't really exist
|
||||||
@ -1352,7 +1352,7 @@ Time_zone_offset::Time_zone_offset(long tz_offset_arg):
|
|||||||
Corresponding my_time_t value or 0 in case of error
|
Corresponding my_time_t value or 0 in case of error
|
||||||
*/
|
*/
|
||||||
my_time_t
|
my_time_t
|
||||||
Time_zone_offset::TIME_to_gmt_sec(const TIME *t, my_bool *in_dst_time_gap) const
|
Time_zone_offset::TIME_to_gmt_sec(const MYSQL_TIME *t, my_bool *in_dst_time_gap) const
|
||||||
{
|
{
|
||||||
my_time_t local_t;
|
my_time_t local_t;
|
||||||
int shift= 0;
|
int shift= 0;
|
||||||
@ -1397,11 +1397,11 @@ Time_zone_offset::TIME_to_gmt_sec(const TIME *t, my_bool *in_dst_time_gap) const
|
|||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
gmt_sec_to_TIME()
|
gmt_sec_to_TIME()
|
||||||
tmp - pointer to TIME structure to fill-in
|
tmp - pointer to MYSQL_TIME structure to fill-in
|
||||||
t - my_time_t value to be converted
|
t - my_time_t value to be converted
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Time_zone_offset::gmt_sec_to_TIME(TIME *tmp, my_time_t t) const
|
Time_zone_offset::gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const
|
||||||
{
|
{
|
||||||
sec_to_TIME(tmp, t, offset);
|
sec_to_TIME(tmp, t, offset);
|
||||||
}
|
}
|
||||||
@ -2564,7 +2564,7 @@ main(int argc, char **argv)
|
|||||||
my_bool localtime_negative;
|
my_bool localtime_negative;
|
||||||
TIME_ZONE_INFO tz_info;
|
TIME_ZONE_INFO tz_info;
|
||||||
struct tm tmp;
|
struct tm tmp;
|
||||||
TIME time_tmp;
|
MYSQL_TIME time_tmp;
|
||||||
time_t t, t1, t2;
|
time_t t, t1, t2;
|
||||||
char fullname[FN_REFLEN+1];
|
char fullname[FN_REFLEN+1];
|
||||||
char *str_end;
|
char *str_end;
|
||||||
|
12
sql/tztime.h
12
sql/tztime.h
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
This class represents abstract time zone and provides
|
This class represents abstract time zone and provides
|
||||||
basic interface for TIME <-> my_time_t conversion.
|
basic interface for MYSQL_TIME <-> my_time_t conversion.
|
||||||
Actual time zones which are specified by DB, or via offset
|
Actual time zones which are specified by DB, or via offset
|
||||||
or use system functions are its descendants.
|
or use system functions are its descendants.
|
||||||
*/
|
*/
|
||||||
@ -31,18 +31,18 @@ class Time_zone: public Sql_alloc
|
|||||||
public:
|
public:
|
||||||
Time_zone() {} /* Remove gcc warning */
|
Time_zone() {} /* Remove gcc warning */
|
||||||
/*
|
/*
|
||||||
Converts local time in broken down TIME representation to
|
Converts local time in broken down MYSQL_TIME representation to
|
||||||
my_time_t (UTC seconds since Epoch) represenation.
|
my_time_t (UTC seconds since Epoch) represenation.
|
||||||
Returns 0 in case of error. Sets in_dst_time_gap to true if date provided
|
Returns 0 in case of error. Sets in_dst_time_gap to true if date provided
|
||||||
falls into spring time-gap (or lefts it untouched otherwise).
|
falls into spring time-gap (or lefts it untouched otherwise).
|
||||||
*/
|
*/
|
||||||
virtual my_time_t TIME_to_gmt_sec(const TIME *t,
|
virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t,
|
||||||
my_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
|
Converts time in my_time_t representation to local time in
|
||||||
broken down TIME representation.
|
broken down MYSQL_TIME representation.
|
||||||
*/
|
*/
|
||||||
virtual void gmt_sec_to_TIME(TIME *tmp, my_time_t t) const = 0;
|
virtual void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const = 0;
|
||||||
/*
|
/*
|
||||||
Because of constness of String returned by get_name() time zone name
|
Because of constness of String returned by get_name() time zone name
|
||||||
have to be already zeroended to be able to use String::ptr() instead
|
have to be already zeroended to be able to use String::ptr() instead
|
||||||
@ -62,7 +62,7 @@ extern Time_zone * my_tz_SYSTEM;
|
|||||||
extern Time_zone * my_tz_find(THD *thd, const String *name);
|
extern Time_zone * my_tz_find(THD *thd, const String *name);
|
||||||
extern my_bool my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap);
|
extern my_bool my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap);
|
||||||
extern void my_tz_free();
|
extern void my_tz_free();
|
||||||
extern my_time_t sec_since_epoch_TIME(TIME *t);
|
extern my_time_t sec_since_epoch_TIME(MYSQL_TIME *t);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Number of elements in table list produced by my_tz_get_table_list()
|
Number of elements in table list produced by my_tz_get_table_list()
|
||||||
|
@ -936,7 +936,9 @@ static bool make_empty_rec(THD *thd, File file,enum legacy_db_type table_type,
|
|||||||
(regfield->real_type() != MYSQL_TYPE_YEAR ||
|
(regfield->real_type() != MYSQL_TYPE_YEAR ||
|
||||||
field->def->val_int() != 0))
|
field->def->val_int() != 0))
|
||||||
{
|
{
|
||||||
if (field->def->save_in_field(regfield, 1))
|
int res= field->def->save_in_field(regfield, 1);
|
||||||
|
/* If not ok or warning of level 'note' */
|
||||||
|
if (res != 0 && res != 3)
|
||||||
{
|
{
|
||||||
my_error(ER_INVALID_DEFAULT, MYF(0), regfield->field_name);
|
my_error(ER_INVALID_DEFAULT, MYF(0), regfield->field_name);
|
||||||
error= 1;
|
error= 1;
|
||||||
|
@ -58,7 +58,7 @@ The options right now are
|
|||||||
MYSQL_SERVER_SUFFIX=<suffix> Server suffix, default none
|
MYSQL_SERVER_SUFFIX=<suffix> Server suffix, default none
|
||||||
COMPILATION_COMMENT=<comment> Server comment, default "Source distribution"
|
COMPILATION_COMMENT=<comment> Server comment, default "Source distribution"
|
||||||
MYSQL_TCP_PORT=<port> Server port, default 3306
|
MYSQL_TCP_PORT=<port> Server port, default 3306
|
||||||
CYBOZU
|
CYBOZU Default character set is UTF8
|
||||||
|
|
||||||
So the command line could look like:
|
So the command line could look like:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user