From: | bradg <bg4all(at)me(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | PQisBusy() always busy |
Date: | 2011-09-12 11:16:58 |
Message-ID: | 1315826218151-4793847.post@n5.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
It seems like PQisBusy() == 1 indefinitely after calling the asynchronous
function PQsendQueryParams().
I am using a method to check for the availability of asynchronous results
straight out of the latest PostgreSQL book by Korry and Susan Douglas. It
uses select() and then FD_ISSET on the connection socket, then calls both
PQconsumeInput() and PQisBusy().
For some reason, the value for PQisBusy() is always 1, no matter how long I
let the program run.
I'm just wondering if anyone can point me in the right direction. For what
it's worth. I'm programming in OS X 10.7 with Xcode 4.1 using the PostgreSQL
files from the EnterpriseDB one-click installer.
Here's the function:
bool is_result_ready( PGconn * connection )
{
int my_socket;
struct timeval timer;
fd_set read_mask;
if( PQisBusy( connection ) == FALSE )
return( TRUE );
my_socket = PQsocket( connection );
timer.tv_sec = (time_t)1;
timer.tv_usec = 0;
FD_ZERO( &read_mask );
FD_SET( my_socket, &read_mask );
if( select( my_socket + 1, &read_mask, NULL, NULL, &timer ) == 0 )
{
return( FALSE );
}
else if( FD_ISSET( my_socket, &read_mask ))
{
PQconsumeInput( connection );
if( PQisBusy( connection )) <------ THIS PQisBusy() ALWAYS
RETURNS 1
return( FALSE );
else
return( TRUE );
}
else
{
return( FALSE );
}
}
Thanks in advance for any insight.
Brad
--
View this message in context: http://postgresql.1045698.n5.nabble.com/PQisBusy-always-busy-tp4793847p4793847.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.
From | Date | Subject | |
---|---|---|---|
Next Message | Merlin Moncure | 2011-09-12 14:16:51 | Re: PQisBusy() always busy |
Previous Message | Tom Lane | 2011-09-11 16:00:34 | Re: Using expression names in subsequent calculation |