From: | bradg <bg4all(at)me(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | PQgetResult() and NULL |
Date: | 2016-03-11 14:53:00 |
Message-ID: | 1457707980874-5892227.post@n5.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.
From | Date | Subject | |
---|---|---|---|
Next Message | bradg | 2016-03-12 04:16:06 | Re: PQgetResult() and NULL |
Previous Message | Sherrie Kubis | 2016-03-10 18:56:39 | Re: Getting started - pgadmin3 |