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

Re: Avoid embedding variables in SQL - Dancer App

by Corion (Pope)
on Sep 05, 2014 at 14:43 UTC ( #1099681=note: print w/replies, xml ) Need Help??


in reply to Avoid embedding variables in SQL - Dancer App

Your first example only uses one variable in the place.

Your second example uses three placeholders, but you don't want categories.id_cat to be compared as a string.

Placeholders only work for constant values, not for column references. You will need to use string interpolation for that.

Replies are listed 'Best First'.
Re^2: Avoid embedding variables in SQL - Dancer App
by GertMT (Hermit) on Sep 05, 2014 at 16:14 UTC

    Thanks for your comments

    Reading about this I hope not to be wrong in my conclusion that

    ---- WHERE products.fk_cat = categories.id_cat AND products.fk_col = collections.id_col AND collections.link_col = ? SQL my $sth = database->prepare($sql); #print Dumper $link; # is okay $sth->execute( $link ); ----
    Should be okay.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (1)
As of 2021-12-02 18:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (23 votes). Check out past polls.

    Notices?