From: Date: January 10 2007 6:12pm Subject: svn commit - mysqldoc@docsrva: r4437 - in trunk: . refman-5.0 refman-5.1 List-Archive: http://lists.mysql.com/commits/17866 Message-Id: <200701101712.l0AHCZgh029741@docsrva.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Author: paul Date: 2007-01-10 18:12:16 +0100 (Wed, 10 Jan 2007) New Revision: 4437 Log: r14371@frost: paul | 2007-01-10 09:50:56 -0600 Document SHOW PROCEDURE/FUNCTION CODE. (WL#3563) Modified: trunk/refman-5.0/news-5.0.xml trunk/refman-5.0/sql-syntax.xml trunk/refman-5.1/news-5.1.xml trunk/refman-5.1/sql-syntax.xml Property changes on: trunk ___________________________________________________________________ Name: svk:merge - 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:17897 7d8d2c4e-af1d-0410-ab9f-b038ce55645b:/mysqldoc-local/mysqldoc:14282 b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:14218 bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:13015 + 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:17897 7d8d2c4e-af1d-0410-ab9f-b038ce55645b:/mysqldoc-local/mysqldoc:14371 b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:14218 bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:13015 Modified: trunk/refman-5.0/news-5.0.xml =================================================================== --- trunk/refman-5.0/news-5.0.xml 2007-01-10 16:08:11 UTC (rev 4436) +++ trunk/refman-5.0/news-5.0.xml 2007-01-10 17:12:16 UTC (rev 4437) Changed blocks: 1, Lines Added: 9, Lines Deleted: 0; 657 bytes @@ -7831,6 +7831,15 @@ + + + Added the SHOW FUNCTION CODE and + SHOW PROCEDURE CODE statements (available + only for servers that have been built with debugging support). + See . + + + Modified: trunk/refman-5.0/sql-syntax.xml =================================================================== --- trunk/refman-5.0/sql-syntax.xml 2007-01-10 16:08:11 UTC (rev 4436) +++ trunk/refman-5.0/sql-syntax.xml 2007-01-10 17:12:16 UTC (rev 4437) Changed blocks: 8, Lines Added: 116, Lines Deleted: 8; 7411 bytes @@ -9281,8 +9281,8 @@ Subqueries in the FROM clause can return a scalar, column, row, or table. Subqueries in the FROM clause cannot be correlated - subqueries, unless used within the ON clause of a - JOIN operation. + subqueries, unless used within the ON + clause of a JOIN operation. @@ -10817,13 +10817,13 @@ is standard SQL syntax and is the recommended way to start an ad-hoc transaction. - + Important: Many APIs used for writing MySQL client applications (such as JDBC) provide their own methods for starting transactions that can (and sometimes should) be used instead of sending a START - TRANSACTION statement from the client. See + TRANSACTION statement from the client. See , or the documentation for your API, for more information. @@ -15803,6 +15803,10 @@ + SHOW FUNCTION CODE + + + SHOW FUNCTION STATUS @@ -15835,6 +15839,10 @@ + SHOW PROCEDURE CODE + + + SHOW PROCEDURE STATUS @@ -15901,10 +15909,12 @@ SHOW ENGINE engine_name {LOGS | STATUS } SHOW [STORAGE] ENGINES SHOW ERRORS [LIMIT [offset,] row_count] +SHOW FUNCTION CODE sp_name SHOW FUNCTION STATUS [LIKE 'pattern'] SHOW GRANTS FOR user SHOW INDEX FROM tbl_name [FROM db_name] SHOW INNODB STATUS +SHOW PROCEDURE CODE sp_name SHOW PROCEDURE STATUS [LIKE 'pattern'] SHOW [BDB] LOGS SHOW MUTEX STATUS @@ -16254,9 +16264,12 @@ - This statement is a MySQL extension. Similar to SHOW - CREATE TABLE, it returns the exact string that can - be used to re-create the named routine. + These statements are MySQL extensions. Similar to + SHOW CREATE TABLE, they return the exact + string that can be used to re-create the named routine. The + statements require that you be the owner of the routine or + have SELECT access to the + mysql.proc table. @@ -17478,6 +17491,101 @@ +
+ + <literal>SHOW PROCEDURE CODE</literal> and <literal>SHOW FUNCTION + CODE</literal> Syntax + + + SHOW PROCEDURE CODE + + + + SHOW FUNCTION CODE + + + + + + SHOW PROCEDURE FUNCTION CODE + + + + + +SHOW {PROCEDURE | FUNCTION} CODE sp_name + + + + + + These statements are MySQL extensions that are available only + for servers that have been built with debugging support. They + display a representation of the internal implementation of the + named routine. The statements require that you be the owner of + the routine or have SELECT access to the + mysql.proc table. + + + + If the named routine is available, each statement produces a + result set. Each row in the result set corresponds to one + instruction in the routine. The first column is + Pos, which is an ordinal number beginning + with 0. The second column is Instruction, + which contains an SQL statement (usually changed from the + original source), or a directive which has meaning only to the + stored-routine handler. + + + + + + + +mysql> DELIMITER // +mysql> CREATE PROCEDURE p1 () + -> BEGIN + -> DECLARE fanta INT DEFAULT 55; + -> DROP TABLE t2; + -> LOOP + -> INSERT INTO t3 VALUES (fanta); + -> END LOOP; + -> END// +Query OK, 0 rows affected (0.00 sec) + +mysql> SHOW PROCEDURE CODE p1// ++-----+----------------------------------------+ +| Pos | Instruction | ++-----+----------------------------------------+ +| 0 | set fanta@0 55 | +| 1 | stmt 9 "DROP TABLE t2" | +| 2 | stmt 5 "INSERT INTO t3 VALUES (fanta)" | +| 3 | jump 2 | ++-----+----------------------------------------+ +4 rows in set (0.00 sec) + + + + In this example, the non-executable BEGIN + and END statements have disappeared, and + for the DECLARE + variable_name statement, + only the executable part appears (the part where the default + is assigned). For each statement that is taken from source, + there is a code word stmt followed by a + type (9 means DROP, 5 means + INSERT, and so on). The final row contains + an instruction jump 2, meaning + GOTO instruction #2. + + + + These statements were added in MySQL 5.0.17. + + +
+
<literal>SHOW PROCEDURE STATUS</literal> and <literal>SHOW FUNCTION @@ -17506,7 +17614,7 @@ <remark role="help-description-begin"/> <para> - This statement is a MySQL extension. It returns + These statements are MySQL extensions. They return characteristics of routines, such as the database, name, type, creator, and creation and modification dates. If no pattern is specified, the information for all stored procedures or all Modified: trunk/refman-5.1/news-5.1.xml =================================================================== --- trunk/refman-5.1/news-5.1.xml 2007-01-10 16:08:11 UTC (rev 4436) +++ trunk/refman-5.1/news-5.1.xml 2007-01-10 17:12:16 UTC (rev 4437) Changed blocks: 1, Lines Added: 9, Lines Deleted: 0; 659 bytes @@ -13561,6 +13561,15 @@ </para> </listitem> + <listitem> + <para> + Added the <literal>SHOW FUNCTION CODE</literal> and + <literal>SHOW PROCEDURE CODE</literal> statements (available + only for servers that have been built with debugging support). + See <xref linkend="show-procedure-code"/>. + </para> + </listitem> + </itemizedlist> <para> Modified: trunk/refman-5.1/sql-syntax.xml =================================================================== --- trunk/refman-5.1/sql-syntax.xml 2007-01-10 16:08:11 UTC (rev 4436) +++ trunk/refman-5.1/sql-syntax.xml 2007-01-10 17:12:16 UTC (rev 4437) Changed blocks: 10, Lines Added: 121, Lines Deleted: 13; 8453 bytes @@ -10655,8 +10655,8 @@ Subqueries in the <literal>FROM</literal> clause can return a scalar, column, row, or table. Subqueries in the <literal>FROM</literal> clause cannot be correlated - subqueries, unless used within the <literal>ON</literal> clause of a - <literal>JOIN</literal> operation. + subqueries, unless used within the <literal>ON</literal> + clause of a <literal>JOIN</literal> operation. </para> <para> @@ -12174,13 +12174,13 @@ is standard SQL syntax and is the recommended way to start an ad-hoc transaction. </para> - + <para> <emphasis role="bold">Important</emphasis>: Many APIs used for writing MySQL client applications (such as JDBC) provide their own methods for starting transactions that can (and sometimes should) be used instead of sending a <literal>START - TRANSACTION</literal> statement from the client. See + TRANSACTION</literal> statement from the client. See <xref linkend="apis"/>, or the documentation for your API, for more information. </para> @@ -12216,7 +12216,7 @@ consistent snapshot only if the current isolation level is one that allows consistent read (<literal>REPEATABLE READ</literal> or <literal>SERIALIZABLE</literal>). - </para> + </para> <para> Beginning a transaction causes any pending transaction to be @@ -12354,10 +12354,10 @@ FUNCTION</literal>, <literal>DROP INDEX</literal>, <literal>DROP PROCEDURE</literal>, <literal>DROP TABLE</literal>, <literal>LOAD DATA INFILE</literal> - <literal>LOCK TABLES</literal>, <literal>RENAME TABLE</literal>, - <literal>SET AUTOCOMMIT=1</literal>, <literal>START - TRANSACTION</literal>, <literal>TRUNCATE TABLE</literal>, - <literal>UNLOCK TABLES</literal>. + <literal>LOCK TABLES</literal>, <literal>RENAME + TABLE</literal>, <literal>SET AUTOCOMMIT=1</literal>, + <literal>START TRANSACTION</literal>, <literal>TRUNCATE + TABLE</literal>, <literal>UNLOCK TABLES</literal>. </para> </listitem> @@ -17098,6 +17098,10 @@ </indexterm> <indexterm> + <primary>SHOW FUNCTION CODE</primary> + </indexterm> + + <indexterm> <primary>SHOW FUNCTION STATUS</primary> </indexterm> @@ -17130,6 +17134,10 @@ </indexterm> <indexterm> + <primary>SHOW PROCEDURE CODE</primary> + </indexterm> + + <indexterm> <primary>SHOW PROCEDURE STATUS</primary> </indexterm> @@ -17208,10 +17216,12 @@ SHOW [STORAGE] ENGINES SHOW ERRORS [LIMIT [<replaceable>offset</replaceable>,] <replaceable>row_count</replaceable>] SHOW [FULL] EVENTS +SHOW FUNCTION CODE <replaceable>sp_name</replaceable> SHOW FUNCTION STATUS [LIKE '<replaceable>pattern</replaceable>'] SHOW GRANTS FOR <replaceable>user</replaceable> SHOW INDEX FROM <replaceable>tbl_name</replaceable> [FROM <replaceable>db_name</replaceable>] SHOW INNODB STATUS +SHOW PROCEDURE CODE <replaceable>sp_name</replaceable> SHOW PROCEDURE STATUS [LIKE '<replaceable>pattern</replaceable>'] SHOW PLUGINS SHOW PRIVILEGES @@ -17691,9 +17701,12 @@ <remark role="help-description-begin"/> <para> - This statement is a MySQL extension. Similar to <literal>SHOW - CREATE TABLE</literal>, it returns the exact string that can - be used to re-create the named routine. + These statements are MySQL extensions. Similar to + <literal>SHOW CREATE TABLE</literal>, they return the exact + string that can be used to re-create the named routine. The + statements require that you be the owner of the routine or + have <literal>SELECT</literal> access to the + <literal>mysql.proc</literal> table. </para> <remark role="help-description-end"/> @@ -19091,6 +19104,101 @@ </section> + <section id="show-procedure-code"> + + <title><literal>SHOW PROCEDURE CODE</literal> and <literal>SHOW FUNCTION + CODE</literal> Syntax + + + SHOW PROCEDURE CODE + + + + SHOW FUNCTION CODE + + + + + + SHOW PROCEDURE FUNCTION CODE + + + + + +SHOW {PROCEDURE | FUNCTION} CODE sp_name + + + + + + These statements are MySQL extensions that are available only + for servers that have been built with debugging support. They + display a representation of the internal implementation of the + named routine. The statements require that you be the owner of + the routine or have SELECT access to the + mysql.proc table. + + + + If the named routine is available, each statement produces a + result set. Each row in the result set corresponds to one + instruction in the routine. The first column is + Pos, which is an ordinal number beginning + with 0. The second column is Instruction, + which contains an SQL statement (usually changed from the + original source), or a directive which has meaning only to the + stored-routine handler. + + + + + + + +mysql> DELIMITER // +mysql> CREATE PROCEDURE p1 () + -> BEGIN + -> DECLARE fanta INT DEFAULT 55; + -> DROP TABLE t2; + -> LOOP + -> INSERT INTO t3 VALUES (fanta); + -> END LOOP; + -> END// +Query OK, 0 rows affected (0.00 sec) + +mysql> SHOW PROCEDURE CODE p1// ++-----+----------------------------------------+ +| Pos | Instruction | ++-----+----------------------------------------+ +| 0 | set fanta@0 55 | +| 1 | stmt 9 "DROP TABLE t2" | +| 2 | stmt 5 "INSERT INTO t3 VALUES (fanta)" | +| 3 | jump 2 | ++-----+----------------------------------------+ +4 rows in set (0.00 sec) + + + + In this example, the non-executable BEGIN + and END statements have disappeared, and + for the DECLARE + variable_name statement, + only the executable part appears (the part where the default + is assigned). For each statement that is taken from source, + there is a code word stmt followed by a + type (9 means DROP, 5 means + INSERT, and so on). The final row contains + an instruction jump 2, meaning + GOTO instruction #2. + + + + These statements were added in MySQL 5.1.3. + + +
+
<literal>SHOW PROCEDURE STATUS</literal> and <literal>SHOW FUNCTION @@ -19119,7 +19227,7 @@ <remark role="help-description-begin"/> <para> - This statement is a MySQL extension. It returns + These statements are MySQL extensions. They return characteristics of routines, such as the database, name, type, creator, and creation and modification dates. If no pattern is specified, the information for all stored procedures or all