From: | "Matus \"fantomas\" Uhlar" <uhlar(at)fantomas(dot)sk> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | asynchronour queries and result testing |
Date: | 2001-05-15 12:48:21 |
Message-ID: | 20010515144821.A21249@fantomas.sk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-novice |
Hello,
I have this query in my .c program:
if (PQsendQuery(srcmain, "select userid,uid,clear_passwd,www_home,date_part('epoch',dt_block),date_part('epoch',dt_cancel) from www where uid=parent_uid and dt_modify > dt_export")) {
while ((srcmres = PQgetResult(srcmain)) != NULL) {
well as doc says,
"Each non-null result from PQgetResult should be processed using the
same PGresult accessor functions previously described."
do i understand it correctly?
/* process each returned line */
if ((srcmstat = PQresultStatus(srcmres)) != PGRES_TUPLES_OK)
fprintf(stderr, "error getting result: %s\n",
PQresultErrorMessage(srcmres));
else {
if ((srcmtup = PQntuples(srcmres)) == 6) {
I just would like to know, if, in case of problem couldn't just return NULL
and fill out error message; could I just process the result and if there's
no data (or an error), NULL would be returned and PQresStatus could be
called to see if any problem occured.
Anyway, even if I get resule with 0 tuples, I need to check PQntuples and it
returns 0.
i think checking PQntuples in big loop is quite unefficient.
could anybody comment this?
Thanks.
--
Matus "fantomas" Uhlar, sysadmin at NEXTRA, Slovakia; IRCNET admin of *.sk
uhlar(at)fantomas(dot)sk ; http://www.fantomas.sk/ ; http://www.nextra.sk/
WinError #99999: Out of error messages.
From | Date | Subject | |
---|---|---|---|
Next Message | Tony Grant | 2001-05-15 13:27:10 | Re: cant support non ascii character... |
Previous Message | snpe | 2001-05-15 12:40:16 | Performance aggregates |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter J. Schoenster | 2001-05-15 23:47:10 | Re: [SQL] Is this possible? |
Previous Message | Tom Lane | 2001-05-15 02:35:37 | Re: Drop table wildcard |