Subject: | ShowErrorStatement shows wrong statement |
===
use strict;
use warnings;
use Data::Dumper;
use DBI;
use DBD::mysql;
print DBI->VERSION, "\n";
print DBD::mysql->VERSION, "\n";
my $dbh = DBI->connect("DBI:mysql:test:localhost", 'root', '', {RaiseError => 1, ShowErrorStatement=>1});
my $userlogin = $dbh->prepare(qq{select 1 where x in a,b,c});
my $all_users = $dbh->prepare(qq{select 42});
$all_users->execute();
while ( my $row = $all_users->fetchrow_hashref ) {
my $x = $row->{user_id};
my $z = $dbh->selectall_arrayref( $userlogin, undef);
print Dumper $z->[0][0];
}
===
prints
perl 2.pl
1.63
4.025
DBD::mysql::db selectall_arrayref failed: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'where x in a,b,c' at line 1 [for Statement "select 42"] at 2.pl line 19.
DBD::mysql::db selectall_arrayref failed: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'where x in a,b,c' at line 1 [for Statement "select 42"] at 2.pl line 19.
but the syntax error is not in "select 42" statement.