pg.ddx.io pgsql-interfaces@postgresql.org mailing list archivehelp / color / mirror / Atom feed
Asynchronous Queries/libpq 2+ messages / 2 participants [nested] [flat]
* Asynchronous Queries/libpq @ 2006-03-31 19:56 Keary Suska <hierophant@pcisys.net> 2006-03-31 23:56 ` Re: Asynchronous Queries/libpq Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 1 reply; 2+ messages in thread From: Keary Suska @ 2006-03-31 19:56 UTC (permalink / raw) To: pgsql-interfaces Me again. I am trying to understand the process for asynchronous queries in libpq, and I want to make sure I understand the process correctly. Is it that PQgetResult will return a full query result from a single command, and will only return NULL if there are no more commands that have not completed, therefore only needing to be called once per command in the dispatched query; or is it that PQgetResult must be repeatedly called for even a single command query, and that it will only return NULL after each command in the dispatched query has completed fully? Further, can we *always* assume that query results will be returned in the order they appear in the query dispatch? Thanks, Keary Suska Esoteritech, Inc. "Demystifying technology for your home or business" ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Asynchronous Queries/libpq 2006-03-31 19:56 Asynchronous Queries/libpq Keary Suska <hierophant@pcisys.net> @ 2006-03-31 23:56 ` Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2006-03-31 23:56 UTC (permalink / raw) To: Keary Suska <hierophant@pcisys.net>; +Cc: pgsql-interfaces Keary Suska <hierophant@pcisys.net> writes: > Is it that PQgetResult will return a full query result from a single > command, and will only return NULL if there are no more commands that have > not completed, therefore only needing to be called once per command in the > dispatched query; or is it that PQgetResult must be repeatedly called for > even a single command query, and that it will only return NULL after each > command in the dispatched query has completed fully? You need to loop until PQgetResult returns null, if you want to handle multi-command strings (you'll get one PGresult per command). If you know there's only going to be one result you might be able to get away without a second PQgetResult call, but I wouldn't recommend it. > Further, can we *always* assume that query results will be returned in the > order they appear in the query dispatch? Yes. The backend isn't going to execute commands in a query string out-of-order. regards, tom lane ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2006-03-31 23:56 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2006-03-31 19:56 Asynchronous Queries/libpq Keary Suska <hierophant@pcisys.net> 2006-03-31 23:56 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox