| Bug #34157 | tutorial-warnings.lua uses wrong array indices | ||
|---|---|---|---|
| Submitted: | 30 Jan 2008 3:29 | Modified: | 3 Jun 2009 13:27 |
| Reporter: | Jess Balint | Email Updates: | |
| Status: | Can't repeat | Impact on me: | |
| Category: | MySQL Proxy: Scripts | Severity: | S3 (Non-critical) |
| Version: | 0.6.0, 0.6.1, r369 | OS: | Any (MS Windows, Mac) |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | Contribution | ||
[29 Apr 2008 21:10]
Sveta Smirnova
Thank you for the report. Verified as described.
[3 Jun 2009 13:27]
Kay Roepke
We believe this issue has been address in the latest version (0.7.1) of MySQL Proxy. Output shown is: classdump:trunk kroepke$ ./sbin/mysql-proxy --proxy-lua-script=share/doc/mysql-proxy/tutorial-warnings.lua Query had warnings: create table z2 (x int ) engine=zombo warning: [1286] Warning warning: [1266] Warning The MySQL client application sees: mysql> create table z2 (x int ) engine=zombo; Query OK, 0 rows affected, 2 warnings (0.06 sec) mysql> show warnings; +---------+------+--------------------------------------------+ | Level | Code | Message | +---------+------+--------------------------------------------+ | Warning | 1286 | Unknown table engine 'zombo' | | Warning | 1266 | Using storage engine MyISAM for table 'z2' | +---------+------+--------------------------------------------+ 2 rows in set (0.00 sec)

Description: Tutorial script has wrong array indices. How to repeat: Run the script, and cause a warning. The result displayed will be: Query had warnings: create table z2 (x int ) engine=zombo (read_query_result) examples/tutorial-warnings.lua:65: bad argument #2 to 'format' (number expected, got string) \cygwin\home\mysqldev\mysql-proxy\src\mysql-proxy-0.6.0\src\network-mysqld-proxy.c.2047: got asked to send a resultset, but ignoring it as we already have sent 1 resultset(s). injection-id: 2 Suggested fix: Line 65 has: print(string.format("warning: [%d] %s", row[1], row[2])) this should actually be: print(string.format("warning: [%d] %s", row[2], row[3])) row[1] is the type (Warning/Error), as seen in result: +---------+------+--------------------------------------------+ | Level | Code | Message | +---------+------+--------------------------------------------+ | Warning | 1286 | Unknown table engine 'zombo' | | Warning | 1266 | Using storage engine MyISAM for table 'z2' | +---------+------+--------------------------------------------+