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

People
Owner: Nobody in particular
Requestors: GNATYNA [...] cpan.org
Cc: gnatyna [...] ya.ru
AdminCc:

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



CC: gnatyna [...] ya.ru
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.
Subject: ph_in_comment.pl
Download ph_in_comment.pl
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 Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.