libpq/async notifications

From: Igor Shevchenko <igor(at)carcass(dot)ath(dot)cx>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: libpq/async notifications
Date: 2003-10-11 09:20:25
Message-ID: 200310111220.25923.igor@carcass.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Hi

Is there a way to only check if there's any pending async notifications ?
I've found only PQnotifies(..) but it also removes the first notification from
the list.
A function for only checking this can be used in a gui app to setup async
notifications processing so it happens only after an app reaches it's main
loop (which is a good idea since it won't happen in the middle of another
app's handler function which happens to use pgsql database interface).
Currently I have to check for notifications with PQnotifies every time my app
returns to the main loop after using any of PGexec, etc, which is not very
efficient.

The check function is as simple as:

int PQhasNotifies(PGconn *conn)
{
if (!conn)
return NULL;

/* Parse any available data to see if we can extract NOTIFY messages*/
parseInput(conn);

return NULL != DLGetHead(conn->notifyList);
}

--
Best regards,
Igor Shevchenko

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message D. Stimits 2003-10-11 20:08:04 more on undefined reference to 'pg_detoast_datum' and libpq
Previous Message Peter Eisentraut 2003-10-08 18:23:29 Re: Embedded SQL: Putting a guard around included