@@ -59,19 +59,17 @@ Event_parse_data::new_instance(THD *thd)
5959*/
6060
6161Event_parse_data::Event_parse_data ()
62+ :on_completion(ON_COMPLETION_DROP), status(ENABLED),
63+ item_starts(NULL ), item_ends(NULL ), item_execute_at(NULL ),
64+ starts_null(TRUE ), ends_null(TRUE ), execute_at_null(TRUE ),
65+ item_expression(NULL ), expression(0 )
6266{
6367 DBUG_ENTER (" Event_parse_data::Event_parse_data" );
6468
65- item_execute_at= item_expression= item_starts= item_ends= NULL ;
66- status= ENABLED;
67- on_completion= ON_COMPLETION_DROP;
68- expression= 0 ;
69-
7069 /* Actually in the parser STARTS is always set */
7170 set_zero_time (&starts, MYSQL_TIMESTAMP_DATETIME);
7271 set_zero_time (&ends, MYSQL_TIMESTAMP_DATETIME);
7372 set_zero_time (&execute_at, MYSQL_TIMESTAMP_DATETIME);
74- starts_null= ends_null= execute_at_null= TRUE ;
7573
7674 body.str = comment.str = NULL ;
7775 body.length = comment.length = 0 ;
@@ -161,7 +159,7 @@ Event_parse_data::init_body(THD *thd)
161159 */
162160 if ((*(body_end - 1 ) == ' *' ) && (*body_end == ' /' ))
163161 {
164- DBUG_PRINT (" info" , (" consumend one '*" " /' comment in the query '%s'" ,
162+ DBUG_PRINT (" info" , (" consumend one '*" " /' comment in the query '%s'" ,
165163 body_begin));
166164 body.length -= 2 ;
167165 body_end-= 2 ;
@@ -217,7 +215,7 @@ Event_parse_data::init_execute_at(THD *thd)
217215 DBUG_ASSERT (starts_null && ends_null);
218216
219217 /* let's check whether time is in the past */
220- thd->variables .time_zone ->gmt_sec_to_TIME (&time_tmp,
218+ thd->variables .time_zone ->gmt_sec_to_TIME (&time_tmp,
221219 (my_time_t ) thd->query_start ());
222220
223221 if ((not_used= item_execute_at->get_date (<ime, TIME_NO_ZERO_DATE)))
@@ -736,8 +734,8 @@ Event_timed::~Event_timed()
736734 Event_job_data::Event_job_data()
737735*/
738736
739- Event_job_data::Event_job_data ():
740- thd(NULL ), sphead(NULL ), sql_mode(0 )
737+ Event_job_data::Event_job_data ()
738+ : thd(NULL ), sphead(NULL ), sql_mode(0 )
741739{
742740}
743741
@@ -1073,7 +1071,7 @@ bool get_next_time(TIME *next, TIME *start, TIME *time_now, TIME *last_exec,
10731071 {
10741072 longlong seconds_diff;
10751073 long microsec_diff;
1076-
1074+
10771075 if (calc_time_diff (time_now, start, 1 , &seconds_diff, µsec_diff))
10781076 {
10791077 DBUG_PRINT (" error" , (" negative difference" ));
@@ -1115,14 +1113,16 @@ bool get_next_time(TIME *next, TIME *start, TIME *time_now, TIME *last_exec,
11151113 interval.month = (diff_months / months)*months;
11161114 /*
11171115 Check if the same month as last_exec (always set - prerequisite)
1118- An event happens at most once per month so there is no way to schedule
1119- it two times for the current month. This saves us from two calls to
1120- date_add_interval() if the event was just executed. But if the scheduler
1121- is started and there was at least 1 scheduled date skipped this one does
1122- not help and two calls to date_add_interval() will be done, which is a
1123- bit more expensive but compared to the rareness of the case is neglectable.
1116+ An event happens at most once per month so there is no way to
1117+ schedule it two times for the current month. This saves us from two
1118+ calls to date_add_interval() if the event was just executed. But if
1119+ the scheduler is started and there was at least 1 scheduled date
1120+ skipped this one does not help and two calls to date_add_interval()
1121+ will be done, which is a bit more expensive but compared to the
1122+ rareness of the case is neglectable.
11241123 */
1125- if (time_now->year ==last_exec->year && time_now->month ==last_exec->month )
1124+ if (time_now->year == last_exec->year &&
1125+ time_now->month == last_exec->month )
11261126 interval.month += months;
11271127
11281128 tmp= *start;
@@ -1289,7 +1289,7 @@ Event_queue_element::compute_next_execution_time()
12891289 }
12901290 goto ret;
12911291 }
1292- else if (starts_null && ends_null)
1292+ else if (starts_null && ends_null)
12931293 {
12941294 /* starts is always set, so this is a dead branch !! */
12951295 DBUG_PRINT (" info" , (" Neither STARTS nor ENDS are set" ));
@@ -1333,7 +1333,7 @@ Event_queue_element::compute_next_execution_time()
13331333
13341334 {
13351335 TIME next_exec;
1336- if (get_next_time (&next_exec, &starts, &time_now,
1336+ if (get_next_time (&next_exec, &starts, &time_now,
13371337 last_executed.year ? &last_executed:&starts,
13381338 expression, interval))
13391339 goto err;
@@ -1454,7 +1454,8 @@ Event_queue_element::drop(THD *thd)
14541454
14551455 RETURN VALUE
14561456 FALSE OK
1457- TRUE Error while opening mysql.event for writing or during write on disk
1457+ TRUE Error while opening mysql.event for writing or during
1458+ write on disk
14581459*/
14591460
14601461bool
@@ -1645,9 +1646,9 @@ Event_job_data::execute(THD *thd)
16451646 event_change_security_context (thd, definer_user, definer_host, dbname,
16461647 &save_ctx);
16471648 /*
1648- THD::~THD will clean this or if there is DROP DATABASE in the SP then
1649- it will be free there. It should not point to our buffer which is allocated
1650- on a mem_root.
1649+ THD::~THD will clean this or if there is DROP DATABASE in the
1650+ SP then it will be free there. It should not point to our buffer
1651+ which is allocated on a mem_root.
16511652 */
16521653 thd->db = my_strdup (dbname.str , MYF (0 ));
16531654 thd->db_length = dbname.length ;
@@ -1719,7 +1720,6 @@ Event_job_data::compile(THD *thd, MEM_ROOT *mem_root)
17191720
17201721 switch (get_fake_create_event (thd, &show_create)) {
17211722 case EVEX_MICROSECOND_UNSUP:
1722- sql_print_error (" Scheduler" );
17231723 DBUG_RETURN (EVEX_MICROSECOND_UNSUP);
17241724 case 0 :
17251725 break ;
@@ -1769,7 +1769,8 @@ Event_job_data::compile(THD *thd, MEM_ROOT *mem_root)
17691769 Free lex associated resources
17701770 QQ: Do we really need all this stuff here?
17711771 */
1772- sql_print_error (" error during compile of %s.%s or thd->is_fatal_error=%d" ,
1772+ sql_print_error (" SCHEDULER: Error during compilation of %s.%s or "
1773+ " thd->is_fatal_error=%d" ,
17731774 dbname.str , name.str , thd->is_fatal_error );
17741775
17751776 lex.unit .cleanup ();
@@ -1832,10 +1833,13 @@ event_basic_db_equal(LEX_STRING db, Event_basic *et)
18321833
18331834
18341835/*
1835- Checks whether two events are equal by identifiers
1836+ Checks whether an event has equal `db` and `name`
18361837
18371838 SYNOPSIS
18381839 event_basic_identifier_equal()
1840+ db Schema
1841+ name Name
1842+ et The event object
18391843
18401844 RETURN VALUE
18411845 TRUE Equal
@@ -1851,15 +1855,16 @@ event_basic_identifier_equal(LEX_STRING db, LEX_STRING name, Event_basic *b)
18511855
18521856
18531857/*
1854- Switches the security context
1858+ Switches the security context.
1859+
18551860 SYNOPSIS
18561861 event_change_security_context()
18571862 thd Thread
18581863 user The user
18591864 host The host of the user
18601865 db The schema for which the security_ctx will be loaded
18611866 backup Where to store the old context
1862-
1867+
18631868 RETURN VALUE
18641869 FALSE OK
18651870 TRUE Error (generates error too)
@@ -1887,7 +1892,8 @@ event_change_security_context(THD *thd, LEX_STRING user, LEX_STRING host,
18871892
18881893
18891894/*
1890- Restores the security context
1895+ Restores the security context.
1896+
18911897 SYNOPSIS
18921898 event_restore_security_context()
18931899 thd Thread
0 commit comments