NOTIFY/LISTEN Using Embedded SQL (ecpg)
От | Craig Orsinger |
---|---|
Тема | NOTIFY/LISTEN Using Embedded SQL (ecpg) |
Дата | |
Msg-id | j2xO6.21984$BN6.885585@newsread1.prod.itd.earthlink.net обсуждение исходный текст |
Ответы |
Re: NOTIFY/LISTEN Using Embedded SQL (ecpg)
|
Список | pgsql-general |
[cross posted from comp.databases.postgresql.general] I seem to have painted myself into a corner, technologically speaking. I am implementing a database using embedded SQL, and PostgreSQL 6.5.3 as the backend. The problem is that I would like to use the NOTIFY feature, but the only way I've found of doing this from within a C program is to use the 'PQnotifies()' function, which requires a PGconn connection its first parameter. ESQL doesn't provide this connection information as far as I can tell. So, it appears that I can set up my program to LISTEN or UNLISTEN using embedded SQL, but I can't get a notification when it's sent. Or so I think. _Is_ there a way to get the libpq connection info from the ESQL CONNECT call? Does anyone have a suggestion (other than completely rewriting my application in libpq calls)? Pointers to any examples of how this is done would be especially helpful, but any hints would be appreciated. Here's an example that may help illustrate my problem: int main() { PGconn *conn = NULL; EXEC SQL CONNECT database ; EXEC SQL LISTEN foo_changed ; for( ; /* EVER */ ; ) { if( PQnotifies(conn) ) /* conn is still NULL */ printf("Something happened\n" ) ; ..... } }
В списке pgsql-general по дате отправления: