Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Reusing placeholders

by erix (Prior)
on Mar 27, 2021 at 13:56 UTC ( [id://11130471]=note: print w/replies, xml ) Need Help??


in reply to Reusing placeholders

PostgreSQL (or rather, DBD::Pg) allows dollar notation too, so you can re-use those. (Must start at $1, but can be used in any order in the query), see DBD::Pg docs, under 'placeholders'.

I normally set $dbh->{pg_placeholder_dollaronly} property so I don't start using the questionable question mark.

(Of course, if your SQL is submitted to other DBMS than (just) postgres, you'll have to think of something else)

edit: Oh, I see you're also the last_insert_id guy. That means you're mucking around with a lesser db than PostgreSQL and that the above should be ignored till you upgrade to the better system

Replies are listed 'Best First'.
Re^2: Reusing placeholders
by Bod (Parson) on Mar 27, 2021 at 23:26 UTC

Log In?
Username:
Password:

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

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

    No recent polls found