diff options
author | andrey@lmy004. <> | 2006-02-20 16:06:05 +0100 |
---|---|---|
committer | andrey@lmy004. <> | 2006-02-20 16:06:05 +0100 |
commit | 2996d95257d3980a26acafb9f3fd8850c739cd17 (patch) | |
tree | 3eedf771340bb2cca5ef68e1a181745329f10f36 /sql/event_timed.cc | |
parent | af149459ed169cce5693e28eb49b5196af67a9cb (diff) | |
download | mariadb-git-2996d95257d3980a26acafb9f3fd8850c739cd17.tar.gz |
fix for bug #16411 Events: Microsecond intervals are allowed
WL#1034
Diffstat (limited to 'sql/event_timed.cc')
-rw-r--r-- | sql/event_timed.cc | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/sql/event_timed.cc b/sql/event_timed.cc index 6440e221732..4a9aee49df0 100644 --- a/sql/event_timed.cc +++ b/sql/event_timed.cc @@ -186,9 +186,10 @@ event_timed::init_execute_at(THD *thd, Item *expr) new_interval what is the interval RETURNS - 0 OK - EVEX_PARSE_ERROR fix_fields failed - EVEX_BAD_PARAMS Interval is not positive + 0 OK + EVEX_PARSE_ERROR fix_fields failed + EVEX_BAD_PARAMS Interval is not positive + EVEX_MICROSECOND_UNSUP Microseconds are not supported. */ int @@ -248,6 +249,7 @@ event_timed::init_interval(THD *thd, Item *expr, interval_type new_interval) case INTERVAL_MINUTE_MICROSECOND: // day and hour are 0 case INTERVAL_HOUR_MICROSECOND:// day is anyway 0 case INTERVAL_DAY_MICROSECOND: + DBUG_RETURN(EVEX_MICROSECOND_UNSUP); expression= ((((interval.day*24) + interval.hour)*60+interval.minute)*60 + interval.second) * 1000000L + interval.second_part; break; @@ -258,10 +260,11 @@ event_timed::init_interval(THD *thd, Item *expr, interval_type new_interval) expression= interval.minute * 60 + interval.second; break; case INTERVAL_SECOND_MICROSECOND: + DBUG_RETURN(EVEX_MICROSECOND_UNSUP); expression= interval.second * 1000000L + interval.second_part; break; - default: - break; + case INTERVAL_MICROSECOND: + DBUG_RETURN(EVEX_MICROSECOND_UNSUP); } if (interval.neg || expression > EVEX_MAX_INTERVAL_VALUE) DBUG_RETURN(EVEX_BAD_PARAMS); @@ -996,9 +999,10 @@ extern LEX_STRING interval_type_to_name[]; buf String*, should be already allocated. CREATE EVENT goes inside. RETURN VALUE - 0 OK - 1 Error (for now if mysql.event has been tampered and MICROSECONDS - interval or derivative has been put there. + 0 OK + EVEX_MICROSECOND_UNSUP Error (for now if mysql.event has been + tampered and MICROSECONDS interval or + derivative has been put there. */ int @@ -1014,7 +1018,7 @@ event_timed::get_create_event(THD *thd, String *buf) if (expression && event_reconstruct_interval_expression(&expr_buf, interval, expression)) - DBUG_RETURN(1); + DBUG_RETURN(EVEX_MICROSECOND_UNSUP); buf->append(STRING_WITH_LEN("CREATE EVENT ")); append_identifier(thd, buf, dbname.str, dbname.length); @@ -1215,8 +1219,9 @@ event_timed::restore_security_context(THD *thd, Security_context *backup) instead of thd->mem_root RETURN VALUE - 0 success - EVEX_COMPILE_ERROR error during compilation + 0 success + EVEX_COMPILE_ERROR error during compilation + EVEX_MICROSECOND_UNSUP mysql.event was tampered */ int @@ -1238,7 +1243,20 @@ event_timed::compile(THD *thd, MEM_ROOT *mem_root) *old_collation_connection, *old_character_set_results; + DBUG_ENTER("event_timed::compile"); + show_create.length(0); + + switch (get_create_event(thd, &show_create)) { + case EVEX_MICROSECOND_UNSUP: + sql_print_error("Scheduler"); + DBUG_RETURN(EVEX_MICROSECOND_UNSUP); + case 0: + break; + default: + DBUG_ASSERT(0); + } + old_character_set_client= thd->variables.character_set_client; old_character_set_results= thd->variables.character_set_results; old_collation_connection= thd->variables.collation_connection; @@ -1250,7 +1268,6 @@ event_timed::compile(THD *thd, MEM_ROOT *mem_root) thd->update_charset(); - DBUG_ENTER("event_timed::compile"); /* Change the memory root for the execution time */ if (mem_root) { @@ -1264,8 +1281,6 @@ event_timed::compile(THD *thd, MEM_ROOT *mem_root) thd->db= dbname.str; thd->db_length= dbname.length; - get_create_event(thd, &show_create); - thd->query= show_create.c_ptr(); thd->query_length= show_create.length(); DBUG_PRINT("event_timed::compile", ("query:%s",thd->query)); |