Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Reusing placeholders

by erix (Prior)
on Mar 27, 2021 at 13:56 UTC ( #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 (Curate) 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? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2022-01-24 19:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (65 votes). Check out past polls.

    Notices?