Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Interpolating DBI/SQL placeholders

by blokhead (Monsignor)
on May 11, 2004 at 04:45 UTC ( #352312=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $sql   = "insert into foo values (?,?,?)";
    my @binds = qw/alpha beta gamma/;
    ...
        $sql  =~ s/\?/ $dbh->quote( $binds[$i++] ) /ge;
    }
    # "insert into foo values ('alpha','beta','gamma')"
    
  2. or download this
    my $sql   = "insert into foo values (?, ?)";
    my @binds = ("Huh?", "What?");
    
    # correct:  "insert into foo values ('Huh?', 'What?')"
    # mysqlPP:  "insert into foo values ('Huh'What?'', ?)"
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2021-01-25 14:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?