A patch against current MySQL 5.0 (should work with MySQL 5.1, too).
Example:
mysql> SELECT User, Host FROM mysql.user PROCEDURE ROWNUM();
+------+-----------+--------+
| User | Host | RowNum |
+------+-----------+--------+
| root | 127.0.0.1 | 0 |
| root | linux | 1 |
| root | localhost | 2 |
+------+-----------+--------+
3 rows in set (0.00 sec)
How to apply:
in the MySQL 5.0 source directory to patch -p1 < proc-rownum-1.0.0.patch
run automake and autoconf to regenerate configure
run ./configure as usual or refresh your previous configuration by running ./config.status
run make and make install to compile and install the server
restart the server
try appending PROCEDURE ROWNUM() to a query
A patch against current MySQL 5.0 (should work with MySQL 5.1, too).
This procedure will replace the actual query results with one row per procedure object member function call, so showing the sequence these functions are called on a result set.
Example:
mysql>select * from t2;+------+------+ | i | j | +------+------+ | 1 | 1 | | 2 | 1 | | 2 | 2 | | 3 | 1 | | 3 | 2 | | 3 | 3 | +------+------+ 6 rows in set (0.00 sec) mysql>select i from t2 group by i procedure calltrace();+----------------+ | Call | +----------------+ | add | | end_group | | send_row | | add | | add | | end_group | | send_row | | add | | add | | add | | end_group | | send_row | | end_of_records | +----------------+ 13 rows in set (0.00 sec)
How to apply: see the PROCEDURE ROWNUM() example abouve, the patch for this procedure needs to be applied in exactly the same way.
