Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

DBD::Pg ignoring placeholders, which are obvious to me at least . . .

by hesco (Deacon)
on Aug 21, 2009 at 19:37 UTC ( [id://790451]=perlquestion: print w/replies, xml ) Need Help??

hesco has asked for the wisdom of the Perl Monks concerning the following question:

Confusion reigns here for the moment. My query asks for two bind variables and I give it two. What might this mean?

My test script throws these errors:

UPDATE asd_call_lists SET queued = \'t\' WHERE phone = ? AND userid = +?; DBD::Pg::st execute failed: called with 2 bind variables when 0 are ne +eded at . . .
originating from this method:

sub _mark_as_called { my $self = shift; my $phone = shift; my $update = $self->{'cfg'}->param('sql.note_dial_result'); print STDERR $update, "\n"; my $sth = $self->{'dbh'}->prepare($update); $sth->execute($phone,$self->{'s'}->{'userid'}); return; }
What's up with that? Why would that update query not want two bind variables to execute?

-- Hugh

UPDATE:

Thanks Ikegami. I rewrote that query as: 'UPDATE asd_call_lists SET queued = TRUE WHERE phone = ? AND userid = ?;' and the error is no more. Those slashes were to escape the single quotes around t, inside the single quoted query. Not sure why the escapes were not appropriately processed. Thanks again.

if( $lal && $lol ) { $life++; }

Replies are listed 'Best First'.
Re: DBD::Pg ignoring placeholders, which are obvious to me at least . . .
by ikegami (Patriarch) on Aug 21, 2009 at 19:50 UTC
    It might go away once you fix the syntax error. Those slashes shouldn't be there.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://790451]
Approved by ikegami
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-03-28 09:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found