Author: paul
Date: 2005-12-08 15:59:46 +0100 (Thu, 08 Dec 2005)
New Revision: 523
Log:
r4612@frost: paul | 2005-12-08 08:34:07 -0600
Describe changes resulting from WL#2984 (treat SP-vars according
to standard SQL)
Modified:
trunk/
trunk/refman-5.0/stored-procedures.xml
trunk/refman-5.1/stored-procedures.xml
trunk/refman-common/news-5.0.xml
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:4610
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:1505
+ b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:4612
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:1505
Modified: trunk/refman-5.0/stored-procedures.xml
===================================================================
--- trunk/refman-5.0/stored-procedures.xml 2005-12-08 05:28:20 UTC (rev 522)
+++ trunk/refman-5.0/stored-procedures.xml 2005-12-08 14:59:46 UTC (rev 523)
@@ -254,10 +254,10 @@
RETURNS <replaceable>type</replaceable>
[<replaceable>characteristic</replaceable> ...] <replaceable>routine_body</replaceable>
- <replaceable>proc_parameter</replaceable>:
+<replaceable>proc_parameter</replaceable>:
[ IN | OUT | INOUT ] <replaceable>param_name</replaceable> <replaceable>type</replaceable>
- <replaceable>func_parameter</replaceable>:
+<replaceable>func_parameter</replaceable>:
<replaceable>param_name</replaceable> <replaceable>type</replaceable>
<replaceable>type</replaceable>:
@@ -328,8 +328,8 @@
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.
+ function body must contain a <literal>RETURN
+ <replaceable>value</replaceable></literal> statement.
</para>
<para>
@@ -433,6 +433,53 @@
</para>
<para>
+ As of MySQL 5.0.18, the server uses the data type of a routine
+ parameter or function return value as follows. These rules also
+ apply to local routine variables created with the
+ <literal>DECLARE</literal> statement
+ (<xref linkend="declare-local-variables"/>).
+ </para>
+
+ <itemizedlist>
+
+ <listitem>
+ <para>
+ Assignments are checked for data type mismatches and
+ overflow. Conversion and overflow problems result in
+ warnings, or errors in strict mode.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ For character data types, if there is a <literal>CHARACTER
+ SET</literal> clause in the declaration, the specified
+ character set and its default collation are used. If there
+ is no such clause, the database character set and collation
+ are used. (These are given by the values of the
+ <literal>character_set_database</literal> and
+ <literal>collation_database</literal> system variables.)
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Only scalar values can be assigned to parameters or
+ variables. For example, a statement such as <literal>SET x =
+ (SELECT 1, 2)</literal> is invalid.
+ </para>
+ </listitem>
+
+ </itemizedlist>
+
+ <para>
+ Before MySQL 5.0.18, parameters, return values, and local
+ variables are treated as items in expressions, and are subject
+ to automatic (silent) conversion and truncation. Stored
+ functions ignore the <literal>sql_mode</literal> setting.
+ </para>
+
+ <para>
The <literal>COMMENT</literal> clause is a MySQL extension, and
may be used to describe the stored procedure. This information
is displayed by the <literal>SHOW CREATE PROCEDURE</literal> and
@@ -951,6 +998,12 @@
</para>
<para>
+ Local variables are treated like routine parameters with
+ respect to data type and overflow checking. See
+ <xref linkend="create-procedure"/>.
+ </para>
+
+ <para>
The scope of a local variable is within the <literal>BEGIN ...
END</literal> block where it is declared. It can be used in
nested blocks except those that declare a variable with the
Modified: trunk/refman-5.1/stored-procedures.xml
===================================================================
--- trunk/refman-5.1/stored-procedures.xml 2005-12-08 05:28:20 UTC (rev 522)
+++ trunk/refman-5.1/stored-procedures.xml 2005-12-08 14:59:46 UTC (rev 523)
@@ -246,10 +246,10 @@
RETURNS <replaceable>type</replaceable>
[<replaceable>characteristic</replaceable> ...] <replaceable>routine_body</replaceable>
- <replaceable>proc_parameter</replaceable>:
+<replaceable>proc_parameter</replaceable>:
[ IN | OUT | INOUT ] <replaceable>param_name</replaceable> <replaceable>type</replaceable>
- <replaceable>func_parameter</replaceable>:
+<replaceable>func_parameter</replaceable>:
<replaceable>param_name</replaceable> <replaceable>type</replaceable>
<replaceable>type</replaceable>:
@@ -320,8 +320,8 @@
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.
+ function body must contain a <literal>RETURN
+ <replaceable>value</replaceable></literal> statement.
</para>
<para>
@@ -425,6 +425,45 @@
</para>
<para>
+ The server uses the data type of a routine parameter or function
+ return value as follows. These rules also apply to local routine
+ variables created with the <literal>DECLARE</literal> statement
+ (<xref linkend="declare-local-variables"/>).
+ </para>
+
+ <itemizedlist>
+
+ <listitem>
+ <para>
+ Assignments are checked for data type mismatches and
+ overflow. Conversion and overflow problems result in
+ warnings, or errors in strict mode.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ For character data types, if there is a <literal>CHARACTER
+ SET</literal> clause in the declaration, the specified
+ character set and its default collation are used. If there
+ is no such clause, the database character set and collation
+ are used. (These are given by the values of the
+ <literal>character_set_database</literal> and
+ <literal>collation_database</literal> system variables.)
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Only scalar values can be assigned to parameters or
+ variables. For example, a statement such as <literal>SET x =
+ (SELECT 1, 2)</literal> is invalid.
+ </para>
+ </listitem>
+
+ </itemizedlist>
+
+ <para>
The <literal>COMMENT</literal> clause is a MySQL extension, and
may be used to describe the stored procedure. This information
is displayed by the <literal>SHOW CREATE PROCEDURE</literal> and
@@ -932,6 +971,12 @@
</para>
<para>
+ Local variables are treated like routine parameters with
+ respect to data type and overflow checking. See
+ <xref linkend="create-procedure"/>.
+ </para>
+
+ <para>
The scope of a local variable is within the <literal>BEGIN ...
END</literal> block where it is declared. It can be used in
nested blocks except those that declare a variable with the
Modified: trunk/refman-common/news-5.0.xml
===================================================================
--- trunk/refman-common/news-5.0.xml 2005-12-08 05:28:20 UTC (rev 522)
+++ trunk/refman-common/news-5.0.xml 2005-12-08 14:59:46 UTC (rev 523)
@@ -175,27 +175,39 @@
Functionality added or changed:
</para>
- <remark>
- ADD AN ITEMIZED LIST WHEN WE HAVE SOME ITEMS THAT GO HERE
- </remark>
-
- <para>
- Bugs fixed:
- </para>
-
<itemizedlist>
<listitem>
<para>
- The data types of stored routine parameters and variables were
- not always being used to control data handling. (Bug #8702,
- Bug #8768, Bug #8769, Bug #9078, Bug #9572, Bug #12903, Bug
- #13705, Bug #13808, Bug #13909, Bug #14161, Bug #15148)
+ The server treats stored routine parameters and local
+ variables (and stored function return values) according to
+ standard SQL. Previously, parameters, variables, and return
+ values were treated as items in expressions and were subject
+ to automatic (silent) conversion and truncation. Now the data
+ type is observed. Data type conversion and overflow problems
+ that occur in assignments result in warnings, or errors in
+ strict mode. The <literal>CHARACTER SET</literal> clause for
+ character data type declarations is used. Parameters,
+ variables, and return values must be scalars; it is no longer
+ possible to assign a row value. Also, stored functions execute
+ using the <literal>sql_mode</literal> value in force at
+ function creation time rather than ignoring it. For more
+ information, see <xref linkend="create-procedure"/>. (Bug
+ #8702, Bug #8768, Bug #8769, Bug #9078, Bug #9572, Bug #12903,
+ Bug #13705, Bug #13808, Bug #13909, Bug #14161, Bug #15148)
</para>
</listitem>
</itemizedlist>
+ <para>
+ Bugs fixed:
+ </para>
+
+ <remark>
+ ADD AN ITEMIZED LIST WHEN WE HAVE SOME ITEMS THAT GO HERE
+ </remark>
+
</section>
<section id="news-5-0-17">
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r523 - in trunk: . refman-5.0 refman-5.1 refman-common | paul | 8 Dec |