Re: PQsendQuery+PQgetResult+PQsetSingleRowMode limitations and support
От | Shulgin, Oleksandr |
---|---|
Тема | Re: PQsendQuery+PQgetResult+PQsetSingleRowMode limitations and support |
Дата | |
Msg-id | CACACo5T0=gCj1Sjwn1P22PLzjVoVp-yk_O3RLgXzzE3ss7kS-Q@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: PQsendQuery+PQgetResult+PQsetSingleRowMode limitations and support ("Karl O. Pinc" <kop@meme.com>) |
Ответы |
Re: PQsendQuery+PQgetResult+PQsetSingleRowMode
limitations and support
|
Список | pgsql-hackers |
On Mon, Apr 11, 2016 at 7:15 PM, Karl O. Pinc <kop@meme.com> wrote:
>
> Should I submit a regression test or something to ensure
> that this usage is officially supported? (A grep for
> PQsetSingleRowMode in src/test/ finds no hits.)
> Can I assume because it's documented it'll continue to work?
> > Not sure about the part
> > where you call PQsetSingleRowMode() again after seeing
> > PGRES_TUPLES_OK: doesn't look to me like you need or want to do
> > that. You should only call it immediately after PQsendQuery().
>
> You're quite right. All but the first PQsetSingleRowMode()
> calls fail.
>
> This seems unfortunate. What if I submit several SQL statements
> with one PQsendQuery() call and I only want some of the statements
> executed in single row mode?
I would assume that if you know for which of the statements you want the single row mode, then you as well can submit them as separate PQsendQuery() calls.
> I'm not sure what the use case
> would be but it seems sad that PQsetSingleRowMode() is per
> libpq call and not per sql statement.
It is per query, where query == "argument to PQsendQuery()" :-)
> When the docs here say "query" what they really mean is "set of
> statements submitted in a single libpq call".
Which are the same things more or less, I'm not sure that the extended explanation you suggest makes it less confusing.
--
Regards,
Alex
>
> Should I submit a regression test or something to ensure
> that this usage is officially supported? (A grep for
> PQsetSingleRowMode in src/test/ finds no hits.)
> Can I assume because it's documented it'll continue to work?
Pretty much.
> > Not sure about the part
> > where you call PQsetSingleRowMode() again after seeing
> > PGRES_TUPLES_OK: doesn't look to me like you need or want to do
> > that. You should only call it immediately after PQsendQuery().
>
> You're quite right. All but the first PQsetSingleRowMode()
> calls fail.
>
> This seems unfortunate. What if I submit several SQL statements
> with one PQsendQuery() call and I only want some of the statements
> executed in single row mode?
I would assume that if you know for which of the statements you want the single row mode, then you as well can submit them as separate PQsendQuery() calls.
> I'm not sure what the use case
> would be but it seems sad that PQsetSingleRowMode() is per
> libpq call and not per sql statement.
It is per query, where query == "argument to PQsendQuery()" :-)
> When the docs here say "query" what they really mean is "set of
> statements submitted in a single libpq call".
Which are the same things more or less, I'm not sure that the extended explanation you suggest makes it less confusing.
--
Regards,
Alex
В списке pgsql-hackers по дате отправления: