Author: paul
Date: 2008-05-08 18:55:11 +0200 (Thu, 08 May 2008)
New Revision: 10692
Log:
r31247@frost: paul | 2008-05-08 10:52:57 -0500
events: general revisions
Modified:
trunk/it/refman-5.1/events.xml
trunk/pt/refman-5.1/events.xml
trunk/refman-5.1/events.xml
trunk/refman-6.0/events.xml
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:35828
7d8d2c4e-af1d-0410-ab9f-b038ce55645b:/mysqldoc-local/mysqldoc:31245
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:14218
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:31182
+ 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:35828
7d8d2c4e-af1d-0410-ab9f-b038ce55645b:/mysqldoc-local/mysqldoc:31247
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:14218
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:31182
Modified: trunk/it/refman-5.1/events.xml
===================================================================
--- trunk/it/refman-5.1/events.xml 2008-05-08 15:40:57 UTC (rev 10691)
+++ trunk/it/refman-5.1/events.xml 2008-05-08 16:55:11 UTC (rev 10692)
Changed blocks: 25, Lines Added: 114, Lines Deleted: 119; 18858 bytes
@@ -68,8 +68,7 @@
<listitem>
<para>
<xref linkend="events-limitations-restrictions"/>, describes the
- restrictions and limitations of MySQL's Event Scheduler
- implementation.
+ restrictions and limitations on the use of events.
</para>
</listitem>
@@ -214,8 +213,9 @@
thread</firstterm>; when we refer to the Event Scheduler, we
actually refer to this thread. When running, the event scheduler
thread and its current state can be seen by users having the
- <literal>SUPER</literal> privilege in the output of <literal>SHOW
- PROCESSLIST</literal>, as shown in the discussion that follows.
+ <literal>PROCESS</literal> privilege in the output of
+ <literal>SHOW PROCESSLIST</literal>, as shown in the discussion
+ that follows.
</para>
<indexterm>
@@ -231,6 +231,9 @@
<para id="events-event-scheduler-option">
The global variable <literal>event_scheduler</literal> determines
whether the Event Scheduler is enabled and running on the server.
+ affect event scheduling as described here: The global
+ <literal>event_scheduler</literal> system variable determines
+ whether the Event Scheduler is enabled and running on the server.
Beginning with MySQL 5.1.12, it has one of these 3 values, which
affect event scheduling as described here:
</para>
@@ -308,15 +311,17 @@
Scheduler non-operational. When the Event Scheduler is
<literal>DISABLED</literal>, the event scheduler thread does
not run (and so does not appear in the output of <literal>SHOW
- PROCESSLIST</literal>).
+ PROCESSLIST</literal>). In addition, the Event Scheduler state
+ cannot be changed at runtime.
</para>
</listitem>
</itemizedlist>
<para>
- When the server is running<literal>event_scheduler</literal> can
- be toggled between <literal>ON</literal> and
+ If the Event Scheduler status has not been set to
+ <literal>DISABLED</literal>,
<literal>event_scheduler</literal>
+ can be toggled between <literal>ON</literal> and
<literal>OFF</literal> (using <literal>SET</literal>). It
is also
possible to use <literal>0</literal> for
<literal>OFF</literal>,
and <literal>1</literal> for <literal>ON</literal> when
setting
@@ -370,14 +375,14 @@
<important>
<para>
- It is not possible to enable or disable the Event Scheduler when
- the server is running. That is, you can change the value of
- <literal>event_scheduler</literal> to
- <literal>DISABLED</literal> — or from
- <literal>DISABLED</literal> to one of the other permitted values
- for this option — only when the server is stopped.
- Attempting to do so when the server is running fails with an
- error.
+ It is possible to set the Event Scheduler to
+ <literal>DISABLED</literal> only at server startup. If
+ <literal>event_scheduler</literal> is
<literal>ON</literal> or
+ <literal>OFF</literal>, you cannot set it to
+ <literal>DISABLED</literal> at runtime. Also, if the Event
+ Scheduler is set to <literal>DISABLED</literal> at startup, you
+ cannot change the value of <literal>event_scheduler</literal> at
+ runtime.
</para>
</important>
@@ -415,11 +420,11 @@
<para>
To enable the Event Scheduler, restart the server without the
-
<option>--event-scheduler=<replaceable>DISABLED</replaceable></option>
- command line option, or after removing or commenting out the line
- containing <literal>event_scheduler=DISABLED</literal> in the
- server configuration file, as appropriate. Alternatively, you can
- use <literal>ON</literal> (or <literal>1</literal>) or
+ <option>--event-scheduler=DISABLED</option> command-line option,
+ or after removing or commenting out the line containing
+ <literal>event_scheduler=DISABLED</literal> in the server
+ configuration file, as appropriate. Alternatively, you can use
+ <literal>ON</literal> (or <literal>1</literal>) or
<literal>OFF</literal> (or <literal>0</literal>) in place
of the
<literal>DISABLED</literal> value when starting the server.
</para>
@@ -559,7 +564,7 @@
<para>
An event can be deleted by any user having the
<literal>EVENT</literal> privilege for the database on which
- the event is defined. Prior to MySQL 5.12, a user other than
+ the event is defined. Prior to MySQL 5.1.12, a user other than
the definer required privileges on the
<literal>mysql.event</literal> table. See
<xref linkend="events-privileges"/>.
@@ -683,6 +688,32 @@
</programlisting>
<para>
+ It is possible to change multiple characteristics of an event in
+ a single statement. This example changes the SQL statement
+ executed by <literal>myevent</literal> to one that deletes all
+ records from <literal>mytable</literal>; it also changes the
+ schedule for the event such that it executes once, one day after
+ this <literal>ALTER EVENT</literal> statement is run.
+ </para>
+
+<programlisting>
+ALTER TABLE myevent
+ ON SCHEDULE
+ AT CURRENT_TIMESTAMP + INTERVAL 1 DAY
+ DO
+ TRUNCATE TABLE myschema.mytable;
+</programlisting>
+
+ <para>
+ It is necessary to include only those options in an
+ <literal>ALTER EVENT</literal> statement which correspond to
+ characteristics that you actually wish to change; options which
+ are omitted retain their existing values. This includes any
+ default values for <literal>CREATE EVENT</literal> such as
+ <literal>ENABLE</literal>.
+ </para>
+
+ <para>
To disable <literal>myevent</literal>, use this <literal>ALTER
EVENT</literal> statement:
</para>
@@ -716,25 +747,10 @@
</para>
<para>
- It is possible to change multiple characteristics of an event in
- a single statement. This example changes the SQL statement
- executed by <literal>myevent</literal> to one that deletes all
- records from <literal>mytable</literal>; it also changes the
- schedule for the event such that it executes once, one day after
- this <literal>ALTER EVENT</literal> statement is run.
- </para>
-
-<programlisting>
-ALTER TABLE myevent
- ON SCHEDULE
- AT CURRENT_TIMESTAMP + INTERVAL 1 DAY
- DO
- TRUNCATE TABLE myschema.mytable;
-</programlisting>
-
- <para>
To rename an event, use the <literal>ALTER EVENT</literal>
- statement's <literal>RENAME TO</literal> clause, as shown here:
+ statement's <literal>RENAME TO</literal> clause. This statement
+ renames the event <literal>myevent</literal> to
+ <literal>yourevent</literal>:
</para>
<programlisting>
@@ -743,20 +759,9 @@
</programlisting>
<para>
- The previous statement renames the event
- <literal>myevent</literal> to
<literal>yourevent</literal>.
-
- <note>
- <para>
- There is no <literal>RENAME EVENT</literal> statement.
- </para>
- </note>
- </para>
-
- <para>
You can also move an event to a different database using
<literal>ALTER EVENT ... RENAME TO ...</literal> and
-
<literal><replaceable>db_name.table_name</replaceable></literal>
+
<literal><replaceable>db_name.event_name</replaceable></literal>
notation, as shown here:
</para>
@@ -766,11 +771,17 @@
</programlisting>
<para>
- In order to execute the previous statement, the user executing
- it must have the <literal>EVENT</literal> privilege on both the
+ To execute the previous statement, the user executing it must
+ have the <literal>EVENT</literal> privilege on both the
<literal>olddb</literal> and <literal>newdb</literal>
databases.
</para>
+ <note>
+ <para>
+ There is no <literal>RENAME EVENT</literal> statement.
+ </para>
+ </note>
+
<para>
Beginning with MySQL 5.1.18, a third value may also appear in
place of <literal>ENABLED</literal> or
@@ -785,15 +796,6 @@
information.
</para>
- <para>
- It is necessary to include only those options in an
- <literal>ALTER EVENT</literal> statement which correspond to
- characteristics that you actually wish to change; options which
- are omitted retain their existing values. This includes any
- default values for <literal>CREATE EVENT</literal> such as
- <literal>ENABLE</literal>.
- </para>
-
</section>
<section id="create-event">
@@ -837,10 +839,10 @@
DO <replaceable>sql_statement</replaceable>;
<replaceable>schedule</replaceable>:
- AT <replaceable>timestamp</replaceable> [+ INTERVAL
<replaceable>interval</replaceable>]
+ AT <replaceable>timestamp</replaceable> [+ INTERVAL
<replaceable>interval</replaceable>] ...
| EVERY <replaceable>interval</replaceable>
- [STARTS <replaceable>timestamp</replaceable> [+ INTERVAL interval]]
- [ENDS <replaceable>timestamp</replaceable> [+ INTERVAL interval]]
+ [STARTS <replaceable>timestamp</replaceable> [+ INTERVAL interval] ...]
+ [ENDS <replaceable>timestamp</replaceable> [+ INTERVAL interval] ...]
<replaceable>interval</replaceable>:
<replaceable>quantity</replaceable> {YEAR | QUARTER | MONTH | DAY | HOUR
| MINUTE |
@@ -862,12 +864,8 @@
<para>
The keywords <literal>CREATE EVENT</literal> plus an event
name, which uniquely identifies the event in the current
- schema.
- </para>
-
- <para>
- (Prior to MySQL 5.1.12, the event name needed to be unique
- only among events created by the same user on a given
+ schema. (Prior to MySQL 5.1.12, the event name needed to be
+ unique only among events created by the same user on a given
database.)
</para>
</listitem>
@@ -922,8 +920,8 @@
<para>
If no schema is indicated as part of
- <replaceable>event_name</replaceable>, then the default
- (current) schema is assumed.
+ <replaceable>event_name</replaceable>, the default (current)
+ schema is assumed.
</para>
<remark role="help-description-end"/>
@@ -946,8 +944,9 @@
format (the same format used in the <literal>GRANT</literal>
statement). The <replaceable>user_name</replaceable> and
<replaceable>host_name</replaceable> values both are required.
- <function role="sql">CURRENT_USER</function> also can be given
- as <function role="sql">CURRENT_USER()</function>. The default
+ The definer can also be given as
+ <function role="sql">CURRENT_USER</function> or
+ <function role="sql">CURRENT_USER()</function>. The default
<literal>DEFINER</literal> value is the user who executes the
<literal>CREATE EVENT</literal> statement. (This is the same as
<literal>DEFINER = CURRENT_USER</literal>.)
@@ -961,9 +960,9 @@
</para>
<para>
- <literal>IF NOT EXISTS</literal> functions in the same fashion
- with <literal>CREATE EVENT</literal> as it does when used with a
- <literal>CREATE TABLE</literal> statement; if an event named
+ <literal>IF NOT EXISTS</literal> has the same meaning for
+ <literal>CREATE EVENT</literal> as for <literal>CREATE
+ TABLE</literal>: If an event named
<replaceable>event_name</replaceable> already exists in the same
schema, no action is taken, and no error results. (However, a
warning is generated in such cases.)
@@ -982,11 +981,11 @@
<para>
<literal>AT
<replaceable>timestamp</replaceable></literal>
is used for a one-time event. It specifies that the event
- executes one time only at the date and time, given as the
+ executes one time only at the date and time given by
<replaceable>timestamp</replaceable>, which must include
both the date and time, or must be an expression that
- resolves to a datetime value. You may use a value which is
- of either the <literal>DATETIME</literal> or
+ resolves to a datetime value. You may use a value of either
+ the <literal>DATETIME</literal> or
<literal>TIMESTAMP</literal> type for this purpose. If the
date is in the past, a warning occurs, as shown here:
</para>
@@ -1028,11 +1027,10 @@
</para>
<para>
- In order to create an event which occurs at some point in
- the future relative to the current date and time —
- such as that expressed by the phrase <quote>three weeks from
- now</quote> — you can use the optional clause
- <literal>+ INTERVAL
+ To create an event which occurs at some point in the future
+ relative to the current date and time — such as that
+ expressed by the phrase <quote>three weeks from now</quote>
+ — you can use the optional clause <literal>+ INTERVAL
<replaceable>interval</replaceable></literal>. The
<replaceable>interval</replaceable> portion consists of two
parts, a quantity and a unit of time, and follows the same
@@ -1040,14 +1038,13 @@
<function role="sql">DATE_ADD()</function> function (see
<xref linkend="date-and-time-functions"/>. The units
keywords are also the same, except that you cannot use any
- units involving microseconds when defining an event.
+ units involving microseconds when defining an event. With
+ some interval types, complex time units may be used. For
+ example, <quote>two minutes and ten seconds</quote> can be
+ expressed as <literal>+ INTERVAL '2:10'
+ MINUTE_SECOND</literal>.
</para>
- <remark role="note">
- The following does not produce a syntax error, so if it is
- wrong, then it should do so.
- </remark>
-
<para>
You can also combine intervals. For example, <literal>AT
CURRENT_TIMESTAMP + INTERVAL 3 WEEK + INTERVAL 2
@@ -1059,8 +1056,8 @@
<listitem>
<para>
- For actions which are to be repeated at a regular interval,
- you can use an <literal>EVERY</literal> clause. The
+ To repeat actions at a regular interval, use an
+ <literal>EVERY</literal> clause. The
<literal>EVERY</literal> keyword is followed by an
<replaceable>interval</replaceable> as described in the
previous dicussion of the <literal>AT</literal> keyword.
@@ -1071,12 +1068,10 @@
</para>
<para>
- It is not possible to combine <literal>+ INTERVAL</literal>
- clauses in a single <literal>EVERY</literal> clause;
- however, you can use the same complex time units allowed in
- a <literal>+ INTERVAL</literal>. For example, <quote>every
- two minutes and ten seconds</quote> can be expressed as
- <literal>EVERY '2:10' MINUTE_SECOND</literal>.
+ Although <literal>+ INTERVAL</literal> clauses are not
+ allowed in an <literal>EVERY</literal> clause, you can use
+ the same complex time units allowed in a <literal>+
+ INTERVAL</literal>.
</para>
<para>
@@ -1247,29 +1242,29 @@
<note>
<para>
- The <literal>SHOW</literal> statement and
- <literal>SELECT</literal> statements that merely return a
- result set have no effect when used in an event; the output
- from these is not sent to the MySQL Monitor, nor is it stored
- anywhere. However, you can use statements such as
- <literal>SELECT INTO</literal> and <literal>INSERT ...
- SELECT</literal> that store a result. (See the next example in
- this section for an instance of the latter.)
+ Statements such as <literal>SELECT</literal> or
+ <literal>SHOW</literal> that merely return a result set have
+ no effect when used in an event; the output from these is not
+ sent to the MySQL Monitor, nor is it stored anywhere. However,
+ you can use statements such as <literal>SELECT ...
+ INTO</literal> and <literal>INSERT INTO ... SELECT</literal>
+ that store a result. (See the next example in this section for
+ an instance of the latter.)
</para>
</note>
<para>
- Any reference in the <literal>DO</literal> clause to a table in
- other than the same database schema to which the event belongs
- must be qualified with the name of the schema in which the table
- occurs. (In MySQL 5.1.6, all tables referenced in event
- <literal>DO</literal> clauses had to include a reference to the
- database.)
+ The schema to which an event belongs is the default schema for
+ table references in the <literal>DO</literal> clause. Any
+ references to tables in other schemas must be qualified with the
+ proper schema name. (In MySQL 5.1.6, all tables referenced in
+ event <literal>DO</literal> clauses had to include a reference
+ to the schema.)
</para>
<para>
- As with stored routines, you can use multiple statements in the
- <literal>DO</literal> clause by bracketing them with the
+ As with stored routines, you can use compound-statement syntax
+ in the <literal>DO</literal> clause by using the
<literal>BEGIN</literal> and <literal>END</literal>
keywords, as
shown here:
</para>
@@ -1293,7 +1288,7 @@
</programlisting>
<para>
- Note the use of the <literal>DELIMITER</literal> statement to
+ Note the use of the <literal>DELIMITER</literal> command to
change the statement delimiter, as with stored routines. See
<xref linkend="create-procedure"/>.
</para>
@@ -1566,8 +1561,8 @@
<para>
To enable or disable the execution of scheduled events, it is
necessary to set the value of the global
- <literal>event_scheduler</literal> variable. This requires the
- <literal>SUPER</literal> privilege.
+ <literal>event_scheduler</literal> system variable. This requires
+ the <literal>SUPER</literal> privilege.
</para>
<para>
Modified: trunk/pt/refman-5.1/events.xml
===================================================================
--- trunk/pt/refman-5.1/events.xml 2008-05-08 15:40:57 UTC (rev 10691)
+++ trunk/pt/refman-5.1/events.xml 2008-05-08 16:55:11 UTC (rev 10692)
Changed blocks: 25, Lines Added: 114, Lines Deleted: 119; 18858 bytes
@@ -68,8 +68,7 @@
<listitem>
<para>
<xref linkend="events-limitations-restrictions"/>, describes the
- restrictions and limitations of MySQL's Event Scheduler
- implementation.
+ restrictions and limitations on the use of events.
</para>
</listitem>
@@ -214,8 +213,9 @@
thread</firstterm>; when we refer to the Event Scheduler, we
actually refer to this thread. When running, the event scheduler
thread and its current state can be seen by users having the
- <literal>SUPER</literal> privilege in the output of <literal>SHOW
- PROCESSLIST</literal>, as shown in the discussion that follows.
+ <literal>PROCESS</literal> privilege in the output of
+ <literal>SHOW PROCESSLIST</literal>, as shown in the discussion
+ that follows.
</para>
<indexterm>
@@ -231,6 +231,9 @@
<para id="events-event-scheduler-option">
The global variable <literal>event_scheduler</literal> determines
whether the Event Scheduler is enabled and running on the server.
+ affect event scheduling as described here: The global
+ <literal>event_scheduler</literal> system variable determines
+ whether the Event Scheduler is enabled and running on the server.
Beginning with MySQL 5.1.12, it has one of these 3 values, which
affect event scheduling as described here:
</para>
@@ -308,15 +311,17 @@
Scheduler non-operational. When the Event Scheduler is
<literal>DISABLED</literal>, the event scheduler thread does
not run (and so does not appear in the output of <literal>SHOW
- PROCESSLIST</literal>).
+ PROCESSLIST</literal>). In addition, the Event Scheduler state
+ cannot be changed at runtime.
</para>
</listitem>
</itemizedlist>
<para>
- When the server is running<literal>event_scheduler</literal> can
- be toggled between <literal>ON</literal> and
+ If the Event Scheduler status has not been set to
+ <literal>DISABLED</literal>,
<literal>event_scheduler</literal>
+ can be toggled between <literal>ON</literal> and
<literal>OFF</literal> (using <literal>SET</literal>). It
is also
possible to use <literal>0</literal> for
<literal>OFF</literal>,
and <literal>1</literal> for <literal>ON</literal> when
setting
@@ -370,14 +375,14 @@
<important>
<para>
- It is not possible to enable or disable the Event Scheduler when
- the server is running. That is, you can change the value of
- <literal>event_scheduler</literal> to
- <literal>DISABLED</literal> — or from
- <literal>DISABLED</literal> to one of the other permitted values
- for this option — only when the server is stopped.
- Attempting to do so when the server is running fails with an
- error.
+ It is possible to set the Event Scheduler to
+ <literal>DISABLED</literal> only at server startup. If
+ <literal>event_scheduler</literal> is
<literal>ON</literal> or
+ <literal>OFF</literal>, you cannot set it to
+ <literal>DISABLED</literal> at runtime. Also, if the Event
+ Scheduler is set to <literal>DISABLED</literal> at startup, you
+ cannot change the value of <literal>event_scheduler</literal> at
+ runtime.
</para>
</important>
@@ -415,11 +420,11 @@
<para>
To enable the Event Scheduler, restart the server without the
-
<option>--event-scheduler=<replaceable>DISABLED</replaceable></option>
- command line option, or after removing or commenting out the line
- containing <literal>event_scheduler=DISABLED</literal> in the
- server configuration file, as appropriate. Alternatively, you can
- use <literal>ON</literal> (or <literal>1</literal>) or
+ <option>--event-scheduler=DISABLED</option> command-line option,
+ or after removing or commenting out the line containing
+ <literal>event_scheduler=DISABLED</literal> in the server
+ configuration file, as appropriate. Alternatively, you can use
+ <literal>ON</literal> (or <literal>1</literal>) or
<literal>OFF</literal> (or <literal>0</literal>) in place
of the
<literal>DISABLED</literal> value when starting the server.
</para>
@@ -559,7 +564,7 @@
<para>
An event can be deleted by any user having the
<literal>EVENT</literal> privilege for the database on which
- the event is defined. Prior to MySQL 5.12, a user other than
+ the event is defined. Prior to MySQL 5.1.12, a user other than
the definer required privileges on the
<literal>mysql.event</literal> table. See
<xref linkend="events-privileges"/>.
@@ -683,6 +688,32 @@
</programlisting>
<para>
+ It is possible to change multiple characteristics of an event in
+ a single statement. This example changes the SQL statement
+ executed by <literal>myevent</literal> to one that deletes all
+ records from <literal>mytable</literal>; it also changes the
+ schedule for the event such that it executes once, one day after
+ this <literal>ALTER EVENT</literal> statement is run.
+ </para>
+
+<programlisting>
+ALTER TABLE myevent
+ ON SCHEDULE
+ AT CURRENT_TIMESTAMP + INTERVAL 1 DAY
+ DO
+ TRUNCATE TABLE myschema.mytable;
+</programlisting>
+
+ <para>
+ It is necessary to include only those options in an
+ <literal>ALTER EVENT</literal> statement which correspond to
+ characteristics that you actually wish to change; options which
+ are omitted retain their existing values. This includes any
+ default values for <literal>CREATE EVENT</literal> such as
+ <literal>ENABLE</literal>.
+ </para>
+
+ <para>
To disable <literal>myevent</literal>, use this <literal>ALTER
EVENT</literal> statement:
</para>
@@ -716,25 +747,10 @@
</para>
<para>
- It is possible to change multiple characteristics of an event in
- a single statement. This example changes the SQL statement
- executed by <literal>myevent</literal> to one that deletes all
- records from <literal>mytable</literal>; it also changes the
- schedule for the event such that it executes once, one day after
- this <literal>ALTER EVENT</literal> statement is run.
- </para>
-
-<programlisting>
-ALTER TABLE myevent
- ON SCHEDULE
- AT CURRENT_TIMESTAMP + INTERVAL 1 DAY
- DO
- TRUNCATE TABLE myschema.mytable;
-</programlisting>
-
- <para>
To rename an event, use the <literal>ALTER EVENT</literal>
- statement's <literal>RENAME TO</literal> clause, as shown here:
+ statement's <literal>RENAME TO</literal> clause. This statement
+ renames the event <literal>myevent</literal> to
+ <literal>yourevent</literal>:
</para>
<programlisting>
@@ -743,20 +759,9 @@
</programlisting>
<para>
- The previous statement renames the event
- <literal>myevent</literal> to
<literal>yourevent</literal>.
-
- <note>
- <para>
- There is no <literal>RENAME EVENT</literal> statement.
- </para>
- </note>
- </para>
-
- <para>
You can also move an event to a different database using
<literal>ALTER EVENT ... RENAME TO ...</literal> and
-
<literal><replaceable>db_name.table_name</replaceable></literal>
+
<literal><replaceable>db_name.event_name</replaceable></literal>
notation, as shown here:
</para>
@@ -766,11 +771,17 @@
</programlisting>
<para>
- In order to execute the previous statement, the user executing
- it must have the <literal>EVENT</literal> privilege on both the
+ To execute the previous statement, the user executing it must
+ have the <literal>EVENT</literal> privilege on both the
<literal>olddb</literal> and <literal>newdb</literal>
databases.
</para>
+ <note>
+ <para>
+ There is no <literal>RENAME EVENT</literal> statement.
+ </para>
+ </note>
+
<para>
Beginning with MySQL 5.1.18, a third value may also appear in
place of <literal>ENABLED</literal> or
@@ -785,15 +796,6 @@
information.
</para>
- <para>
- It is necessary to include only those options in an
- <literal>ALTER EVENT</literal> statement which correspond to
- characteristics that you actually wish to change; options which
- are omitted retain their existing values. This includes any
- default values for <literal>CREATE EVENT</literal> such as
- <literal>ENABLE</literal>.
- </para>
-
</section>
<section id="create-event">
@@ -837,10 +839,10 @@
DO <replaceable>sql_statement</replaceable>;
<replaceable>schedule</replaceable>:
- AT <replaceable>timestamp</replaceable> [+ INTERVAL
<replaceable>interval</replaceable>]
+ AT <replaceable>timestamp</replaceable> [+ INTERVAL
<replaceable>interval</replaceable>] ...
| EVERY <replaceable>interval</replaceable>
- [STARTS <replaceable>timestamp</replaceable> [+ INTERVAL interval]]
- [ENDS <replaceable>timestamp</replaceable> [+ INTERVAL interval]]
+ [STARTS <replaceable>timestamp</replaceable> [+ INTERVAL interval] ...]
+ [ENDS <replaceable>timestamp</replaceable> [+ INTERVAL interval] ...]
<replaceable>interval</replaceable>:
<replaceable>quantity</replaceable> {YEAR | QUARTER | MONTH | DAY | HOUR
| MINUTE |
@@ -862,12 +864,8 @@
<para>
The keywords <literal>CREATE EVENT</literal> plus an event
name, which uniquely identifies the event in the current
- schema.
- </para>
-
- <para>
- (Prior to MySQL 5.1.12, the event name needed to be unique
- only among events created by the same user on a given
+ schema. (Prior to MySQL 5.1.12, the event name needed to be
+ unique only among events created by the same user on a given
database.)
</para>
</listitem>
@@ -922,8 +920,8 @@
<para>
If no schema is indicated as part of
- <replaceable>event_name</replaceable>, then the default
- (current) schema is assumed.
+ <replaceable>event_name</replaceable>, the default (current)
+ schema is assumed.
</para>
<remark role="help-description-end"/>
@@ -946,8 +944,9 @@
format (the same format used in the <literal>GRANT</literal>
statement). The <replaceable>user_name</replaceable> and
<replaceable>host_name</replaceable> values both are required.
- <function role="sql">CURRENT_USER</function> also can be given
- as <function role="sql">CURRENT_USER()</function>. The default
+ The definer can also be given as
+ <function role="sql">CURRENT_USER</function> or
+ <function role="sql">CURRENT_USER()</function>. The default
<literal>DEFINER</literal> value is the user who executes the
<literal>CREATE EVENT</literal> statement. (This is the same as
<literal>DEFINER = CURRENT_USER</literal>.)
@@ -961,9 +960,9 @@
</para>
<para>
- <literal>IF NOT EXISTS</literal> functions in the same fashion
- with <literal>CREATE EVENT</literal> as it does when used with a
- <literal>CREATE TABLE</literal> statement; if an event named
+ <literal>IF NOT EXISTS</literal> has the same meaning for
+ <literal>CREATE EVENT</literal> as for <literal>CREATE
+ TABLE</literal>: If an event named
<replaceable>event_name</replaceable> already exists in the same
schema, no action is taken, and no error results. (However, a
warning is generated in such cases.)
@@ -982,11 +981,11 @@
<para>
<literal>AT
<replaceable>timestamp</replaceable></literal>
is used for a one-time event. It specifies that the event
- executes one time only at the date and time, given as the
+ executes one time only at the date and time given by
<replaceable>timestamp</replaceable>, which must include
both the date and time, or must be an expression that
- resolves to a datetime value. You may use a value which is
- of either the <literal>DATETIME</literal> or
+ resolves to a datetime value. You may use a value of either
+ the <literal>DATETIME</literal> or
<literal>TIMESTAMP</literal> type for this purpose. If the
date is in the past, a warning occurs, as shown here:
</para>
@@ -1028,11 +1027,10 @@
</para>
<para>
- In order to create an event which occurs at some point in
- the future relative to the current date and time —
- such as that expressed by the phrase <quote>three weeks from
- now</quote> — you can use the optional clause
- <literal>+ INTERVAL
+ To create an event which occurs at some point in the future
+ relative to the current date and time — such as that
+ expressed by the phrase <quote>three weeks from now</quote>
+ — you can use the optional clause <literal>+ INTERVAL
<replaceable>interval</replaceable></literal>. The
<replaceable>interval</replaceable> portion consists of two
parts, a quantity and a unit of time, and follows the same
@@ -1040,14 +1038,13 @@
<function role="sql">DATE_ADD()</function> function (see
<xref linkend="date-and-time-functions"/>. The units
keywords are also the same, except that you cannot use any
- units involving microseconds when defining an event.
+ units involving microseconds when defining an event. With
+ some interval types, complex time units may be used. For
+ example, <quote>two minutes and ten seconds</quote> can be
+ expressed as <literal>+ INTERVAL '2:10'
+ MINUTE_SECOND</literal>.
</para>
- <remark role="note">
- The following does not produce a syntax error, so if it is
- wrong, then it should do so.
- </remark>
-
<para>
You can also combine intervals. For example, <literal>AT
CURRENT_TIMESTAMP + INTERVAL 3 WEEK + INTERVAL 2
@@ -1059,8 +1056,8 @@
<listitem>
<para>
- For actions which are to be repeated at a regular interval,
- you can use an <literal>EVERY</literal> clause. The
+ To repeat actions at a regular interval, use an
+ <literal>EVERY</literal> clause. The
<literal>EVERY</literal> keyword is followed by an
<replaceable>interval</replaceable> as described in the
previous dicussion of the <literal>AT</literal> keyword.
@@ -1071,12 +1068,10 @@
</para>
<para>
- It is not possible to combine <literal>+ INTERVAL</literal>
- clauses in a single <literal>EVERY</literal> clause;
- however, you can use the same complex time units allowed in
- a <literal>+ INTERVAL</literal>. For example, <quote>every
- two minutes and ten seconds</quote> can be expressed as
- <literal>EVERY '2:10' MINUTE_SECOND</literal>.
+ Although <literal>+ INTERVAL</literal> clauses are not
+ allowed in an <literal>EVERY</literal> clause, you can use
+ the same complex time units allowed in a <literal>+
+ INTERVAL</literal>.
</para>
<para>
@@ -1247,29 +1242,29 @@
<note>
<para>
- The <literal>SHOW</literal> statement and
- <literal>SELECT</literal> statements that merely return a
- result set have no effect when used in an event; the output
- from these is not sent to the MySQL Monitor, nor is it stored
- anywhere. However, you can use statements such as
- <literal>SELECT INTO</literal> and <literal>INSERT ...
- SELECT</literal> that store a result. (See the next example in
- this section for an instance of the latter.)
+ Statements such as <literal>SELECT</literal> or
+ <literal>SHOW</literal> that merely return a result set have
+ no effect when used in an event; the output from these is not
+ sent to the MySQL Monitor, nor is it stored anywhere. However,
+ you can use statements such as <literal>SELECT ...
+ INTO</literal> and <literal>INSERT INTO ... SELECT</literal>
+ that store a result. (See the next example in this section for
+ an instance of the latter.)
</para>
</note>
<para>
- Any reference in the <literal>DO</literal> clause to a table in
- other than the same database schema to which the event belongs
- must be qualified with the name of the schema in which the table
- occurs. (In MySQL 5.1.6, all tables referenced in event
- <literal>DO</literal> clauses had to include a reference to the
- database.)
+ The schema to which an event belongs is the default schema for
+ table references in the <literal>DO</literal> clause. Any
+ references to tables in other schemas must be qualified with the
+ proper schema name. (In MySQL 5.1.6, all tables referenced in
+ event <literal>DO</literal> clauses had to include a reference
+ to the schema.)
</para>
<para>
- As with stored routines, you can use multiple statements in the
- <literal>DO</literal> clause by bracketing them with the
+ As with stored routines, you can use compound-statement syntax
+ in the <literal>DO</literal> clause by using the
<literal>BEGIN</literal> and <literal>END</literal>
keywords, as
shown here:
</para>
@@ -1293,7 +1288,7 @@
</programlisting>
<para>
- Note the use of the <literal>DELIMITER</literal> statement to
+ Note the use of the <literal>DELIMITER</literal> command to
change the statement delimiter, as with stored routines. See
<xref linkend="create-procedure"/>.
</para>
@@ -1566,8 +1561,8 @@
<para>
To enable or disable the execution of scheduled events, it is
necessary to set the value of the global
- <literal>event_scheduler</literal> variable. This requires the
- <literal>SUPER</literal> privilege.
+ <literal>event_scheduler</literal> system variable. This requires
+ the <literal>SUPER</literal> privilege.
</para>
<para>
Modified: trunk/refman-5.1/events.xml
===================================================================
--- trunk/refman-5.1/events.xml 2008-05-08 15:40:57 UTC (rev 10691)
+++ trunk/refman-5.1/events.xml 2008-05-08 16:55:11 UTC (rev 10692)
Changed blocks: 23, Lines Added: 109, Lines Deleted: 111; 17548 bytes
@@ -68,8 +68,7 @@
<listitem>
<para>
<xref linkend="events-limitations-restrictions"/>, describes the
- restrictions and limitations of MySQL's Event Scheduler
- implementation.
+ restrictions and limitations on the use of events.
</para>
</listitem>
@@ -214,8 +213,9 @@
thread</firstterm>; when we refer to the Event Scheduler, we
actually refer to this thread. When running, the event scheduler
thread and its current state can be seen by users having the
- <literal>SUPER</literal> privilege in the output of <literal>SHOW
- PROCESSLIST</literal>, as shown in the discussion that follows.
+ <literal>PROCESS</literal> privilege in the output of
+ <literal>SHOW PROCESSLIST</literal>, as shown in the discussion
+ that follows.
</para>
<indexterm>
@@ -231,6 +231,9 @@
<para id="events-event-scheduler-option">
The global variable <literal>event_scheduler</literal> determines
whether the Event Scheduler is enabled and running on the server.
+ affect event scheduling as described here: The global
+ <literal>event_scheduler</literal> system variable determines
+ whether the Event Scheduler is enabled and running on the server.
Beginning with MySQL 5.1.12, it has one of these 3 values, which
affect event scheduling as described here:
</para>
@@ -308,15 +311,17 @@
Scheduler non-operational. When the Event Scheduler is
<literal>DISABLED</literal>, the event scheduler thread does
not run (and so does not appear in the output of <literal>SHOW
- PROCESSLIST</literal>).
+ PROCESSLIST</literal>). In addition, the Event Scheduler state
+ cannot be changed at runtime.
</para>
</listitem>
</itemizedlist>
<para>
- When the server is running<literal>event_scheduler</literal> can
- be toggled between <literal>ON</literal> and
+ If the Event Scheduler status has not been set to
+ <literal>DISABLED</literal>,
<literal>event_scheduler</literal>
+ can be toggled between <literal>ON</literal> and
<literal>OFF</literal> (using <literal>SET</literal>). It
is also
possible to use <literal>0</literal> for
<literal>OFF</literal>,
and <literal>1</literal> for <literal>ON</literal> when
setting
@@ -370,14 +375,14 @@
<important>
<para>
- It is not possible to enable or disable the Event Scheduler when
- the server is running. That is, you can change the value of
- <literal>event_scheduler</literal> to
- <literal>DISABLED</literal> — or from
- <literal>DISABLED</literal> to one of the other permitted values
- for this option — only when the server is stopped.
- Attempting to do so when the server is running fails with an
- error.
+ It is possible to set the Event Scheduler to
+ <literal>DISABLED</literal> only at server startup. If
+ <literal>event_scheduler</literal> is
<literal>ON</literal> or
+ <literal>OFF</literal>, you cannot set it to
+ <literal>DISABLED</literal> at runtime. Also, if the Event
+ Scheduler is set to <literal>DISABLED</literal> at startup, you
+ cannot change the value of <literal>event_scheduler</literal> at
+ runtime.
</para>
</important>
@@ -415,11 +420,11 @@
<para>
To enable the Event Scheduler, restart the server without the
-
<option>--event-scheduler=<replaceable>DISABLED</replaceable></option>
- command line option, or after removing or commenting out the line
- containing <literal>event_scheduler=DISABLED</literal> in the
- server configuration file, as appropriate. Alternatively, you can
- use <literal>ON</literal> (or <literal>1</literal>) or
+ <option>--event-scheduler=DISABLED</option> command-line option,
+ or after removing or commenting out the line containing
+ <literal>event_scheduler=DISABLED</literal> in the server
+ configuration file, as appropriate. Alternatively, you can use
+ <literal>ON</literal> (or <literal>1</literal>) or
<literal>OFF</literal> (or <literal>0</literal>) in place
of the
<literal>DISABLED</literal> value when starting the server.
</para>
@@ -559,7 +564,7 @@
<para>
An event can be deleted by any user having the
<literal>EVENT</literal> privilege for the database on which
- the event is defined. Prior to MySQL 5.12, a user other than
+ the event is defined. Prior to MySQL 5.1.12, a user other than
the definer required privileges on the
<literal>mysql.event</literal> table. See
<xref linkend="events-privileges"/>.
@@ -683,6 +688,32 @@
</programlisting>
<para>
+ It is possible to change multiple characteristics of an event in
+ a single statement. This example changes the SQL statement
+ executed by <literal>myevent</literal> to one that deletes all
+ records from <literal>mytable</literal>; it also changes the
+ schedule for the event such that it executes once, one day after
+ this <literal>ALTER EVENT</literal> statement is run.
+ </para>
+
+<programlisting>
+ALTER TABLE myevent
+ ON SCHEDULE
+ AT CURRENT_TIMESTAMP + INTERVAL 1 DAY
+ DO
+ TRUNCATE TABLE myschema.mytable;
+</programlisting>
+
+ <para>
+ It is necessary to include only those options in an
+ <literal>ALTER EVENT</literal> statement which correspond to
+ characteristics that you actually wish to change; options which
+ are omitted retain their existing values. This includes any
+ default values for <literal>CREATE EVENT</literal> such as
+ <literal>ENABLE</literal>.
+ </para>
+
+ <para>
To disable <literal>myevent</literal>, use this <literal>ALTER
EVENT</literal> statement:
</para>
@@ -716,25 +747,10 @@
</para>
<para>
- It is possible to change multiple characteristics of an event in
- a single statement. This example changes the SQL statement
- executed by <literal>myevent</literal> to one that deletes all
- records from <literal>mytable</literal>; it also changes the
- schedule for the event such that it executes once, one day after
- this <literal>ALTER EVENT</literal> statement is run.
- </para>
-
-<programlisting>
-ALTER TABLE myevent
- ON SCHEDULE
- AT CURRENT_TIMESTAMP + INTERVAL 1 DAY
- DO
- TRUNCATE TABLE myschema.mytable;
-</programlisting>
-
- <para>
To rename an event, use the <literal>ALTER EVENT</literal>
- statement's <literal>RENAME TO</literal> clause, as shown here:
+ statement's <literal>RENAME TO</literal> clause. This statement
+ renames the event <literal>myevent</literal> to
+ <literal>yourevent</literal>:
</para>
<programlisting>
@@ -743,20 +759,9 @@
</programlisting>
<para>
- The previous statement renames the event
- <literal>myevent</literal> to
<literal>yourevent</literal>.
-
- <note>
- <para>
- There is no <literal>RENAME EVENT</literal> statement.
- </para>
- </note>
- </para>
-
- <para>
You can also move an event to a different database using
<literal>ALTER EVENT ... RENAME TO ...</literal> and
-
<literal><replaceable>db_name.table_name</replaceable></literal>
+
<literal><replaceable>db_name.event_name</replaceable></literal>
notation, as shown here:
</para>
@@ -766,11 +771,17 @@
</programlisting>
<para>
- In order to execute the previous statement, the user executing
- it must have the <literal>EVENT</literal> privilege on both the
+ To execute the previous statement, the user executing it must
+ have the <literal>EVENT</literal> privilege on both the
<literal>olddb</literal> and <literal>newdb</literal>
databases.
</para>
+ <note>
+ <para>
+ There is no <literal>RENAME EVENT</literal> statement.
+ </para>
+ </note>
+
<para>
Beginning with MySQL 5.1.18, a third value may also appear in
place of <literal>ENABLED</literal> or
@@ -785,15 +796,6 @@
information.
</para>
- <para>
- It is necessary to include only those options in an
- <literal>ALTER EVENT</literal> statement which correspond to
- characteristics that you actually wish to change; options which
- are omitted retain their existing values. This includes any
- default values for <literal>CREATE EVENT</literal> such as
- <literal>ENABLE</literal>.
- </para>
-
</section>
<section id="create-event">
@@ -837,10 +839,10 @@
DO <replaceable>sql_statement</replaceable>;
<replaceable>schedule</replaceable>:
- AT <replaceable>timestamp</replaceable> [+ INTERVAL
<replaceable>interval</replaceable>]
+ AT <replaceable>timestamp</replaceable> [+ INTERVAL
<replaceable>interval</replaceable>] ...
| EVERY <replaceable>interval</replaceable>
- [STARTS <replaceable>timestamp</replaceable> [+ INTERVAL interval]]
- [ENDS <replaceable>timestamp</replaceable> [+ INTERVAL interval]]
+ [STARTS <replaceable>timestamp</replaceable> [+ INTERVAL interval] ...]
+ [ENDS <replaceable>timestamp</replaceable> [+ INTERVAL interval] ...]
<replaceable>interval</replaceable>:
<replaceable>quantity</replaceable> {YEAR | QUARTER | MONTH | DAY | HOUR
| MINUTE |
@@ -918,8 +920,8 @@
<para>
If no schema is indicated as part of
- <replaceable>event_name</replaceable>, then the default
- (current) schema is assumed.
+ <replaceable>event_name</replaceable>, the default (current)
+ schema is assumed.
</para>
<remark role="help-description-end"/>
@@ -958,9 +960,9 @@
</para>
<para>
- <literal>IF NOT EXISTS</literal> functions in the same fashion
- with <literal>CREATE EVENT</literal> as it does when used with a
- <literal>CREATE TABLE</literal> statement; if an event named
+ <literal>IF NOT EXISTS</literal> has the same meaning for
+ <literal>CREATE EVENT</literal> as for <literal>CREATE
+ TABLE</literal>: If an event named
<replaceable>event_name</replaceable> already exists in the same
schema, no action is taken, and no error results. (However, a
warning is generated in such cases.)
@@ -979,11 +981,11 @@
<para>
<literal>AT
<replaceable>timestamp</replaceable></literal>
is used for a one-time event. It specifies that the event
- executes one time only at the date and time, given as the
+ executes one time only at the date and time given by
<replaceable>timestamp</replaceable>, which must include
both the date and time, or must be an expression that
- resolves to a datetime value. You may use a value which is
- of either the <literal>DATETIME</literal> or
+ resolves to a datetime value. You may use a value of either
+ the <literal>DATETIME</literal> or
<literal>TIMESTAMP</literal> type for this purpose. If the
date is in the past, a warning occurs, as shown here:
</para>
@@ -1025,11 +1027,10 @@
</para>
<para>
- In order to create an event which occurs at some point in
- the future relative to the current date and time —
- such as that expressed by the phrase <quote>three weeks from
- now</quote> — you can use the optional clause
- <literal>+ INTERVAL
+ To create an event which occurs at some point in the future
+ relative to the current date and time — such as that
+ expressed by the phrase <quote>three weeks from now</quote>
+ — you can use the optional clause <literal>+ INTERVAL
<replaceable>interval</replaceable></literal>. The
<replaceable>interval</replaceable> portion consists of two
parts, a quantity and a unit of time, and follows the same
@@ -1037,14 +1038,13 @@
<function role="sql">DATE_ADD()</function> function (see
<xref linkend="date-and-time-functions"/>. The units
keywords are also the same, except that you cannot use any
- units involving microseconds when defining an event.
+ units involving microseconds when defining an event. With
+ some interval types, complex time units may be used. For
+ example, <quote>two minutes and ten seconds</quote> can be
+ expressed as <literal>+ INTERVAL '2:10'
+ MINUTE_SECOND</literal>.
</para>
- <remark role="note">
- The following does not produce a syntax error, so if it is
- wrong, then it should do so.
- </remark>
-
<para>
You can also combine intervals. For example, <literal>AT
CURRENT_TIMESTAMP + INTERVAL 3 WEEK + INTERVAL 2
@@ -1056,8 +1056,8 @@
<listitem>
<para>
- For actions which are to be repeated at a regular interval,
- you can use an <literal>EVERY</literal> clause. The
+ To repeat actions at a regular interval, use an
+ <literal>EVERY</literal> clause. The
<literal>EVERY</literal> keyword is followed by an
<replaceable>interval</replaceable> as described in the
previous dicussion of the <literal>AT</literal> keyword.
@@ -1068,12 +1068,10 @@
</para>
<para>
- It is not possible to combine <literal>+ INTERVAL</literal>
- clauses in a single <literal>EVERY</literal> clause;
- however, you can use the same complex time units allowed in
- a <literal>+ INTERVAL</literal>. For example, <quote>every
- two minutes and ten seconds</quote> can be expressed as
- <literal>EVERY '2:10' MINUTE_SECOND</literal>.
+ Although <literal>+ INTERVAL</literal> clauses are not
+ allowed in an <literal>EVERY</literal> clause, you can use
+ the same complex time units allowed in a <literal>+
+ INTERVAL</literal>.
</para>
<para>
@@ -1244,29 +1242,29 @@
<note>
<para>
- The <literal>SHOW</literal> statement and
- <literal>SELECT</literal> statements that merely return a
- result set have no effect when used in an event; the output
- from these is not sent to the MySQL Monitor, nor is it stored
- anywhere. However, you can use statements such as
- <literal>SELECT INTO</literal> and <literal>INSERT ...
- SELECT</literal> that store a result. (See the next example in
- this section for an instance of the latter.)
+ Statements such as <literal>SELECT</literal> or
+ <literal>SHOW</literal> that merely return a result set have
+ no effect when used in an event; the output from these is not
+ sent to the MySQL Monitor, nor is it stored anywhere. However,
+ you can use statements such as <literal>SELECT ...
+ INTO</literal> and <literal>INSERT INTO ... SELECT</literal>
+ that store a result. (See the next example in this section for
+ an instance of the latter.)
</para>
</note>
<para>
- Any reference in the <literal>DO</literal> clause to a table in
- other than the same database schema to which the event belongs
- must be qualified with the name of the schema in which the table
- occurs. (In MySQL 5.1.6, all tables referenced in event
- <literal>DO</literal> clauses had to include a reference to the
- database.)
+ The schema to which an event belongs is the default schema for
+ table references in the <literal>DO</literal> clause. Any
+ references to tables in other schemas must be qualified with the
+ proper schema name. (In MySQL 5.1.6, all tables referenced in
+ event <literal>DO</literal> clauses had to include a reference
+ to the schema.)
</para>
<para>
- As with stored routines, you can use multiple statements in the
- <literal>DO</literal> clause by bracketing them with the
+ As with stored routines, you can use compound-statement syntax
+ in the <literal>DO</literal> clause by using the
<literal>BEGIN</literal> and <literal>END</literal>
keywords, as
shown here:
</para>
@@ -1290,7 +1288,7 @@
</programlisting>
<para>
- Note the use of the <literal>DELIMITER</literal> statement to
+ Note the use of the <literal>DELIMITER</literal> command to
change the statement delimiter, as with stored routines. See
<xref linkend="create-procedure"/>.
</para>
@@ -1563,8 +1561,8 @@
<para>
To enable or disable the execution of scheduled events, it is
necessary to set the value of the global
- <literal>event_scheduler</literal> variable. This requires the
- <literal>SUPER</literal> privilege.
+ <literal>event_scheduler</literal> system variable. This requires
+ the <literal>SUPER</literal> privilege.
</para>
<para>
Modified: trunk/refman-6.0/events.xml
===================================================================
--- trunk/refman-6.0/events.xml 2008-05-08 15:40:57 UTC (rev 10691)
+++ trunk/refman-6.0/events.xml 2008-05-08 16:55:11 UTC (rev 10692)
Changed blocks: 22, Lines Added: 107, Lines Deleted: 112; 16917 bytes
@@ -68,8 +68,7 @@
<listitem>
<para>
<xref linkend="events-limitations-restrictions"/>, describes the
- restrictions and limitations of MySQL's Event Scheduler
- implementation.
+ restrictions and limitations on the use of events.
</para>
</listitem>
@@ -210,8 +209,9 @@
thread</firstterm>; when we refer to the Event Scheduler, we
actually refer to this thread. When running, the event scheduler
thread and its current state can be seen by users having the
- <literal>SUPER</literal> privilege in the output of <literal>SHOW
- PROCESSLIST</literal>, as shown in the discussion that follows.
+ <literal>PROCESS</literal> privilege in the output of
+ <literal>SHOW PROCESSLIST</literal>, as shown in the discussion
+ that follows.
</para>
<indexterm>
@@ -225,10 +225,10 @@
</indexterm>
<para id="events-event-scheduler-option">
- The global variable <literal>event_scheduler</literal> determines
- whether the Event Scheduler is enabled and running on the server.
- In MySQL ¤t-series;, it has one of these 3 values, which
- affect event scheduling as described here:
+ The global <literal>event_scheduler</literal> system variable
+ determines whether the Event Scheduler is enabled and running on
+ the server. In MySQL ¤t-series;, it has one of these 3
+ values, which affect event scheduling as described here:
</para>
<itemizedlist>
@@ -304,15 +304,17 @@
Scheduler non-operational. When the Event Scheduler is
<literal>DISABLED</literal>, the event scheduler thread does
not run (and so does not appear in the output of <literal>SHOW
- PROCESSLIST</literal>).
+ PROCESSLIST</literal>). In addition, the Event Scheduler state
+ cannot be changed at runtime.
</para>
</listitem>
</itemizedlist>
<para>
- When the server is running<literal>event_scheduler</literal> can
- be toggled between <literal>ON</literal> and
+ If the Event Scheduler status has not been set to
+ <literal>DISABLED</literal>,
<literal>event_scheduler</literal>
+ can be toggled between <literal>ON</literal> and
<literal>OFF</literal> (using <literal>SET</literal>). It
is also
possible to use <literal>0</literal> for
<literal>OFF</literal>,
and <literal>1</literal> for <literal>ON</literal> when
setting
@@ -366,14 +368,14 @@
<important>
<para>
- It is not possible to enable or disable the Event Scheduler when
- the server is running. That is, you can change the value of
- <literal>event_scheduler</literal> to
- <literal>DISABLED</literal> — or from
- <literal>DISABLED</literal> to one of the other permitted values
- for this option — only when the server is stopped.
- Attempting to do so when the server is running fails with an
- error.
+ It is possible to set the Event Scheduler to
+ <literal>DISABLED</literal> only at server startup. If
+ <literal>event_scheduler</literal> is
<literal>ON</literal> or
+ <literal>OFF</literal>, you cannot set it to
+ <literal>DISABLED</literal> at runtime. Also, if the Event
+ Scheduler is set to <literal>DISABLED</literal> at startup, you
+ cannot change the value of <literal>event_scheduler</literal> at
+ runtime.
</para>
</important>
@@ -411,11 +413,11 @@
<para>
To enable the Event Scheduler, restart the server without the
-
<option>--event-scheduler=<replaceable>DISABLED</replaceable></option>
- command line option, or after removing or commenting out the line
- containing <literal>event_scheduler=DISABLED</literal> in the
- server configuration file, as appropriate. Alternatively, you can
- use <literal>ON</literal> (or <literal>1</literal>) or
+ <option>--event-scheduler=DISABLED</option> command-line option,
+ or after removing or commenting out the line containing
+ <literal>event_scheduler=DISABLED</literal> in the server
+ configuration file, as appropriate. Alternatively, you can use
+ <literal>ON</literal> (or <literal>1</literal>) or
<literal>OFF</literal> (or <literal>0</literal>) in place
of the
<literal>DISABLED</literal> value when starting the server.
</para>
@@ -620,6 +622,32 @@
</programlisting>
<para>
+ It is possible to change multiple characteristics of an event in
+ a single statement. This example changes the SQL statement
+ executed by <literal>myevent</literal> to one that deletes all
+ records from <literal>mytable</literal>; it also changes the
+ schedule for the event such that it executes once, one day after
+ this <literal>ALTER EVENT</literal> statement is run.
+ </para>
+
+<programlisting>
+ALTER TABLE myevent
+ ON SCHEDULE
+ AT CURRENT_TIMESTAMP + INTERVAL 1 DAY
+ DO
+ TRUNCATE TABLE myschema.mytable;
+</programlisting>
+
+ <para>
+ It is necessary to include only those options in an
+ <literal>ALTER EVENT</literal> statement which correspond to
+ characteristics that you actually wish to change; options which
+ are omitted retain their existing values. This includes any
+ default values for <literal>CREATE EVENT</literal> such as
+ <literal>ENABLE</literal>.
+ </para>
+
+ <para>
To disable <literal>myevent</literal>, use this <literal>ALTER
EVENT</literal> statement:
</para>
@@ -653,25 +681,10 @@
</para>
<para>
- It is possible to change multiple characteristics of an event in
- a single statement. This example changes the SQL statement
- executed by <literal>myevent</literal> to one that deletes all
- records from <literal>mytable</literal>; it also changes the
- schedule for the event such that it executes once, one day after
- this <literal>ALTER EVENT</literal> statement is run.
- </para>
-
-<programlisting>
-ALTER TABLE myevent
- ON SCHEDULE
- AT CURRENT_TIMESTAMP + INTERVAL 1 DAY
- DO
- TRUNCATE TABLE myschema.mytable;
-</programlisting>
-
- <para>
To rename an event, use the <literal>ALTER EVENT</literal>
- statement's <literal>RENAME TO</literal> clause, as shown here:
+ statement's <literal>RENAME TO</literal> clause. This statement
+ renames the event <literal>myevent</literal> to
+ <literal>yourevent</literal>:
</para>
<programlisting>
@@ -680,20 +693,9 @@
</programlisting>
<para>
- The previous statement renames the event
- <literal>myevent</literal> to
<literal>yourevent</literal>.
-
- <note>
- <para>
- There is no <literal>RENAME EVENT</literal> statement.
- </para>
- </note>
- </para>
-
- <para>
You can also move an event to a different database using
<literal>ALTER EVENT ... RENAME TO ...</literal> and
-
<literal><replaceable>db_name.table_name</replaceable></literal>
+
<literal><replaceable>db_name.event_name</replaceable></literal>
notation, as shown here:
</para>
@@ -703,11 +705,17 @@
</programlisting>
<para>
- In order to execute the previous statement, the user executing
- it must have the <literal>EVENT</literal> privilege on both the
+ To execute the previous statement, the user executing it must
+ have the <literal>EVENT</literal> privilege on both the
<literal>olddb</literal> and <literal>newdb</literal>
databases.
</para>
+ <note>
+ <para>
+ There is no <literal>RENAME EVENT</literal> statement.
+ </para>
+ </note>
+
<para>
A third value may also appear in place of
<literal>ENABLED</literal> or
<literal>DISABLED</literal>;
@@ -721,15 +729,6 @@
information.
</para>
- <para>
- It is necessary to include only those options in an
- <literal>ALTER EVENT</literal> statement which correspond to
- characteristics that you actually wish to change; options which
- are omitted retain their existing values. This includes any
- default values for <literal>CREATE EVENT</literal> such as
- <literal>ENABLE</literal>.
- </para>
-
</section>
<section id="create-event">
@@ -773,10 +772,10 @@
DO <replaceable>sql_statement</replaceable>;
<replaceable>schedule</replaceable>:
- AT <replaceable>timestamp</replaceable> [+ INTERVAL
<replaceable>interval</replaceable>]
+ AT <replaceable>timestamp</replaceable> [+ INTERVAL
<replaceable>interval</replaceable>] ...
| EVERY <replaceable>interval</replaceable>
- [STARTS <replaceable>timestamp</replaceable> [+ INTERVAL interval]]
- [ENDS <replaceable>timestamp</replaceable> [+ INTERVAL interval]]
+ [STARTS <replaceable>timestamp</replaceable> [+ INTERVAL interval] ...]
+ [ENDS <replaceable>timestamp</replaceable> [+ INTERVAL interval] ...]
<replaceable>interval</replaceable>:
<replaceable>quantity</replaceable> {YEAR | QUARTER | MONTH | DAY | HOUR
| MINUTE |
@@ -852,8 +851,8 @@
<para>
If no schema is indicated as part of
- <replaceable>event_name</replaceable>, then the default
- (current) schema is assumed.
+ <replaceable>event_name</replaceable>, the default (current)
+ schema is assumed.
</para>
<remark role="help-description-end"/>
@@ -884,9 +883,9 @@
</para>
<para>
- <literal>IF NOT EXISTS</literal> functions in the same fashion
- with <literal>CREATE EVENT</literal> as it does when used with a
- <literal>CREATE TABLE</literal> statement; if an event named
+ <literal>IF NOT EXISTS</literal> has the same meaning for
+ <literal>CREATE EVENT</literal> as for <literal>CREATE
+ TABLE</literal>: If an event named
<replaceable>event_name</replaceable> already exists in the same
schema, no action is taken, and no error results. (However, a
warning is generated in such cases.)
@@ -905,11 +904,11 @@
<para>
<literal>AT
<replaceable>timestamp</replaceable></literal>
is used for a one-time event. It specifies that the event
- executes one time only at the date and time, given as the
+ executes one time only at the date and time given by
<replaceable>timestamp</replaceable>, which must include
both the date and time, or must be an expression that
- resolves to a datetime value. You may use a value which is
- of either the <literal>DATETIME</literal> or
+ resolves to a datetime value. You may use a value of either
+ the <literal>DATETIME</literal> or
<literal>TIMESTAMP</literal> type for this purpose. If the
date is in the past, a warning occurs, as shown here:
</para>
@@ -951,11 +950,10 @@
</para>
<para>
- In order to create an event which occurs at some point in
- the future relative to the current date and time —
- such as that expressed by the phrase <quote>three weeks from
- now</quote> — you can use the optional clause
- <literal>+ INTERVAL
+ To create an event which occurs at some point in the future
+ relative to the current date and time — such as that
+ expressed by the phrase <quote>three weeks from now</quote>
+ — you can use the optional clause <literal>+ INTERVAL
<replaceable>interval</replaceable></literal>. The
<replaceable>interval</replaceable> portion consists of two
parts, a quantity and a unit of time, and follows the same
@@ -963,14 +961,13 @@
<function role="sql">DATE_ADD()</function> function (see
<xref linkend="date-and-time-functions"/>. The units
keywords are also the same, except that you cannot use any
- units involving microseconds when defining an event.
+ units involving microseconds when defining an event. With
+ some interval types, complex time units may be used. For
+ example, <quote>two minutes and ten seconds</quote> can be
+ expressed as <literal>+ INTERVAL '2:10'
+ MINUTE_SECOND</literal>.
</para>
- <remark role="note">
- The following does not produce a syntax error, so if it is
- wrong, then it should do so.
- </remark>
-
<para>
You can also combine intervals. For example, <literal>AT
CURRENT_TIMESTAMP + INTERVAL 3 WEEK + INTERVAL 2
@@ -982,8 +979,8 @@
<listitem>
<para>
- For actions which are to be repeated at a regular interval,
- you can use an <literal>EVERY</literal> clause. The
+ To repeat actions at a regular interval, use an
+ <literal>EVERY</literal> clause. The
<literal>EVERY</literal> keyword is followed by an
<replaceable>interval</replaceable> as described in the
previous dicussion of the <literal>AT</literal> keyword.
@@ -994,12 +991,10 @@
</para>
<para>
- It is not possible to combine <literal>+ INTERVAL</literal>
- clauses in a single <literal>EVERY</literal> clause;
- however, you can use the same complex time units allowed in
- a <literal>+ INTERVAL</literal>. For example, <quote>every
- two minutes and ten seconds</quote> can be expressed as
- <literal>EVERY '2:10' MINUTE_SECOND</literal>.
+ Although <literal>+ INTERVAL</literal> clauses are not
+ allowed in an <literal>EVERY</literal> clause, you can use
+ the same complex time units allowed in a <literal>+
+ INTERVAL</literal>.
</para>
<para>
@@ -1159,27 +1154,27 @@
<note>
<para>
- The <literal>SHOW</literal> statement and
- <literal>SELECT</literal> statements that merely return a
- result set have no effect when used in an event; the output
- from these is not sent to the MySQL Monitor, nor is it stored
- anywhere. However, you can use statements such as
- <literal>SELECT INTO</literal> and <literal>INSERT ...
- SELECT</literal> that store a result. (See the next example in
- this section for an instance of the latter.)
+ Statements such as <literal>SELECT</literal> or
+ <literal>SHOW</literal> that merely return a result set have
+ no effect when used in an event; the output from these is not
+ sent to the MySQL Monitor, nor is it stored anywhere. However,
+ you can use statements such as <literal>SELECT ...
+ INTO</literal> and <literal>INSERT INTO ... SELECT</literal>
+ that store a result. (See the next example in this section for
+ an instance of the latter.)
</para>
</note>
<para>
- Any reference in the <literal>DO</literal> clause to a table in
- other than the same database schema to which the event belongs
- must be qualified with the name of the schema in which the table
- occurs.
+ The schema to which an event belongs is the default schema for
+ table references in the <literal>DO</literal> clause. Any
+ references to tables in other schemas must be qualified with the
+ proper schema name.
</para>
<para>
- As with stored routines, you can use multiple statements in the
- <literal>DO</literal> clause by bracketing them with the
+ As with stored routines, you can use compound-statement syntax
+ in the <literal>DO</literal> clause by using the
<literal>BEGIN</literal> and <literal>END</literal>
keywords, as
shown here:
</para>
@@ -1203,7 +1198,7 @@
</programlisting>
<para>
- Note the use of the <literal>DELIMITER</literal> statement to
+ Note the use of the <literal>DELIMITER</literal> command to
change the statement delimiter, as with stored routines. See
<xref linkend="create-procedure"/>.
</para>
@@ -1447,8 +1442,8 @@
<para>
To enable or disable the execution of scheduled events, it is
necessary to set the value of the global
- <literal>event_scheduler</literal> variable. This requires the
- <literal>SUPER</literal> privilege.
+ <literal>event_scheduler</literal> system variable. This requires
+ the <literal>SUPER</literal> privilege.
</para>
<para>
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r10692 - in trunk: . it/refman-5.1 pt/refman-5.1 refman-5.1 refman-6.0 | paul | 8 May 2008 |