Re: Last minute mini-proposal (I know, I know) for PQexecf()

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Last minute mini-proposal (I know, I know) for PQexecf()
Дата
Msg-id 26530.1175301022@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Last minute mini-proposal (I know, I know) for PQexecf()  (<korryd@enterprisedb.com>)
Ответы Re: Last minute mini-proposal (I know, I know) forPQexecf()  (<korryd@enterprisedb.com>)
Re: Last minute mini-proposal (I know, I know) for PQexecf()  (Brian Hurt <bhurt@janestcapital.com>)
Список pgsql-hackers
<korryd@enterprisedb.com> writes:
> I'd like to see a new variant on PQexec():
>     PGresult * PQexecf(PGconn *conn, const char *fmt, ...);

Way too late for 8.3 --- if we were going to do something like this,
we should think first and program later.  In particular, blindly
adopting the sprintf format string definition doesn't seem very helpful.
The sorts of escapes I'd want to have are "properly quoted SQL
identifier", "properly quoted SQL literal", etc.  A large fraction of
what sprintf knows about is more or less irrelevant to the task of
creating SQL commands.

Also, how does this interact with parameterized or prepared commands?
If we wanted PQexecf we'd soon want PQexecParamsf, etc.  I don't think
we really want so much duplicate logic there --- it'd be better to
decouple the string-building functionality from the query-sending
functionality.  Probably better to consider something like
PQformatQuery() that passes back a malloc'd string.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От:
Дата:
Сообщение: Last minute mini-proposal (I know, I know) for PQexecf()
Следующее
От: "Koichi Suzuki"
Дата:
Сообщение: Re: [PATCHES] Full page writes improvement, code update