PQgetResult() and NULL

Поиск
Список
Период
Сортировка
От bradg
Тема PQgetResult() and NULL
Дата
Msg-id 1457707980874-5892227.post@n5.nabble.com
обсуждение исходный текст
Ответы Re: PQgetResult() and NULL  (bradg <bg4all@me.com>)
Список pgsql-novice
I am trying to handle asynchronous queries. My question relates to
PQgetResult() returning NULL.

Everything seems fine up until the point where I would expect PQgetResult()
to return NULL, but instead I get a result with a status of
PGRES_FATAL_ERROR and no error message on the connection or any of the
result error fields. When I poke the result for things like PQcmdStatus(), I
get nothing back. And if I keep calling PQgetResult() after that, I keep
getting the same kind of result and never NULL.

The connection status is CONNECTION_OK and the polling status is
PGRES_POLLING_OK the entire time, before and after I get the empty fatal
error results.
The transaction status, however, changes from PQTRANS_ACTIVE to PQTRANS_IDLE
when I would expect PQgetResult() to return NULL.

I am running version 9.5 on OS X 10.11. My code logic is pretty simple and
boilerplate from what I've seen on the web:
1- monitor the socket for reading
2- call PQconsumeInput()
3- if PQisBusy() wait for socket again
4- loop indefinitely... calling PQisBusy(), PQgetResult(), exit if result
NULL | process if result not NULL

Any insights would be helpful. Thanks.

Brad



--
View this message in context: http://postgresql.nabble.com/PQgetResult-and-NULL-tp5892227.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.


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

Предыдущее
От: Sherrie Kubis
Дата:
Сообщение: Re: Getting started - pgadmin3
Следующее
От: bradg
Дата:
Сообщение: Re: PQgetResult() and NULL