in reply to I was told to use DBI::selectrow_array... but it doesn't support placeholders

Did you read the docs and notice that the placeholder arguments start at the third argument in the method (the second arg, the attributes hashref, can be undef)?

Disclaimer: I'm not sure if I've ever tried that particular method with placeholders, but I have run into the same issue on other dbh methods using placeholders (i.e. forgetting to put the undef in).

Also, FYI, you can still use prepared statements with those methods, as the first argument can be either a SQL string or a prepared statement handle.

  • Comment on Re: I was told to use DBI::selectrow_array... but it doesn't support placeholders

Replies are listed 'Best First'.
Re^2: I was told to use DBI::selectrow_array... but it doesn't support placeholders
by Ovid (Cardinal) on Mar 29, 2007 at 20:21 UTC

    It works fine with placeholders. The only caveat is to not call it in scalar context as its behavior is undefined. If returning a single value, use parens around the scalar.

    Cheers,
    Ovid

    New address of my CGI Course.

Re^2: I was told to use DBI::selectrow_array... but it doesn't support placeholders
by metaperl (Curate) on Mar 30, 2007 at 17:43 UTC
    I dont know how I missed this:
    @row_ary = $dbh->selectrow_array($statement, \%attr, @bind_values);
    Thanks.