Below is the list of changes that have just been committed into a local
mysqldoc repository of jon. When jon 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://www.mysql.com/doc/I/n/Installing_source_tree.html
ChangeSet
1.3239 05/08/11 11:28:37 jon@stripped +3 -0
Stored Procedures chapter: Fixes to
syntax definitions (a stored function
parameter is IN by default, and cannot
be specified as IN|OUT|INOUT).
Sync refman-5.0 and refman-5.1.
refman/stored-procedures.xml
1.12 05/08/11 11:28:35 jon@stripped +30 -19
Fixes to stored routine definitions
(a stored function parameter is IN
by default, and cannot be specified
as IN|OUT|INOUT)
refman-5.1/stored-procedures.xml
1.3 05/08/11 11:28:35 jon@stripped +38 -27
Sync.
refman-5.0/stored-procedures.xml
1.3 05/08/11 11:28:35 jon@stripped +36 -25
Sync.
# 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: jon
# Host: gigan.
# Root: /home/jon/bk/mysqldoc
--- 1.2/refman-5.1/stored-procedures.xml 2005-08-09 12:53:07 +10:00
+++ 1.3/refman-5.1/stored-procedures.xml 2005-08-11 11:28:35 +10:00
@@ -232,17 +232,20 @@
<indexterm type="function">
<primary>CREATE FUNCTION</primary>
</indexterm>
-
-<programlisting>
-CREATE PROCEDURE <replaceable>sp_name</replaceable>
([<replaceable>parameter</replaceable>[,...]])
+
+ <programlisting>
+CREATE PROCEDURE <replaceable>sp_name</replaceable>
([<replaceable>proc_parameter</replaceable>[,...]])
[<replaceable>characteristic</replaceable> ...]
<replaceable>routine_body</replaceable>
-CREATE FUNCTION <replaceable>sp_name</replaceable>
([<replaceable>parameter</replaceable>[,...]])
+CREATE FUNCTION <replaceable>sp_name</replaceable>
([<replaceable>func_parameter</replaceable>[,...]])
RETURNS <replaceable>type</replaceable>
[<replaceable>characteristic</replaceable> ...]
<replaceable>routine_body</replaceable>
-
-<replaceable>parameter</replaceable>:
+
+ <replaceable>proc_parameter</replaceable>:
[ IN | OUT | INOUT ] <replaceable>param_name</replaceable>
<replaceable>type</replaceable>
+
+ <replaceable>func_parameter</replaceable>:
+ <replaceable>param_name</replaceable>
<replaceable>type</replaceable>
<replaceable>type</replaceable>:
<replaceable>Any valid MySQL data type</replaceable>
@@ -256,56 +259,64 @@
<replaceable>routine_body</replaceable>:
<replaceable>Valid SQL procedure statements or statements</replaceable>
-</programlisting>
-
+ </programlisting>
+
<para>
- These statements create a stored routine. As of MySQL 5.0.3, to
- create a routine, it is necessary to have the <literal>CREATE
- ROUTINE</literal> privilege for it, and the <literal>ALTER
+ These statements create stored routines. To create a routine in
+ MySQL 5.1, it is necessary to have the <literal>CREATE
+ ROUTINE</literal> privilege, and the <literal>ALTER
ROUTINE</literal> and <literal>EXECUTE</literal> privileges are
granted automatically to its creator. If binary logging is
enabled, you may also need the <literal>SUPER</literal>
privilege, as described in
<xref linkend="stored-procedure-logging"/>.
</para>
-
+
<para>
By default, the routine is associated with the current database.
To associate the routine explicitly with a given database,
specify the name as <replaceable>db_name.sp_name</replaceable>
when you create it.
</para>
-
+
<para>
If the routine name is the same as the name of a built-in SQL
function, you need to use a space between the name and the
following parenthesis when defining the routine, or a syntax
error occurs. This is also true when you invoke the routine
- later.
+ later. For this reason — even though it is possible to do
+ so — we suggest that it is better to avoid re-using the
+ names of existing SQL functions for your own stored routines.
</para>
-
- <para>
- The <literal>RETURNS</literal> clause may be specified only for
- a <literal>FUNCTION</literal>, for which it is mandatory. It is
- used to indicate the return type of the function, and the
- function body must contain a <literal>RETURN value</literal>
- statement.
- </para>
-
+
<para>
The parameter list enclosed within parentheses must always be
present. If there are no parameters, an empty parameter list of
<literal>()</literal> should be used. Each parameter is an
<literal>IN</literal> parameter by default. To specify otherwise
for a parameter, use the keyword <literal>OUT</literal> or
- <literal>INOUT</literal> before the parameter name. Specifying
+ <literal>INOUT</literal> before the parameter name.
+ </para>
+
+ <para>
+ <emphasis role="bold">Note</emphasis>: Specifying a parameter as
<literal>IN</literal>, <literal>OUT</literal>, or
- <literal>INOUT</literal> is only valid for a
- <literal>PROCEDURE</literal>.
+ <literal>INOUT</literal> is valid only for a
+ <literal>PROCEDURE</literal>.
(<literal>FUNCTION</literal>
+ parameters are always regarded as <literal>IN</literal>
+ parameters.)
+ </para>
+
+ <para>
+ The <literal>RETURNS</literal> clause may be specified only for
+ a <literal>FUNCTION</literal>, for which it is mandatory. It is
+ used to indicate the return type of the function, and the
+ function body must contain a <literal>RETURN value</literal>
+ statement.
</para>
<para>
- The <literal>CREATE FUNCTION</literal> statement is used in
+ The <literal>CREATE FUNCTION</literal> statement was used in
earlier versions of MySQL to support UDFs (User Defined
Functions). See <xref linkend="adding-functions"/>. UDFs
continue to be supported, even with the existence of stored
--- 1.11/refman/stored-procedures.xml 2005-08-09 12:53:17 +10:00
+++ 1.12/refman/stored-procedures.xml 2005-08-11 11:28:35 +10:00
@@ -234,15 +234,18 @@
</indexterm>
<programlisting>
-CREATE PROCEDURE <replaceable>sp_name</replaceable>
([<replaceable>parameter</replaceable>[,...]])
+CREATE PROCEDURE <replaceable>sp_name</replaceable>
([<replaceable>proc_parameter</replaceable>[,...]])
[<replaceable>characteristic</replaceable> ...]
<replaceable>routine_body</replaceable>
-CREATE FUNCTION <replaceable>sp_name</replaceable>
([<replaceable>parameter</replaceable>[,...]])
+CREATE FUNCTION <replaceable>sp_name</replaceable>
([<replaceable>func_parameter</replaceable>[,...]])
RETURNS <replaceable>type</replaceable>
[<replaceable>characteristic</replaceable> ...]
<replaceable>routine_body</replaceable>
-
-<replaceable>parameter</replaceable>:
+
+ <replaceable>proc_parameter</replaceable>:
[ IN | OUT | INOUT ] <replaceable>param_name</replaceable>
<replaceable>type</replaceable>
+
+ <replaceable>func_parameter</replaceable>:
+ <replaceable>param_name</replaceable>
<replaceable>type</replaceable>
<replaceable>type</replaceable>:
<replaceable>Any valid MySQL data type</replaceable>
@@ -259,9 +262,9 @@
</programlisting>
<para>
- These statements create a stored routine. As of MySQL 5.0.3, to
+ These statements create stored routines. As of MySQL 5.0.3, to
create a routine, it is necessary to have the <literal>CREATE
- ROUTINE</literal> privilege for it, and the <literal>ALTER
+ ROUTINE</literal> privilege, and the <literal>ALTER
ROUTINE</literal> and <literal>EXECUTE</literal> privileges are
granted automatically to its creator. If binary logging is
enabled, you may also need the <literal>SUPER</literal>
@@ -281,27 +284,35 @@
function, you need to use a space between the name and the
following parenthesis when defining the routine, or a syntax
error occurs. This is also true when you invoke the routine
- later.
- </para>
-
- <para>
- The <literal>RETURNS</literal> clause may be specified only for
- a <literal>FUNCTION</literal>, for which it is mandatory. It is
- used to indicate the return type of the function, and the
- function body must contain a <literal>RETURN value</literal>
- statement.
+ later. For this reason — even though it is possible to do
+ so — we suggest that it is better to avoid re-using the
+ names of existing SQL functions for your own stored routines.
</para>
-
+
<para>
The parameter list enclosed within parentheses must always be
present. If there are no parameters, an empty parameter list of
<literal>()</literal> should be used. Each parameter is an
<literal>IN</literal> parameter by default. To specify otherwise
for a parameter, use the keyword <literal>OUT</literal> or
- <literal>INOUT</literal> before the parameter name. Specifying
+ <literal>INOUT</literal> before the parameter name.
+ </para>
+
+ <para>
+ <emphasis role="bold">Note</emphasis>: Specifying a parameter as
<literal>IN</literal>, <literal>OUT</literal>, or
- <literal>INOUT</literal> is only valid for a
- <literal>PROCEDURE</literal>.
+ <literal>INOUT</literal> is valid only for a
+ <literal>PROCEDURE</literal>.
(<literal>FUNCTION</literal>
+ parameters are always regarded as <literal>IN</literal>
+ parameters.)
+ </para>
+
+ <para>
+ The <literal>RETURNS</literal> clause may be specified only for
+ a <literal>FUNCTION</literal>, for which it is mandatory. It is
+ used to indicate the return type of the function, and the
+ function body must contain a <literal>RETURN value</literal>
+ statement.
</para>
<para>
--- 1.2/refman-5.0/stored-procedures.xml 2005-08-09 12:53:02 +10:00
+++ 1.3/refman-5.0/stored-procedures.xml 2005-08-11 11:28:35 +10:00
@@ -232,17 +232,20 @@
<indexterm type="function">
<primary>CREATE FUNCTION</primary>
</indexterm>
-
-<programlisting>
-CREATE PROCEDURE <replaceable>sp_name</replaceable>
([<replaceable>parameter</replaceable>[,...]])
+
+ <programlisting>
+CREATE PROCEDURE <replaceable>sp_name</replaceable>
([<replaceable>proc_parameter</replaceable>[,...]])
[<replaceable>characteristic</replaceable> ...]
<replaceable>routine_body</replaceable>
-CREATE FUNCTION <replaceable>sp_name</replaceable>
([<replaceable>parameter</replaceable>[,...]])
+CREATE FUNCTION <replaceable>sp_name</replaceable>
([<replaceable>func_parameter</replaceable>[,...]])
RETURNS <replaceable>type</replaceable>
[<replaceable>characteristic</replaceable> ...]
<replaceable>routine_body</replaceable>
-
-<replaceable>parameter</replaceable>:
+
+ <replaceable>proc_parameter</replaceable>:
[ IN | OUT | INOUT ] <replaceable>param_name</replaceable>
<replaceable>type</replaceable>
+
+ <replaceable>func_parameter</replaceable>:
+ <replaceable>param_name</replaceable>
<replaceable>type</replaceable>
<replaceable>type</replaceable>:
<replaceable>Any valid MySQL data type</replaceable>
@@ -256,52 +259,60 @@
<replaceable>routine_body</replaceable>:
<replaceable>Valid SQL procedure statements or statements</replaceable>
-</programlisting>
-
+ </programlisting>
+
<para>
- These statements create a stored routine. As of MySQL 5.0.3, to
+ These statements create stored routines. As of MySQL 5.0.3, to
create a routine, it is necessary to have the <literal>CREATE
- ROUTINE</literal> privilege for it, and the <literal>ALTER
+ ROUTINE</literal> privilege, and the <literal>ALTER
ROUTINE</literal> and <literal>EXECUTE</literal> privileges are
granted automatically to its creator. If binary logging is
enabled, you may also need the <literal>SUPER</literal>
privilege, as described in
<xref linkend="stored-procedure-logging"/>.
</para>
-
+
<para>
By default, the routine is associated with the current database.
To associate the routine explicitly with a given database,
specify the name as <replaceable>db_name.sp_name</replaceable>
when you create it.
</para>
-
+
<para>
If the routine name is the same as the name of a built-in SQL
function, you need to use a space between the name and the
following parenthesis when defining the routine, or a syntax
error occurs. This is also true when you invoke the routine
- later.
+ later. For this reason — even though it is possible to do
+ so — we suggest that it is better to avoid re-using the
+ names of existing SQL functions for your own stored routines.
</para>
-
- <para>
- The <literal>RETURNS</literal> clause may be specified only for
- a <literal>FUNCTION</literal>, for which it is mandatory. It is
- used to indicate the return type of the function, and the
- function body must contain a <literal>RETURN value</literal>
- statement.
- </para>
-
+
<para>
The parameter list enclosed within parentheses must always be
present. If there are no parameters, an empty parameter list of
<literal>()</literal> should be used. Each parameter is an
<literal>IN</literal> parameter by default. To specify otherwise
for a parameter, use the keyword <literal>OUT</literal> or
- <literal>INOUT</literal> before the parameter name. Specifying
+ <literal>INOUT</literal> before the parameter name.
+ </para>
+
+ <para>
+ <emphasis role="bold">Note</emphasis>: Specifying a parameter as
<literal>IN</literal>, <literal>OUT</literal>, or
- <literal>INOUT</literal> is only valid for a
- <literal>PROCEDURE</literal>.
+ <literal>INOUT</literal> is valid only for a
+ <literal>PROCEDURE</literal>.
(<literal>FUNCTION</literal>
+ parameters are always regarded as <literal>IN</literal>
+ parameters.)
+ </para>
+
+ <para>
+ The <literal>RETURNS</literal> clause may be specified only for
+ a <literal>FUNCTION</literal>, for which it is mandatory. It is
+ used to indicate the return type of the function, and the
+ function body must contain a <literal>RETURN value</literal>
+ statement.
</para>
<para>
| Thread |
|---|
| • bk commit - mysqldoc@docsrva tree (jon:1.3239) | jon | 11 Aug |