#include <events.h>
Collaboration diagram for Events:

Definition at line 22 of file events.h.
Definition at line 28 of file events.h.
00029 { 00030 FIELD_DB = 0, 00031 FIELD_NAME, 00032 FIELD_BODY, 00033 FIELD_DEFINER, 00034 FIELD_EXECUTE_AT, 00035 FIELD_INTERVAL_EXPR, 00036 FIELD_TRANSIENT_INTERVAL, 00037 FIELD_CREATED, 00038 FIELD_MODIFIED, 00039 FIELD_LAST_EXECUTED, 00040 FIELD_STARTS, 00041 FIELD_ENDS, 00042 FIELD_STATUS, 00043 FIELD_ON_COMPLETION, 00044 FIELD_SQL_MODE, 00045 FIELD_COMMENT, 00046 FIELD_COUNT /* a cool trick to count the number of fields :) */ 00047 };
| Events::Events | ( | const Events & | ) | [private] |
| int Events::create_event | ( | THD * | thd, | |
| Event_timed * | et, | |||
| uint | create_options, | |||
| uint * | rows_affected | |||
| ) | [static] |
Definition at line 907 of file events.cc.
References Event_scheduler::create_event(), db_create_event(), DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, ER_EVENT_MODIFY_QUEUE_ERROR, Event_scheduler::get_instance(), HA_LEX_CREATE_IF_NOT_EXISTS, Event_scheduler::initialized(), LEX_STRING::length, my_error(), MYF, Event_timed::name, and LEX_STRING::str.
Referenced by mysql_execute_command().
00909 { 00910 int ret; 00911 00912 DBUG_ENTER("Events::create_event"); 00913 DBUG_PRINT("enter", ("name: %*s options:%d", et->name.length, 00914 et->name.str, create_options)); 00915 00916 if (!(ret = db_create_event(thd, et, 00917 create_options & HA_LEX_CREATE_IF_NOT_EXISTS, 00918 rows_affected))) 00919 { 00920 Event_scheduler *scheduler= Event_scheduler::get_instance(); 00921 if (scheduler->initialized() && 00922 (ret= scheduler->create_event(thd, et, true))) 00923 my_error(ER_EVENT_MODIFY_QUEUE_ERROR, MYF(0), ret); 00924 } 00925 /* No need to close the table, it will be closed in sql_parse::do_command */ 00926 00927 DBUG_RETURN(ret); 00928 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void Events::destroy_mutexes | ( | ) | [static] |
Definition at line 1339 of file events.cc.
References Event_scheduler::destroy_mutexes().
Referenced by clean_up_mutexes().
01340 { 01341 Event_scheduler::destroy_mutexes(); 01342 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int Events::drop_event | ( | THD * | thd, | |
| Event_timed * | et, | |||
| bool | drop_if_exists, | |||
| uint * | rows_affected | |||
| ) | [static] |
Definition at line 1057 of file events.cc.
References db_drop_event(), DBUG_ENTER, DBUG_RETURN, Event_scheduler::drop_event(), ER_EVENT_MODIFY_QUEUE_ERROR, Event_scheduler::get_instance(), Event_scheduler::initialized(), my_error(), and MYF.
Referenced by mysql_execute_command().
01059 { 01060 int ret; 01061 01062 DBUG_ENTER("Events::drop_event"); 01063 if (!(ret= db_drop_event(thd, et, drop_if_exists, rows_affected))) 01064 { 01065 Event_scheduler *scheduler= Event_scheduler::get_instance(); 01066 if (scheduler->initialized() && (ret= scheduler->drop_event(thd, et))) 01067 my_error(ER_EVENT_MODIFY_QUEUE_ERROR, MYF(0), ret); 01068 } 01069 01070 DBUG_RETURN(ret); 01071 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int Events::drop_schema_events | ( | THD * | thd, | |
| char * | db | |||
| ) | [static] |
Definition at line 1161 of file events.cc.
References db_drop_events_from_table(), DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, Event_scheduler::drop_schema_events(), Event_scheduler::get_instance(), Event_scheduler::initialized(), and strlen().
Referenced by mysql_rm_db().
01162 { 01163 int ret= 0; 01164 LEX_STRING db_lex= {db, strlen(db)}; 01165 01166 DBUG_ENTER("evex_drop_db_events"); 01167 DBUG_PRINT("enter", ("dropping events from %s", db)); 01168 01169 Event_scheduler *scheduler= Event_scheduler::get_instance(); 01170 if (scheduler->initialized()) 01171 ret= scheduler->drop_schema_events(thd, &db_lex); 01172 else 01173 ret= db_drop_events_from_table(thd, &db_lex); 01174 01175 DBUG_RETURN(ret); 01176 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int Events::dump_internal_status | ( | THD * | thd | ) | [static] |
Definition at line 1310 of file events.cc.
References Event_scheduler::dump_internal_status().
Referenced by mysql_execute_command().
01311 { 01312 return Event_scheduler::dump_internal_status(thd); 01313 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int Events::init | ( | ) | [static] |
Definition at line 1254 of file events.cc.
References DBUG_ASSERT, DBUG_ENTER, DBUG_RETURN, Event_scheduler::get_instance(), Event_scheduler::init(), opt_event_scheduler, Event_scheduler::start(), and Event_scheduler::start_suspended().
Referenced by main().
01255 { 01256 int ret= 0; 01257 DBUG_ENTER("Events::init"); 01258 01259 /* it should be an assignment! */ 01260 if (opt_event_scheduler) 01261 { 01262 Event_scheduler *scheduler= Event_scheduler::get_instance(); 01263 DBUG_ASSERT(opt_event_scheduler == 1 || opt_event_scheduler == 2); 01264 DBUG_RETURN(scheduler->init() || 01265 (opt_event_scheduler == 1? scheduler->start(): 01266 scheduler->start_suspended())); 01267 } 01268 DBUG_RETURN(0); 01269 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void Events::init_mutexes | ( | ) | [static] |
Definition at line 1325 of file events.cc.
References Event_scheduler::init_mutexes().
Referenced by init_thread_environment().
01326 { 01327 Event_scheduler::init_mutexes(); 01328 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int Events::open_event_table | ( | THD * | thd, | |
| enum thr_lock_type | lock_type, | |||
| TABLE ** | table | |||
| ) | [static] |
Definition at line 341 of file events.cc.
References bzero, close_thread_tables(), DBUG_ENTER, DBUG_RETURN, ER_CANNOT_LOAD_FROM_TABLE, event_table_fields, FIELD_COUNT, mysql_event_last_create_time, simple_open_n_lock_tables(), table_check_intact(), and st_table::use_all_columns().
Referenced by db_create_event(), db_drop_event(), db_drop_events_from_table(), db_find_event(), db_update_event(), fill_schema_events(), Event_scheduler::load_events_from_db(), and Event_timed::update_fields().
00343 { 00344 TABLE_LIST tables; 00345 DBUG_ENTER("open_events_table"); 00346 00347 bzero((char*) &tables, sizeof(tables)); 00348 tables.db= (char*) "mysql"; 00349 tables.table_name= tables.alias= (char*) "event"; 00350 tables.lock_type= lock_type; 00351 00352 if (simple_open_n_lock_tables(thd, &tables)) 00353 DBUG_RETURN(1); 00354 00355 if (table_check_intact(tables.table, Events::FIELD_COUNT, 00356 event_table_fields, 00357 &mysql_event_last_create_time, 00358 ER_CANNOT_LOAD_FROM_TABLE)) 00359 { 00360 close_thread_tables(thd); 00361 DBUG_RETURN(2); 00362 } 00363 *table= tables.table; 00364 tables.table->use_all_columns(); 00365 DBUG_RETURN(0); 00366 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void Events::operator= | ( | Events & | ) | [private] |
| int Events::reconstruct_interval_expression | ( | String * | buf, | |
| interval_type | interval, | |||
| longlong | expression | |||
| ) | [static] |
Definition at line 210 of file events.cc.
References buf, ER_NOT_SUPPORTED_YET, FALSE, INTERVAL_DAY_HOUR, INTERVAL_DAY_MICROSECOND, INTERVAL_DAY_MINUTE, INTERVAL_DAY_SECOND, INTERVAL_HOUR_MICROSECOND, INTERVAL_HOUR_MINUTE, INTERVAL_HOUR_SECOND, INTERVAL_MICROSECOND, INTERVAL_MINUTE_MICROSECOND, INTERVAL_MINUTE_SECOND, INTERVAL_QUARTER, INTERVAL_SECOND_MICROSECOND, INTERVAL_WEEK, INTERVAL_YEAR_MONTH, longlong10_to_str, my_error(), MYF, separator, and TRUE.
Referenced by copy_event_to_schema_table(), and Event_timed::get_create_event().
00213 { 00214 ulonglong expr= expression; 00215 char tmp_buff[128], *end; 00216 bool close_quote= TRUE; 00217 int multipl= 0; 00218 char separator=':'; 00219 00220 switch (interval) { 00221 case INTERVAL_YEAR_MONTH: 00222 multipl= 12; 00223 separator= '-'; 00224 goto common_1_lev_code; 00225 case INTERVAL_DAY_HOUR: 00226 multipl= 24; 00227 separator= ' '; 00228 goto common_1_lev_code; 00229 case INTERVAL_HOUR_MINUTE: 00230 case INTERVAL_MINUTE_SECOND: 00231 multipl= 60; 00232 common_1_lev_code: 00233 buf->append('\''); 00234 end= longlong10_to_str(expression/multipl, tmp_buff, 10); 00235 buf->append(tmp_buff, (uint) (end- tmp_buff)); 00236 expr= expr - (expr/multipl)*multipl; 00237 break; 00238 case INTERVAL_DAY_MINUTE: 00239 { 00240 ulonglong tmp_expr= expr; 00241 00242 tmp_expr/=(24*60); 00243 buf->append('\''); 00244 end= longlong10_to_str(tmp_expr, tmp_buff, 10); 00245 buf->append(tmp_buff, (uint) (end- tmp_buff));// days 00246 buf->append(' '); 00247 00248 tmp_expr= expr - tmp_expr*(24*60);//minutes left 00249 end= longlong10_to_str(tmp_expr/60, tmp_buff, 10); 00250 buf->append(tmp_buff, (uint) (end- tmp_buff));// hours 00251 00252 expr= tmp_expr - (tmp_expr/60)*60; 00253 /* the code after the switch will finish */ 00254 } 00255 break; 00256 case INTERVAL_HOUR_SECOND: 00257 { 00258 ulonglong tmp_expr= expr; 00259 00260 buf->append('\''); 00261 end= longlong10_to_str(tmp_expr/3600, tmp_buff, 10); 00262 buf->append(tmp_buff, (uint) (end- tmp_buff));// hours 00263 buf->append(':'); 00264 00265 tmp_expr= tmp_expr - (tmp_expr/3600)*3600; 00266 end= longlong10_to_str(tmp_expr/60, tmp_buff, 10); 00267 buf->append(tmp_buff, (uint) (end- tmp_buff));// minutes 00268 00269 expr= tmp_expr - (tmp_expr/60)*60; 00270 /* the code after the switch will finish */ 00271 } 00272 break; 00273 case INTERVAL_DAY_SECOND: 00274 { 00275 ulonglong tmp_expr= expr; 00276 00277 tmp_expr/=(24*3600); 00278 buf->append('\''); 00279 end= longlong10_to_str(tmp_expr, tmp_buff, 10); 00280 buf->append(tmp_buff, (uint) (end- tmp_buff));// days 00281 buf->append(' '); 00282 00283 tmp_expr= expr - tmp_expr*(24*3600);//seconds left 00284 end= longlong10_to_str(tmp_expr/3600, tmp_buff, 10); 00285 buf->append(tmp_buff, (uint) (end- tmp_buff));// hours 00286 buf->append(':'); 00287 00288 tmp_expr= tmp_expr - (tmp_expr/3600)*3600; 00289 end= longlong10_to_str(tmp_expr/60, tmp_buff, 10); 00290 buf->append(tmp_buff, (uint) (end- tmp_buff));// minutes 00291 00292 expr= tmp_expr - (tmp_expr/60)*60; 00293 /* the code after the switch will finish */ 00294 } 00295 break; 00296 case INTERVAL_DAY_MICROSECOND: 00297 case INTERVAL_HOUR_MICROSECOND: 00298 case INTERVAL_MINUTE_MICROSECOND: 00299 case INTERVAL_SECOND_MICROSECOND: 00300 case INTERVAL_MICROSECOND: 00301 my_error(ER_NOT_SUPPORTED_YET, MYF(0), "MICROSECOND"); 00302 return 1; 00303 break; 00304 case INTERVAL_QUARTER: 00305 expr/= 3; 00306 close_quote= FALSE; 00307 break; 00308 case INTERVAL_WEEK: 00309 expr/= 7; 00310 default: 00311 close_quote= FALSE; 00312 break; 00313 } 00314 if (close_quote) 00315 buf->append(separator); 00316 end= longlong10_to_str(expr, tmp_buff, 10); 00317 buf->append(tmp_buff, (uint) (end- tmp_buff)); 00318 if (close_quote) 00319 buf->append('\''); 00320 00321 return 0; 00322 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int Events::show_create_event | ( | THD * | thd, | |
| sp_name * | spn | |||
| ) | [static] |
Definition at line 1088 of file events.cc.
References backup, String::c_ptr(), db_find_event(), DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, err, Event_timed::get_create_event(), String::length(), LEX_STRING::length, sp_name::m_name, Event_timed::name, NAME_LEN, NULL, Protocol::prepare_for_resend(), List< T >::push_back(), send_eof(), Protocol::SEND_EOF, Protocol::send_fields(), Protocol::SEND_NUM_ROWS, String::set_charset(), Event_timed::sql_mode, sql_mode_str, Protocol::store(), LEX_STRING::str, sys_var_thd_sql_mode::symbolic_mode_representation(), system_charset_info, and Protocol::write().
Referenced by mysql_execute_command().
01089 { 01090 int ret; 01091 Event_timed *et= NULL; 01092 Open_tables_state backup; 01093 01094 DBUG_ENTER("evex_update_event"); 01095 DBUG_PRINT("enter", ("name: %*s", spn->m_name.length, spn->m_name.str)); 01096 01097 thd->reset_n_backup_open_tables_state(&backup); 01098 ret= db_find_event(thd, spn, &et, NULL, thd->mem_root); 01099 thd->restore_backup_open_tables_state(&backup); 01100 01101 if (!ret) 01102 { 01103 Protocol *protocol= thd->protocol; 01104 char show_str_buf[768]; 01105 String show_str(show_str_buf, sizeof(show_str_buf), system_charset_info); 01106 List<Item> field_list; 01107 byte *sql_mode_str; 01108 ulong sql_mode_len=0; 01109 01110 show_str.length(0); 01111 show_str.set_charset(system_charset_info); 01112 01113 if (et->get_create_event(thd, &show_str)) 01114 goto err; 01115 01116 field_list.push_back(new Item_empty_string("Event", NAME_LEN)); 01117 01118 sql_mode_str= 01119 sys_var_thd_sql_mode::symbolic_mode_representation(thd, et->sql_mode, 01120 &sql_mode_len); 01121 01122 field_list.push_back(new Item_empty_string("sql_mode", sql_mode_len)); 01123 01124 field_list.push_back(new Item_empty_string("Create Event", 01125 show_str.length())); 01126 if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | 01127 Protocol::SEND_EOF)) 01128 goto err; 01129 01130 protocol->prepare_for_resend(); 01131 protocol->store(et->name.str, et->name.length, system_charset_info); 01132 01133 protocol->store((char*) sql_mode_str, sql_mode_len, system_charset_info); 01134 01135 protocol->store(show_str.c_ptr(), show_str.length(), system_charset_info); 01136 ret= protocol->write(); 01137 send_eof(thd); 01138 } 01139 delete et; 01140 DBUG_RETURN(ret); 01141 err: 01142 delete et; 01143 DBUG_RETURN(1); 01144 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void Events::shutdown | ( | ) | [static] |
Definition at line 1283 of file events.cc.
References DBUG_ENTER, DBUG_VOID_RETURN, Event_scheduler::destroy(), Event_scheduler::get_instance(), Event_scheduler::initialized(), and Event_scheduler::stop().
Referenced by close_connections().
01284 { 01285 DBUG_ENTER("Events::shutdown"); 01286 Event_scheduler *scheduler= Event_scheduler::get_instance(); 01287 if (scheduler->initialized()) 01288 { 01289 scheduler->stop(); 01290 scheduler->destroy(); 01291 } 01292 01293 DBUG_VOID_RETURN; 01294 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int Events::update_event | ( | THD * | thd, | |
| Event_timed * | et, | |||
| sp_name * | new_name, | |||
| uint * | rows_affected | |||
| ) | [static] |
Definition at line 951 of file events.cc.
References db_update_event(), DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, ER_EVENT_MODIFY_QUEUE_ERROR, Event_scheduler::get_instance(), Event_scheduler::initialized(), LEX_STRING::length, sp_name::m_db, sp_name::m_name, my_error(), MYF, Event_timed::name, NULL, LEX_STRING::str, and Event_scheduler::update_event().
Referenced by mysql_execute_command().
00953 { 00954 int ret; 00955 00956 DBUG_ENTER("Events::update_event"); 00957 DBUG_PRINT("enter", ("name: %*s", et->name.length, et->name.str)); 00958 /* 00959 db_update_event() opens & closes the table to prevent 00960 crash later in the code when loading and compiling the new definition. 00961 Also on error conditions my_error() is called so no need to handle here 00962 */ 00963 if (!(ret= db_update_event(thd, et, new_name))) 00964 { 00965 Event_scheduler *scheduler= Event_scheduler::get_instance(); 00966 if (scheduler->initialized() && 00967 (ret= scheduler->update_event(thd, et, 00968 new_name? &new_name->m_db: NULL, 00969 new_name? &new_name->m_name: NULL))) 00970 my_error(ER_EVENT_MODIFY_QUEUE_ERROR, MYF(0), ret); 00971 } 00972 DBUG_RETURN(ret); 00973 }
Here is the call graph for this function:

Here is the caller graph for this function:

ulong Events::opt_event_scheduler = 2 [static] |
TYPELIB Events::opt_typelib [static] |
1.4.7

