Commit 084f7442 authored by unknown's avatar unknown

Remove trailing whitespace.

After merge fixes.


sql/event_data_objects.cc:
  after merge fix. use thd->strmake instead of strmake_root
  Remove commented out code.
  Remove trailing whitespace.
sql/event_db_repository.cc:
  After merge fix.
  Before closing thread tables check whether table is actuall non-NULL.
  And always initialize it to NULL.
sql/event_queue.cc:
  Remove trailing whitespace.
sql/event_scheduler_ng.cc:
  Remove trailing whitespace.
  Tabs to spaces.
sql/events.cc:
  Remove trailing whitespace.
parent 5d91dc25
...@@ -87,21 +87,16 @@ void ...@@ -87,21 +87,16 @@ void
Event_parse_data::init_name(THD *thd, sp_name *spn) Event_parse_data::init_name(THD *thd, sp_name *spn)
{ {
DBUG_ENTER("Event_parse_data::init_name"); DBUG_ENTER("Event_parse_data::init_name");
/* During parsing, we must use thd->mem_root */
MEM_ROOT *root= thd->mem_root;
/* We have to copy strings to get them into the right memroot */ /* We have to copy strings to get them into the right memroot */
dbname.length= spn->m_db.length; dbname.length= spn->m_db.length;
dbname.str= strmake_root(root, spn->m_db.str, spn->m_db.length); dbname.str= thd->strmake(spn->m_db.str, spn->m_db.length);
name.length= spn->m_name.length; name.length= spn->m_name.length;
name.str= strmake_root(root, spn->m_name.str, spn->m_name.length); name.str= thd->strmake(spn->m_name.str, spn->m_name.length);
if (spn->m_qname.length == 0) if (spn->m_qname.length == 0)
spn->init_qname(thd); spn->init_qname(thd);
DBUG_PRINT("dbname", ("len=%d db=%s",dbname.length, dbname.str));
DBUG_PRINT("name", ("len=%d name=%s",name.length, name.str));
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -116,7 +111,7 @@ Event_parse_data::init_name(THD *thd, sp_name *spn) ...@@ -116,7 +111,7 @@ Event_parse_data::init_name(THD *thd, sp_name *spn)
NOTE NOTE
The body is extracted by copying all data between the The body is extracted by copying all data between the
start of the body set by another method and the current pointer in Lex. start of the body set by another method and the current pointer in Lex.
Some questionable removal of characters is done in here, and that part Some questionable removal of characters is done in here, and that part
should be refactored when the parser is smarter. should be refactored when the parser is smarter.
*/ */
...@@ -187,7 +182,7 @@ Event_parse_data::init_body(THD *thd) ...@@ -187,7 +182,7 @@ Event_parse_data::init_body(THD *thd)
SYNOPSIS SYNOPSIS
Event_parse_data::init_definer() Event_parse_data::init_definer()
RETURN VALUE RETURN VALUE
0 OK 0 OK
*/ */
...@@ -615,7 +610,7 @@ Event_basic::Event_basic() ...@@ -615,7 +610,7 @@ Event_basic::Event_basic()
dbname.length= name.length= 0; dbname.length= name.length= 0;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
/* /*
Destructor Destructor
...@@ -652,7 +647,7 @@ Event_basic::load_string_fields(Field **fields, ...) ...@@ -652,7 +647,7 @@ Event_basic::load_string_fields(Field **fields, ...)
LEX_STRING *field_value; LEX_STRING *field_value;
DBUG_ENTER("Event_basic::load_string_fields"); DBUG_ENTER("Event_basic::load_string_fields");
va_start(args, fields); va_start(args, fields);
field_name= (enum enum_events_table_field) va_arg(args, int); field_name= (enum enum_events_table_field) va_arg(args, int);
while (field_name != ET_FIELD_COUNT) while (field_name != ET_FIELD_COUNT)
...@@ -668,7 +663,7 @@ Event_basic::load_string_fields(Field **fields, ...) ...@@ -668,7 +663,7 @@ Event_basic::load_string_fields(Field **fields, ...)
field_name= (enum enum_events_table_field) va_arg(args, int); field_name= (enum enum_events_table_field) va_arg(args, int);
} }
va_end(args); va_end(args);
DBUG_RETURN(ret); DBUG_RETURN(ret);
} }
...@@ -757,7 +752,7 @@ Event_job_data::Event_job_data(): ...@@ -757,7 +752,7 @@ Event_job_data::Event_job_data():
*/ */
Event_job_data::~Event_job_data() Event_job_data::~Event_job_data()
{ {
free_sp(); free_sp();
} }
...@@ -819,25 +814,6 @@ Event_job_data::load_from_row(TABLE *table) ...@@ -819,25 +814,6 @@ Event_job_data::load_from_row(TABLE *table)
ET_FIELD_BODY, &body, ET_FIELD_DEFINER, &definer, ET_FIELD_BODY, &body, ET_FIELD_DEFINER, &definer,
ET_FIELD_COUNT); ET_FIELD_COUNT);
/*
if ((dbname.str= get_field(&mem_root, table->field[ET_FIELD_DB])) == NullS)
goto error;
dbname.length= strlen(dbname.str);
if ((name.str= get_field(&mem_root, table->field[ET_FIELD_NAME])) == NullS)
goto error;
name.length= strlen(name.str);
if ((body.str= get_field(&mem_root, table->field[ET_FIELD_BODY])) == NullS)
goto error;
body.length= strlen(body.str);
if ((definer.str= get_field(&mem_root,
table->field[ET_FIELD_DEFINER])) == NullS)
goto error;
definer.length= strlen(definer.str);
*/
ptr= strchr(definer.str, '@'); ptr= strchr(definer.str, '@');
if (! ptr) if (! ptr)
...@@ -848,7 +824,7 @@ Event_job_data::load_from_row(TABLE *table) ...@@ -848,7 +824,7 @@ Event_job_data::load_from_row(TABLE *table)
definer_user.length= len; definer_user.length= len;
len= definer.length - len - 1; len= definer.length - len - 1;
/* 1:because of @ */ /* 1:because of @ */
definer_host.str= strmake_root(&mem_root, ptr + 1, len); definer_host.str= strmake_root(&mem_root, ptr + 1, len);
definer_host.length= len; definer_host.length= len;
sql_mode= (ulong) table->field[ET_FIELD_SQL_MODE]->val_int(); sql_mode= (ulong) table->field[ET_FIELD_SQL_MODE]->val_int();
...@@ -891,26 +867,13 @@ Event_queue_element::load_from_row(TABLE *table) ...@@ -891,26 +867,13 @@ Event_queue_element::load_from_row(TABLE *table)
load_string_fields(table->field, ET_FIELD_DB, &dbname, ET_FIELD_NAME, &name, load_string_fields(table->field, ET_FIELD_DB, &dbname, ET_FIELD_NAME, &name,
ET_FIELD_DEFINER, &definer, ET_FIELD_COUNT); ET_FIELD_DEFINER, &definer, ET_FIELD_COUNT);
/*
if ((dbname.str= get_field(&mem_root, table->field[ET_FIELD_DB])) == NullS)
goto error;
dbname.length= strlen(dbname.str);
if ((name.str= get_field(&mem_root, table->field[ET_FIELD_NAME])) == NullS)
goto error;
name.length= strlen(name.str);
if ((definer.str= get_field(&mem_root,
table->field[ET_FIELD_DEFINER])) == NullS)
goto error;
definer.length= strlen(definer.str);
*/
starts_null= table->field[ET_FIELD_STARTS]->is_null(); starts_null= table->field[ET_FIELD_STARTS]->is_null();
res1= table->field[ET_FIELD_STARTS]->get_date(&starts, TIME_NO_ZERO_DATE); res1= table->field[ET_FIELD_STARTS]->get_date(&starts, TIME_NO_ZERO_DATE);
ends_null= table->field[ET_FIELD_ENDS]->is_null(); ends_null= table->field[ET_FIELD_ENDS]->is_null();
res2= table->field[ET_FIELD_ENDS]->get_date(&ends, TIME_NO_ZERO_DATE); res2= table->field[ET_FIELD_ENDS]->get_date(&ends, TIME_NO_ZERO_DATE);
if (!table->field[ET_FIELD_INTERVAL_EXPR]->is_null()) if (!table->field[ET_FIELD_INTERVAL_EXPR]->is_null())
expression= table->field[ET_FIELD_INTERVAL_EXPR]->val_int(); expression= table->field[ET_FIELD_INTERVAL_EXPR]->val_int();
else else
...@@ -990,12 +953,7 @@ Event_timed::load_from_row(TABLE *table) ...@@ -990,12 +953,7 @@ Event_timed::load_from_row(TABLE *table)
goto error; goto error;
load_string_fields(table->field, ET_FIELD_BODY, &body, ET_FIELD_COUNT); load_string_fields(table->field, ET_FIELD_BODY, &body, ET_FIELD_COUNT);
/*
if ((body.str= get_field(&mem_root, table->field[ET_FIELD_BODY])) == NullS)
goto error;
body.length= strlen(body.str);
*/
ptr= strchr(definer.str, '@'); ptr= strchr(definer.str, '@');
if (! ptr) if (! ptr)
......
...@@ -524,8 +524,10 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data, ...@@ -524,8 +524,10 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
int ret= 0; int ret= 0;
CHARSET_INFO *scs= system_charset_info; CHARSET_INFO *scs= system_charset_info;
TABLE *table; TABLE *table;
char olddb[128]; char old_db_buf[NAME_LEN+1];
LEX_STRING old_db= { old_db_buf, sizeof(old_db_buf) };
bool dbchanged= FALSE; bool dbchanged= FALSE;
DBUG_ENTER("Event_db_repository::create_event"); DBUG_ENTER("Event_db_repository::create_event");
*rows_affected= 0; *rows_affected= 0;
...@@ -557,8 +559,8 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data, ...@@ -557,8 +559,8 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
} }
DBUG_PRINT("info", ("non-existant, go forward")); DBUG_PRINT("info", ("non-existant, go forward"));
if ((ret= sp_use_new_db(thd, parse_data->dbname.str, olddb, sizeof(olddb), 0,
&dbchanged))) if ((ret= sp_use_new_db(thd, parse_data->dbname, &old_db, 0, &dbchanged)))
{ {
my_error(ER_BAD_DB_ERROR, MYF(0)); my_error(ER_BAD_DB_ERROR, MYF(0));
goto err; goto err;
...@@ -618,14 +620,14 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data, ...@@ -618,14 +620,14 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
*rows_affected= 1; *rows_affected= 1;
ok: ok:
if (dbchanged) if (dbchanged)
(void) mysql_change_db(thd, olddb, 1); (void) mysql_change_db(thd, old_db.str, 1);
if (table) if (table)
close_thread_tables(thd); close_thread_tables(thd);
DBUG_RETURN(EVEX_OK); DBUG_RETURN(EVEX_OK);
err: err:
if (dbchanged) if (dbchanged)
(void) mysql_change_db(thd, olddb, 1); (void) mysql_change_db(thd, old_db.str, 1);
if (table) if (table)
close_thread_tables(thd); close_thread_tables(thd);
DBUG_RETURN(EVEX_GENERAL_ERROR); DBUG_RETURN(EVEX_GENERAL_ERROR);
...@@ -655,7 +657,7 @@ Event_db_repository::update_event(THD *thd, Event_parse_data *parse_data, ...@@ -655,7 +657,7 @@ Event_db_repository::update_event(THD *thd, Event_parse_data *parse_data,
sp_name *new_name) sp_name *new_name)
{ {
CHARSET_INFO *scs= system_charset_info; CHARSET_INFO *scs= system_charset_info;
TABLE *table; TABLE *table= NULL;
int ret= EVEX_OPEN_TABLE_FAILED; int ret= EVEX_OPEN_TABLE_FAILED;
DBUG_ENTER("Event_db_repository::update_event"); DBUG_ENTER("Event_db_repository::update_event");
...@@ -765,7 +767,7 @@ int ...@@ -765,7 +767,7 @@ int
Event_db_repository::drop_event(THD *thd, LEX_STRING db, LEX_STRING name, Event_db_repository::drop_event(THD *thd, LEX_STRING db, LEX_STRING name,
bool drop_if_exists, uint *rows_affected) bool drop_if_exists, uint *rows_affected)
{ {
TABLE *table; TABLE *table= NULL;
Open_tables_state backup; Open_tables_state backup;
int ret; int ret;
...@@ -804,7 +806,8 @@ Event_db_repository::drop_event(THD *thd, LEX_STRING db, LEX_STRING name, ...@@ -804,7 +806,8 @@ Event_db_repository::drop_event(THD *thd, LEX_STRING db, LEX_STRING name,
} }
done: done:
close_thread_tables(thd); if (table)
close_thread_tables(thd);
thd->restore_backup_open_tables_state(&backup); thd->restore_backup_open_tables_state(&backup);
DBUG_RETURN(ret); DBUG_RETURN(ret);
} }
...@@ -965,7 +968,7 @@ int ...@@ -965,7 +968,7 @@ int
Event_db_repository::find_event(THD *thd, LEX_STRING dbname, LEX_STRING name, Event_db_repository::find_event(THD *thd, LEX_STRING dbname, LEX_STRING name,
Event_basic *et) Event_basic *et)
{ {
TABLE *table; TABLE *table= NULL;
int ret; int ret;
DBUG_ENTER("Event_db_repository::find_event"); DBUG_ENTER("Event_db_repository::find_event");
DBUG_PRINT("enter", ("name: %*s", name.length, name.str)); DBUG_PRINT("enter", ("name: %*s", name.length, name.str));
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
SYNOPSIS SYNOPSIS
event_queue_element_data_compare_q() event_queue_element_data_compare_q()
vptr - not used (set it to NULL) vptr - not used (set it to NULL)
a - first Event_queue_element object a - first Event_queue_element object
b - second Event_queue_element object b - second Event_queue_element object
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
-1 - a->execute_at < b->execute_at -1 - a->execute_at < b->execute_at
0 - a->execute_at == b->execute_at 0 - a->execute_at == b->execute_at
1 - a->execute_at > b->execute_at 1 - a->execute_at > b->execute_at
NOTES NOTES
execute_at.second_part is not considered during comparison execute_at.second_part is not considered during comparison
*/ */
...@@ -409,7 +409,7 @@ Event_queue::drop_matching_events(THD *thd, LEX_STRING pattern, ...@@ -409,7 +409,7 @@ Event_queue::drop_matching_events(THD *thd, LEX_STRING pattern,
DBUG_ENTER("Event_queue::drop_matching_events"); DBUG_ENTER("Event_queue::drop_matching_events");
DBUG_PRINT("enter", ("pattern=%*s state=%d", pattern.length, pattern.str)); DBUG_PRINT("enter", ("pattern=%*s state=%d", pattern.length, pattern.str));
uint i= 0; uint i= 0;
while (i < queue.elements) while (i < queue.elements)
{ {
Event_queue_element *et= (Event_queue_element *) queue_element(&queue, i); Event_queue_element *et= (Event_queue_element *) queue_element(&queue, i);
...@@ -438,7 +438,7 @@ Event_queue::drop_matching_events(THD *thd, LEX_STRING pattern, ...@@ -438,7 +438,7 @@ Event_queue::drop_matching_events(THD *thd, LEX_STRING pattern,
not notify the scheduler and it will realize the change when it not notify the scheduler and it will realize the change when it
wakes up from timedwait. wakes up from timedwait.
*/ */
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -499,7 +499,7 @@ Event_queue::events_count() ...@@ -499,7 +499,7 @@ Event_queue::events_count()
SYNOPSIS SYNOPSIS
Event_queue::load_events_from_db() Event_queue::load_events_from_db()
thd - Thread context. Used for memory allocation in some cases. thd - Thread context. Used for memory allocation in some cases.
RETURN VALUE RETURN VALUE
0 OK 0 OK
!0 Error (EVEX_OPEN_TABLE_FAILED, EVEX_MICROSECOND_UNSUP, !0 Error (EVEX_OPEN_TABLE_FAILED, EVEX_MICROSECOND_UNSUP,
......
...@@ -191,7 +191,7 @@ pthread_handler_t ...@@ -191,7 +191,7 @@ pthread_handler_t
event_scheduler_ng_thread(void *arg) event_scheduler_ng_thread(void *arg)
{ {
/* needs to be first for thread_stack */ /* needs to be first for thread_stack */
THD *thd= (THD *)(*(struct scheduler_param *) arg).thd; THD *thd= (THD *)(*(struct scheduler_param *) arg).thd;
thd->thread_stack= (char *)&thd; // remember where our stack is thd->thread_stack= (char *)&thd; // remember where our stack is
DBUG_ENTER("event_scheduler_ng_thread"); DBUG_ENTER("event_scheduler_ng_thread");
...@@ -207,7 +207,7 @@ event_scheduler_ng_thread(void *arg) ...@@ -207,7 +207,7 @@ event_scheduler_ng_thread(void *arg)
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) #if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
sigset_t set; sigset_t set;
VOID(sigemptyset(&set)); // Get mask in use VOID(sigemptyset(&set)); // Get mask in use
VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals)); VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals));
#endif #endif
...@@ -256,7 +256,7 @@ event_worker_ng_thread(void *arg) ...@@ -256,7 +256,7 @@ event_worker_ng_thread(void *arg)
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) #if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
sigset_t set; sigset_t set;
VOID(sigemptyset(&set)); // Get mask in use VOID(sigemptyset(&set)); // Get mask in use
VOID(pthread_sigmask(SIG_UNBLOCK, &set, &thd->block_signals)); VOID(pthread_sigmask(SIG_UNBLOCK, &set, &thd->block_signals));
#endif #endif
thd->init_for_queries(); thd->init_for_queries();
......
...@@ -111,7 +111,7 @@ int sortcmp_lex_string(LEX_STRING s, LEX_STRING t, CHARSET_INFO *cs) ...@@ -111,7 +111,7 @@ int sortcmp_lex_string(LEX_STRING s, LEX_STRING t, CHARSET_INFO *cs)
Events::get_instance() Events::get_instance()
RETURN VALUE RETURN VALUE
address address
*/ */
Events * Events *
......
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