MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:ahristov Date:March 14 2006 10:55am
Subject:bk commit into 5.1 tree (andrey:1.2176) BUG#17428
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of andrey. When andrey does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2176 06/03/14 11:54:45 andrey@lmy004. +5 -0
  implement EXECUTE EVENT
  fix for bug#17428: TRIGGER EVENT does not work

  sql/sql_yacc.yy
    1.478 06/03/14 11:54:35 andrey@lmy004. +16 -1
    implement EXECUTE EVENT

  sql/sql_parse.cc
    1.528 06/03/14 11:54:35 andrey@lmy004. +6 -1
    implement EXECUTE EVENT

  sql/sql_lex.h
    1.221 06/03/14 11:54:35 andrey@lmy004. +1 -0
    implement EXECUTE EVENT

  sql/event.h
    1.27 06/03/14 11:54:35 andrey@lmy004. +3 -0
    implement EXECUTE EVENT

  sql/event.cc
    1.38 06/03/14 11:54:35 andrey@lmy004. +56 -0
    implement EXECUTE EVENT

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	andrey
# Host:	lmy004.
# Root:	/work/mysql-5.1-bug14356

--- 1.220/sql/sql_lex.h	2006-03-10 02:05:56 +01:00
+++ 1.221/sql/sql_lex.h	2006-03-14 11:54:35 +01:00
@@ -107,6 +107,7 @@ enum enum_sql_command {
   SQLCOM_SHOW_PLUGINS,
   SQLCOM_CREATE_EVENT, SQLCOM_ALTER_EVENT, SQLCOM_DROP_EVENT,
   SQLCOM_SHOW_CREATE_EVENT, SQLCOM_SHOW_EVENTS,
+  SQLCOM_TRIGGER_EVENT,
 
   /* This should be the last !!! */
 

--- 1.527/sql/sql_parse.cc	2006-03-10 14:01:04 +01:00
+++ 1.528/sql/sql_parse.cc	2006-03-14 11:54:35 +01:00
@@ -3807,6 +3807,7 @@ end_with_restore_list:
     break;
   }
   case SQLCOM_SHOW_CREATE_EVENT:
+  case SQLCOM_TRIGGER_EVENT:
   {
     DBUG_ASSERT(lex->spname);
     DBUG_ASSERT(lex->et);
@@ -3825,7 +3826,11 @@ end_with_restore_list:
       my_error(ER_TOO_LONG_IDENT, MYF(0), lex->spname->m_name.str);
       goto error;
     }
-    res= evex_show_create_event(thd, lex->spname, lex->et->definer);
+    if (lex->sql_command == SQLCOM_SHOW_CREATE_EVENT)
+      res= evex_show_create_event(thd, lex->spname, lex->et->definer);
+    else if (!(res= evex_trigger_event(thd, lex->spname, lex->et->definer)))
+      send_ok(thd, 0);
+      
     break;
   }
   case SQLCOM_CREATE_FUNCTION:                  // UDF function

--- 1.477/sql/sql_yacc.yy	2006-03-10 15:50:16 +01:00
+++ 1.478/sql/sql_yacc.yy	2006-03-14 11:54:35 +01:00
@@ -884,7 +884,7 @@ bool my_yyoverflow(short **a, YYSTYPE **
         view_algorithm view_or_trigger_or_sp view_or_trigger_or_sp_tail
         view_suid view_tail view_list_opt view_list view_select
         view_check_option trigger_tail sp_tail
-        install uninstall partition_entry binlog_base64_event
+        install uninstall partition_entry binlog_base64_event execute_event
 END_OF_INPUT
 
 %type <NONE> call sp_proc_stmts sp_proc_stmts1 sp_proc_stmt
@@ -976,6 +976,7 @@ statement:
 	| show
 	| slave
 	| start
+        | execute_event
 	| truncate
         | uninstall
 	| unlock
@@ -1558,6 +1559,20 @@ ev_sql_stmt_inner:
         | sp_proc_stmt_close
       ;
 
+execute_event: EXECUTE_SYM EVENT_SYM sp_name
+          {
+#ifdef DBUG_OFF
+            yyerror(ER(ER_SYNTAX_ERROR));
+            YYABORT;
+#else
+            Lex->sql_command = SQLCOM_TRIGGER_EVENT;
+            Lex->spname= $3;
+            Lex->et= new Event_timed();
+            if (!Lex->et)
+              YYABORT;
+            Lex->et->init_definer(YYTHD);
+#endif
+          };
 
 clear_privileges:
         /* Nothing */

--- 1.37/sql/event.cc	2006-02-28 20:32:30 +01:00
+++ 1.38/sql/event.cc	2006-03-14 11:54:35 +01:00
@@ -1426,6 +1426,62 @@ evex_show_create_event(THD *thd, sp_name
 
 
 /*
+   TRIGGER EVENT
+
+   SYNOPSIS
+     evex_trigger_event()
+       thd        THD
+       spn        the name of the event (db, name)
+       definer    the definer of the event
+
+   RETURNS
+     0  -  OK
+     1  - Error
+*/
+
+int
+evex_trigger_event(THD *thd, sp_name *spn, LEX_STRING definer)
+{
+  int ret;
+  Event_timed *et= NULL;
+  uint i;
+  DBUG_ENTER("evex_trigger_event");
+  DBUG_PRINT("enter", ("name: %*s", spn->m_name.length, spn->m_name.str));
+
+  VOID(pthread_mutex_lock(&LOCK_event_arrays));
+  DBUG_PRINT("info",("%d elements in the queue",
+             evex_queue_num_elements(EVEX_EQ_NAME)));
+  VOID(pthread_mutex_lock(&LOCK_evex_running));
+  if (!evex_is_running)
+  {
+    VOID(pthread_mutex_unlock(&LOCK_evex_running));
+    VOID(pthread_mutex_unlock(&LOCK_event_arrays));
+    DBUG_RETURN(0);
+  }
+
+  for (i= 0; i < evex_queue_num_elements(EVEX_EQ_NAME); ++i)
+  {
+    Event_timed *et= evex_queue_element(&EVEX_EQ_NAME, i, Event_timed*);
+    if (!sortcmp_lex_string(et->dbname, spn->m_db, system_charset_info) &&
+        !sortcmp_lex_string(et->name, spn->m_name, system_charset_info) &&
+        !sortcmp_lex_string(et->definer, definer, system_charset_info))
+    {
+      TIME time_now;
+      my_tz_UTC->gmt_sec_to_TIME(&et->execute_at, thd->query_start());
+      et->modified= TIME_to_ulonglong_datetime(&et->execute_at);
+      evex_queue_first_updated(&EVEX_EQ_NAME);
+      DBUG_PRINT("info", ("Found, scheduled for exectuting at now."));
+      break;
+    }
+  }
+  VOID(pthread_mutex_unlock(&LOCK_evex_running));
+  VOID(pthread_mutex_unlock(&LOCK_event_arrays));
+
+  DBUG_RETURN(false);
+}
+
+
+/*
   evex_drop_db_events - Drops all events in the selected database
 
   thd  - Thread

--- 1.26/sql/event.h	2006-02-28 18:33:25 +01:00
+++ 1.27/sql/event.h	2006-03-14 11:54:35 +01:00
@@ -276,6 +276,9 @@ evex_open_event_table(THD *thd, enum thr
 int
 evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer);
 
+int
+evex_trigger_event(THD *thd, sp_name *spn, LEX_STRING definer);
+
 int sortcmp_lex_string(LEX_STRING s, LEX_STRING t, CHARSET_INFO *cs);
 
 int
Thread
bk commit into 5.1 tree (andrey:1.2176) BUG#17428ahristov14 Mar