PQisBusy() always busy - Mailing list pgsql-novice

From bradg
Subject PQisBusy() always busy
Date
Msg-id 1315826218151-4793847.post@n5.nabble.com
Whole thread Raw
Responses Re: PQisBusy() always busy  (Merlin Moncure <mmoncure@gmail.com>)
List 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.

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: Using expression names in subsequent calculation
Next
From: Merlin Moncure
Date:
Subject: Re: PQisBusy() always busy