| Bug #38166 | DBD::mysql does not properly report errors with mysql_multi_statements | ||
|---|---|---|---|
| Submitted: | 16 Jul 2008 9:21 | Modified: | 17 Jul 2008 11:45 |
| Reporter: | Philip Stoev | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | Connectors: DBD::mysql ( Perl ) | Severity: | S3 (Non-critical) |
| Version: | OS: | Any | |
| Assigned to: | CPU Architecture: | Any | |
[17 Jul 2008 11:45]
Sveta Smirnova
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on how to report a bug at http://bugs.mysql.com/how-to-report.php According to link you provided you should process multiple result sets step-by-step like below: my $sth = $dbh->prepare('SELECT 1; select 2; BOGUS_STATEMENT'); $sth->execute(); do { printf "MySQL Error: %s\n", $dbh->{'mysql_error'}; } until (!$sth->more_results);

Description: When mysql_multi_statements is in effect, DBD::mysql will ignore errors from the second and subsequent queries and dbh->do() will report success. How to repeat: use DBI; use strict; my $dbh = DBI->connect('dbi:mysql:host=127.0.0.1:port=9306:user=root:database=test:mysql_multi_statements=1'); $dbh->do('SELECT 1; BOGUS_STATEMENT'); This should fail but it succeeds silently. Suggested fix: Please see http://dev.mysql.com/doc/refman/5.0/en/c-api-multiple-queries.html for a description on how to handle multiple result sets and error conditions.