Domanda

I have written a program in C that periodically polls variables in a PostgreSQL database into host variables and listens for notifications from the database. I am wondering if there is a solution that would either let me 1. LISTEN for a notification from the database using Embedded SQL (ECPG) or 2. select INTO host variables from the libpq command PQexec in one step, without continuously selecting and parsing the string- that is, with the same functionality as SELECT INTO (multiple host variables).

Right now, I have to set up two connections, one through EXEC SQL for the SELECT INTO capability, and another through libpq in order to create a connection pointer, which is later used by PQnotifies to listen for the notification. The program currently works, but it just seems redundant to have to set up both connections to the same database.

È stato utile?

Soluzione

It looks like you can just use the libpq interface for notifications, PQnotifies, directly in ECPG.

See this mailing list thread.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top