Re: DBD::Mysql UPDATE/REPLACE quoti ng of parameters

Jim Winstead <[email protected]>
Newsgroups gmane.comp.db.mysql.perl
Message-ID <[email protected]>
On Thu, Sep 21, 2006 at 04:10:02PM +0200, eduard W. Lohmann wrote:
> Working on an amd64 machine running debian-testing. 
> 
> Mysql.pm:       $VERSION = '1.2401';
> DBD::Mysql.pm:  $VERSION = '3.0006';
> 
> I have the following
> simple code:
> 
> use strict;
> use warnings;
> 
> use DBI;
> 
> my $dbh = DBI->connect("DBI:mysql:nvb2", 'root', undef);
> 
> $dbh->do(q{ UPDATE `dbfs`  SET file='BLA', owner=3, type='text' WHERE
> name = ? AND owner = ? }, {}, ('test', 5)  ); 
>    
> $dbh->disconnect();
> 
> 
> This work just fine, but when I replace the word UPDATE with REPLACE 
> it starts to quote the second parameter. The error is:
> 
> DBD::mysql::db do failed: You have an error in your SQL syntax; check
> the manual that corresponds to your MySQL server version for the right
> syntax to use near 'WHERE name = 'test' AND owner = '5'' at line 1 at
> t.pl line 7.
> 
> Am I missing something or is this a bug? 

No, the quoting of the second parameter is not a problem. The problem is
that the REPLACE statement does not support a WHERE clause.

See http://dev.mysql.com/doc/refman/5.0/en/replace.html

Jim

-- 
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.