Re: [GENERAL] More PHP DB abstraction layer stuff

Поиск
Список
Период
Сортировка
От Doug McNaught
Тема Re: [GENERAL] More PHP DB abstraction layer stuff
Дата
Msg-id m3y95ami5k.fsf@varsoon.wireboard.com
обсуждение исходный текст
Ответ на Re: [GENERAL] More PHP DB abstraction layer stuff  (Dennis Gearon <gearond@cvc.net>)
Список 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 по дате отправления:

Предыдущее
От: Dennis Gearon
Дата:
Сообщение: Re: [GENERAL] More PHP DB abstraction layer stuff
Следующее
От: "J Greenbaum"
Дата:
Сообщение: access field names w/ DBD