in reply to RFC: Placeholder creation for SQL statements
#prepare my $sth = $dbh->prepare('SELECT * FROM people WHERE lastname = ? AND f +irstname = ?'); #execute with list of bindvars $sth->execute( $lastname, $firstname ); [download] But it's a bit cumbersome to adjust the bind values if the order chang +es.
Re placeholders: PostgreSQL's DBD::Pg has an attribute 'pg_placeholder_dollaronly' which when set to 1 makes placeholdering (ordering or repeating) a little easier (fsvo easy):
$dbh->{pg_placeholder_dollaronly} = 1; # default is 0 my $sth = $dbh->prepare('SELECT * FROM people WHERE lastname = $1 AND +firstname = $2');
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: RFC: Placeholder creation for SQL statements
by kikuchiyo (Hermit) on Aug 29, 2022 at 12:23 UTC | |
by erix (Prior) on Aug 29, 2022 at 13:36 UTC | |
by kikuchiyo (Hermit) on Aug 29, 2022 at 14:34 UTC | |
Re^2: RFC: Placeholder creation for SQL statements
by LanX (Saint) on Aug 29, 2022 at 21:19 UTC |