Skip Menu |

This queue is for tickets about the DBD-mysql CPAN distribution.

Report information
The Basics
Id: 75540
Status: resolved
Priority: 0/
Queue: DBD-mysql

Owner: Nobody in particular
Requestors: GNATYNA [...]
Cc: gnatyna [...]

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)

CC: gnatyna [...]
Subject: Commented placeholders in sql statement.
Download (untitled) / with headers
text/plain 222b
With mysql_server_prepare=0 line $dbh->do(qq[update t1 set id=id+1 where / col1=? and/ id=?],undef,1) gives error "You have an error in your SQL syntax;". $dbh->prepare->execute works fine. Test script in attachement.
text/x-perl 1k
#!/usr/bin/perl -l use strict; use warnings; use DBI; =head2 SQL create table t1( id int); =cut t_ph(); sub t_ph{ my $dbh = DBI->connect("DBI:mysql:database=test;host=localhost;mysql_server_prepare=0;", undef, undef, {AutoCommit => 1, PrintError=>0, RaiseError => 0}, ); my $query = q[update t1 set id=id+1 where /* col1 = ? and */ id=?]; if($dbh->do($query, undef, 1)){ print "comment do ok"; }else{ warn "comment DO: ".$dbh->errstr; } my $query_nocom = q[update t1 set id=id+1 where id=?]; if($dbh->do($query_nocom, undef, 1)){ print "nocomment do ok"; }else{ warn "no comment DO: ".$dbh->errstr; } my $sth = $dbh->prepare($query,undef); if($sth->execute(1)){ print "Execute-prepare ok"; }else{ warn "execute-prepare: ".$dbh->errstr; } $dbh->disconnect(); }

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to