Re: PQisBusy() always busy

Поиск
Список
Период
Сортировка
От bradg
Тема Re: PQisBusy() always busy
Дата
Msg-id 1315848068901-4794992.post@n5.nabble.com
обсуждение исходный текст
Ответ на Re: PQisBusy() always busy  (Merlin Moncure <mmoncure@gmail.com>)
Ответы Re: PQisBusy() always busy  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-novice
Thanks Merlin.

I added the piece to check PQconsumeInput(). Unfortunately it has not solved
my problem. It returns 1 indicating "no error" and PQisBusy() still returns
1 indefinitely.

Here's the updated code:


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 ))
    {
        if (PQconsumeInput( connection ))
        {
            if( PQisBusy( connection ))
                return( FALSE );
            else
                return( TRUE );
        }
        else
        {
            printf("ERROR with PQconsumeInput(): %s\n",
PQerrorMessage(connection));
            return ( FALSE );
        }
    }
    else
    {
        return( FALSE );
    }
}

--
View this message in context: http://postgresql.1045698.n5.nabble.com/PQisBusy-always-busy-tp4793847p4794992.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.

В списке pgsql-novice по дате отправления:

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: PQisBusy() always busy
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: PQisBusy() always busy