Commit 11c7dbd3 authored by unknown's avatar unknown

fix compiler warnings: precision loses, unused vars

the warnings came from MSFT compiler (output of pushbuild)


sql/event.cc:
  fix compiler warnings: precision loses, unused vars
sql/event_executor.cc:
  fix compiler warnings: precision loses, unused vars
sql/event_timed.cc:
  fix compiler warnings: precision loses, unused vars
parent 6f91d118
...@@ -377,7 +377,7 @@ event_reconstruct_interval_expression(String *buf, ...@@ -377,7 +377,7 @@ event_reconstruct_interval_expression(String *buf,
break; break;
case INTERVAL_DAY_MINUTE: case INTERVAL_DAY_MINUTE:
{ {
int tmp_expr= expr; ulonglong tmp_expr= expr;
tmp_expr/=(24*60); tmp_expr/=(24*60);
buf->append('\''); buf->append('\'');
...@@ -395,7 +395,7 @@ event_reconstruct_interval_expression(String *buf, ...@@ -395,7 +395,7 @@ event_reconstruct_interval_expression(String *buf,
break; break;
case INTERVAL_HOUR_SECOND: case INTERVAL_HOUR_SECOND:
{ {
int tmp_expr= expr; ulonglong tmp_expr= expr;
buf->append('\''); buf->append('\'');
end= longlong10_to_str(tmp_expr/3600, tmp_buff, 10); end= longlong10_to_str(tmp_expr/3600, tmp_buff, 10);
...@@ -412,7 +412,7 @@ event_reconstruct_interval_expression(String *buf, ...@@ -412,7 +412,7 @@ event_reconstruct_interval_expression(String *buf,
break; break;
case INTERVAL_DAY_SECOND: case INTERVAL_DAY_SECOND:
{ {
int tmp_expr= expr; ulonglong tmp_expr= expr;
tmp_expr/=(24*3600); tmp_expr/=(24*3600);
buf->append('\''); buf->append('\'');
...@@ -481,7 +481,6 @@ int ...@@ -481,7 +481,6 @@ int
evex_open_event_table(THD *thd, enum thr_lock_type lock_type, TABLE **table) evex_open_event_table(THD *thd, enum thr_lock_type lock_type, TABLE **table)
{ {
TABLE_LIST tables; TABLE_LIST tables;
bool not_used;
DBUG_ENTER("open_proc_table"); DBUG_ENTER("open_proc_table");
bzero((char*) &tables, sizeof(tables)); bzero((char*) &tables, sizeof(tables));
...@@ -619,9 +618,10 @@ evex_fill_row(THD *thd, TABLE *table, Event_timed *et, my_bool is_update) ...@@ -619,9 +618,10 @@ evex_fill_row(THD *thd, TABLE *table, Event_timed *et, my_bool is_update)
goto trunc_err; goto trunc_err;
/* both ON_COMPLETION and STATUS are NOT NULL thus not calling set_notnull() */ /* both ON_COMPLETION and STATUS are NOT NULL thus not calling set_notnull() */
table->field[EVEX_FIELD_ON_COMPLETION]->store((longlong)et->on_completion); table->field[EVEX_FIELD_ON_COMPLETION]->store((longlong)et->on_completion,
true);
table->field[EVEX_FIELD_STATUS]->store((longlong)et->status); table->field[EVEX_FIELD_STATUS]->store((longlong)et->status, true);
/* /*
Change the SQL_MODE only if body was present in an ALTER EVENT and of course Change the SQL_MODE only if body was present in an ALTER EVENT and of course
...@@ -629,7 +629,8 @@ evex_fill_row(THD *thd, TABLE *table, Event_timed *et, my_bool is_update) ...@@ -629,7 +629,8 @@ evex_fill_row(THD *thd, TABLE *table, Event_timed *et, my_bool is_update)
*/ */
if (et->body.str) if (et->body.str)
{ {
table->field[EVEX_FIELD_SQL_MODE]->store((longlong)thd->variables.sql_mode); table->field[EVEX_FIELD_SQL_MODE]->store((longlong)thd->variables.sql_mode,
true);
if (table->field[field_num= EVEX_FIELD_BODY]-> if (table->field[field_num= EVEX_FIELD_BODY]->
store(et->body.str, et->body.length, system_charset_info)) store(et->body.str, et->body.length, system_charset_info))
...@@ -639,14 +640,15 @@ evex_fill_row(THD *thd, TABLE *table, Event_timed *et, my_bool is_update) ...@@ -639,14 +640,15 @@ evex_fill_row(THD *thd, TABLE *table, Event_timed *et, my_bool is_update)
if (et->expression) if (et->expression)
{ {
table->field[EVEX_FIELD_INTERVAL_EXPR]->set_notnull(); table->field[EVEX_FIELD_INTERVAL_EXPR]->set_notnull();
table->field[EVEX_FIELD_INTERVAL_EXPR]->store((longlong)et->expression); table->field[EVEX_FIELD_INTERVAL_EXPR]->store((longlong)et->expression,true);
table->field[EVEX_FIELD_TRANSIENT_INTERVAL]->set_notnull(); table->field[EVEX_FIELD_TRANSIENT_INTERVAL]->set_notnull();
/* /*
In the enum (C) intervals start from 0 but in mysql enum valid values start In the enum (C) intervals start from 0 but in mysql enum valid values start
from 1. Thus +1 offset is needed! from 1. Thus +1 offset is needed!
*/ */
table->field[EVEX_FIELD_TRANSIENT_INTERVAL]->store((longlong)et->interval+1); table->field[EVEX_FIELD_TRANSIENT_INTERVAL]->store((longlong)et->interval+1,
true);
table->field[EVEX_FIELD_EXECUTE_AT]->set_null(); table->field[EVEX_FIELD_EXECUTE_AT]->set_null();
...@@ -725,7 +727,6 @@ db_create_event(THD *thd, Event_timed *et, my_bool create_if_not, ...@@ -725,7 +727,6 @@ db_create_event(THD *thd, Event_timed *et, my_bool create_if_not,
{ {
int ret= 0; int ret= 0;
TABLE *table; TABLE *table;
char definer[HOSTNAME_LENGTH+USERNAME_LENGTH+2];
char olddb[128]; char olddb[128];
bool dbchanged= false; bool dbchanged= false;
DBUG_ENTER("db_create_event"); DBUG_ENTER("db_create_event");
...@@ -959,7 +960,6 @@ db_find_event(THD *thd, sp_name *name, LEX_STRING *definer, Event_timed **ett, ...@@ -959,7 +960,6 @@ db_find_event(THD *thd, sp_name *name, LEX_STRING *definer, Event_timed **ett,
{ {
TABLE *table; TABLE *table;
int ret; int ret;
char *ptr;
Event_timed *et=NULL; Event_timed *et=NULL;
DBUG_ENTER("db_find_event"); DBUG_ENTER("db_find_event");
DBUG_PRINT("enter", ("name: %*s", name->m_name.length, name->m_name.str)); DBUG_PRINT("enter", ("name: %*s", name->m_name.length, name->m_name.str));
...@@ -1216,7 +1216,7 @@ int ...@@ -1216,7 +1216,7 @@ int
evex_update_event(THD *thd, Event_timed *et, sp_name *new_name, evex_update_event(THD *thd, Event_timed *et, sp_name *new_name,
uint *rows_affected) uint *rows_affected)
{ {
int ret, i; int ret;
bool need_second_pass= true; bool need_second_pass= true;
DBUG_ENTER("evex_update_event"); DBUG_ENTER("evex_update_event");
...@@ -1333,7 +1333,6 @@ int ...@@ -1333,7 +1333,6 @@ int
evex_drop_event(THD *thd, Event_timed *et, bool drop_if_exists, evex_drop_event(THD *thd, Event_timed *et, bool drop_if_exists,
uint *rows_affected) uint *rows_affected)
{ {
TABLE *table;
int ret= 0; int ret= 0;
DBUG_ENTER("evex_drop_event"); DBUG_ENTER("evex_drop_event");
...@@ -1459,7 +1458,6 @@ evex_drop_db_events(THD *thd, char *db) ...@@ -1459,7 +1458,6 @@ evex_drop_db_events(THD *thd, char *db)
{ {
TABLE *table; TABLE *table;
READ_RECORD read_record_info; READ_RECORD read_record_info;
MYSQL_LOCK *lock;
int ret= 0; int ret= 0;
uint i; uint i;
LEX_STRING db_lex= {db, strlen(db)}; LEX_STRING db_lex= {db, strlen(db)};
......
...@@ -132,7 +132,6 @@ evex_check_system_tables() ...@@ -132,7 +132,6 @@ evex_check_system_tables()
{ {
THD *thd= current_thd; THD *thd= current_thd;
TABLE_LIST tables; TABLE_LIST tables;
bool not_used;
Open_tables_state backup; Open_tables_state backup;
/* thd is 0x0 during boot of the server. Later it's !=0x0 */ /* thd is 0x0 during boot of the server. Later it's !=0x0 */
...@@ -401,7 +400,6 @@ event_executor_main(void *arg) ...@@ -401,7 +400,6 @@ event_executor_main(void *arg)
THD *thd; /* needs to be first for thread_stack */ THD *thd; /* needs to be first for thread_stack */
uint i=0, j=0; uint i=0, j=0;
my_ulonglong cnt= 0; my_ulonglong cnt= 0;
TIME time_now;
DBUG_ENTER("event_executor_main"); DBUG_ENTER("event_executor_main");
DBUG_PRINT("event_executor_main", ("EVEX thread started")); DBUG_PRINT("event_executor_main", ("EVEX thread started"));
...@@ -791,7 +789,6 @@ evex_load_events_from_db(THD *thd) ...@@ -791,7 +789,6 @@ evex_load_events_from_db(THD *thd)
{ {
TABLE *table; TABLE *table;
READ_RECORD read_record_info; READ_RECORD read_record_info;
MYSQL_LOCK *lock;
int ret= -1; int ret= -1;
uint count= 0; uint count= 0;
......
...@@ -65,7 +65,6 @@ void ...@@ -65,7 +65,6 @@ void
Event_timed::init_name(THD *thd, sp_name *spn) Event_timed::init_name(THD *thd, sp_name *spn)
{ {
DBUG_ENTER("Event_timed::init_name"); DBUG_ENTER("Event_timed::init_name");
uint n; /* Counter for nul trimming */
/* During parsing, we must use thd->mem_root */ /* During parsing, we must use thd->mem_root */
MEM_ROOT *root= thd->mem_root; MEM_ROOT *root= thd->mem_root;
...@@ -151,7 +150,6 @@ Event_timed::init_execute_at(THD *thd, Item *expr) ...@@ -151,7 +150,6 @@ Event_timed::init_execute_at(THD *thd, Item *expr)
{ {
my_bool not_used; my_bool not_used;
TIME ltime; TIME ltime;
my_time_t my_time_tmp;
TIME time_tmp; TIME time_tmp;
DBUG_ENTER("Event_timed::init_execute_at"); DBUG_ENTER("Event_timed::init_execute_at");
...@@ -206,7 +204,6 @@ Event_timed::init_execute_at(THD *thd, Item *expr) ...@@ -206,7 +204,6 @@ Event_timed::init_execute_at(THD *thd, Item *expr)
int int
Event_timed::init_interval(THD *thd, Item *expr, interval_type new_interval) Event_timed::init_interval(THD *thd, Item *expr, interval_type new_interval)
{ {
longlong tmp;
String value; String value;
INTERVAL interval; INTERVAL interval;
...@@ -484,8 +481,6 @@ Event_timed::init_definer(THD *thd) ...@@ -484,8 +481,6 @@ Event_timed::init_definer(THD *thd)
int int
Event_timed::load_from_row(MEM_ROOT *mem_root, TABLE *table) Event_timed::load_from_row(MEM_ROOT *mem_root, TABLE *table)
{ {
longlong created;
longlong modified;
char *ptr; char *ptr;
Event_timed *et; Event_timed *et;
uint len; uint len;
...@@ -569,8 +564,8 @@ Event_timed::load_from_row(MEM_ROOT *mem_root, TABLE *table) ...@@ -569,8 +564,8 @@ Event_timed::load_from_row(MEM_ROOT *mem_root, TABLE *table)
else else
et->interval= (interval_type) 0; et->interval= (interval_type) 0;
et->modified= table->field[EVEX_FIELD_CREATED]->val_int(); et->created= table->field[EVEX_FIELD_CREATED]->val_int();
et->created= table->field[EVEX_FIELD_MODIFIED]->val_int(); et->modified= table->field[EVEX_FIELD_MODIFIED]->val_int();
/* /*
ToDo Andrey : Ask PeterG & Serg what to do in this case. ToDo Andrey : Ask PeterG & Serg what to do in this case.
...@@ -957,7 +952,6 @@ Event_timed::mark_last_executed(THD *thd) ...@@ -957,7 +952,6 @@ Event_timed::mark_last_executed(THD *thd)
int int
Event_timed::drop(THD *thd) Event_timed::drop(THD *thd)
{ {
TABLE *table;
uint tmp= 0; uint tmp= 0;
DBUG_ENTER("Event_timed::drop"); DBUG_ENTER("Event_timed::drop");
...@@ -987,7 +981,6 @@ Event_timed::update_fields(THD *thd) ...@@ -987,7 +981,6 @@ Event_timed::update_fields(THD *thd)
TABLE *table; TABLE *table;
Open_tables_state backup; Open_tables_state backup;
int ret= 0; int ret= 0;
bool opened;
DBUG_ENTER("Event_timed::update_time_fields"); DBUG_ENTER("Event_timed::update_time_fields");
...@@ -1023,7 +1016,7 @@ Event_timed::update_fields(THD *thd) ...@@ -1023,7 +1016,7 @@ Event_timed::update_fields(THD *thd)
if (status_changed) if (status_changed)
{ {
table->field[EVEX_FIELD_STATUS]->set_notnull(); table->field[EVEX_FIELD_STATUS]->set_notnull();
table->field[EVEX_FIELD_STATUS]->store((longlong)status); table->field[EVEX_FIELD_STATUS]->store((longlong)status, true);
status_changed= false; status_changed= false;
} }
...@@ -1281,11 +1274,8 @@ Event_timed::compile(THD *thd, MEM_ROOT *mem_root) ...@@ -1281,11 +1274,8 @@ Event_timed::compile(THD *thd, MEM_ROOT *mem_root)
LEX *old_lex= thd->lex, lex; LEX *old_lex= thd->lex, lex;
char *old_db; char *old_db;
int old_db_length; int old_db_length;
Event_timed *ett;
sp_name *spn;
char *old_query; char *old_query;
uint old_query_len; uint old_query_len;
st_sp_chistics *p;
ulong old_sql_mode= thd->variables.sql_mode; ulong old_sql_mode= thd->variables.sql_mode;
char create_buf[2048]; char create_buf[2048];
String show_create(create_buf, sizeof(create_buf), system_charset_info); String show_create(create_buf, sizeof(create_buf), system_charset_info);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment