On 2012-10-22 15:16:47 +0800, Tim Bowden wrote:
> Is it possible, and if so, how can I set the number of placeholders in a
> prepared statement at runtime?
>
> IE, given something like:
>
> my $sth = $dbh->prepare("INSERT INTO $table ($fields) VALUES (?,?,?));
>
> which is fine if I know how man
Thanks Henri. Much appreciated.
On Mon, 2012-10-22 at 09:21 +0200, Henri Asseily wrote:
> The $sth is a mutable string… Which means you can change it at runtime!
>
> Here's an example of a modified $sth at runtime:
>
> my $up_sql = defined($updated_at) ? 'updated_at < ? AND ' : undef;
> my
The $sth is a mutable string… Which means you can change it at runtime!
Here's an example of a modified $sth at runtime:
my $up_sql = defined($updated_at) ? 'updated_at < ? AND ' : undef;
my $sql = "SELECT * FROM mytable WHERE $up_sql type_id = ? AND serial_number
IN (
SELECT s
Is it possible, and if so, how can I set the number of placeholders in a
prepared statement at runtime?
IE, given something like:
my $sth = $dbh->prepare("INSERT INTO $table ($fields) VALUES (?,?,?));
which is fine if I know how many fields I'm inserting into, but what if
I don't know till runti