Re: [GENERAL] More PHP DB abstraction layer stuff - Mailing list pgsql-interfaces

From Doug McNaught
Subject Re: [GENERAL] More PHP DB abstraction layer stuff
Date
Msg-id m3y95ami5k.fsf@varsoon.wireboard.com
Whole thread Raw
In response to Re: [GENERAL] More PHP DB abstraction layer stuff  (Dennis Gearon <gearond@cvc.net>)
List pgsql-interfaces
Dennis Gearon <gearond@cvc.net> writes:

> could you elaborate on:
>
>     Place holders ( those are in prepared queries, yes?)
>     out of band?

I think by "out of band" Greg just means substituting values into a
prepared query rather than glomming everything into an SQL string by
yourself.  For example, in Perl DBI you'd do something like:

$stmt = $dbh->prepare("select * from mytable where first_name = ?");
$ret_val = $sth->execute("Fred");   # might come from a web form instead
@row = $sth->fetchrow_array();

The database driver is responsible for turning the '?' in the query
into a properly-quoted and escaped value, or otherwise supplying it to
the database.  The '?' is a placeholder.

-Doug

pgsql-interfaces by date:

Previous
From: Dennis Gearon
Date:
Subject: Re: [GENERAL] More PHP DB abstraction layer stuff
Next
From: "J Greenbaum"
Date:
Subject: access field names w/ DBD