Re: PQisBusy() always returns TRUE
От
ntinos@aueb.gr
Тема
Re: PQisBusy() always returns TRUE
Дата
Msg-id
courier.41E9740B.00002F13@red.servers.aueb.gr
Ответ на
Re: PQisBusy() always returns TRUE (Tom Lane)
Список
Дерево обсуждения
postmaster listening on specified addresses Administrator <admin@photoresearchers.com>
Re: postmaster listening on specified addresses Michael Fuhr <mike@fuhr.org>
Re: postmaster listening on specified addresses Doug McNaught <doug@mcnaught.org>
PQisBusy() always returns TRUE ntinos@aueb.gr
Re: PQisBusy() always returns TRUE Tom Lane <tgl@sss.pgh.pa.us>
Re: PQisBusy() always returns TRUE ntinos@aueb.gr
Re: PQisBusy() always returns TRUE Martijn van Oosterhout <kleptog@svana.org>
Re: PQisBusy() always returns TRUE ntinos@aueb.gr
If understand correctly what you are saying, the right code for this thing
is:
PQconsumeInput(conn); //Try to collect the results
while (PQisBusy(conn)) // while not ready ...
PQconsumeInput(conn); //...retry
res=PQgetResult(conn); // Now get the results
I tried this and it worked. However, the problem now is that it is slow
(surely slower than using blocking commands).
If the code above is right (?), why is that?
Thanks for your response,
Ntinos Katsaros
Tom Lane writes:
> ntinos@aueb.gr writes:
>> if (PQconsumeInput(conn)!=1) elog(ERROR,"Error in consume...");
>> else
>> {
>> elog(INFO,"OK with PQconsumeInput");
>
>> //Will use a cursor and 'while' later when this
>> //will have been fixed...
>> if (!PQisBusy(conn))
>> {
>> res=PQgetResult(conn);
>> }
>> else elog(INFO,"It is too busy to give me the results!");
>> }
>
> PQconsumeInput has to be part of the loop. PQisBusy doesn't change any
> state, it just tells you whether PQconsumeInput has collected a complete
> query result yet.
>
> regards, tom lane
В списке pgsql-general по дате отправления