On Sat, August 5, 2006 02:43, Aleksey Kontsevich wrote:

> How about to implement above testlibpq2.c example functionality (or
> await_notification() functionality) in pqxx::trigger using select()
> <stdio.h>
> to read from socket, or to receive "event" from socket without calling any
> libpqxx function.

I don't think the trigger class is the right place to put
await_notification() because its effect is global.  You could have two
outstanding triggers A and B on the same connection, and doing an
A.await_notification() might end up delivering a notification to B instead
of one to A.  Invoking the function on A instead of on the connection
would feel a bit silly in that case.  That is why the waiting logic is in
the connection.

If you really want to have a version of await_notification in your
trigger, of course that's easy enough to add.  Just derive your own class
from pqxx::trigger that adds the function:

  void wait_notification() { m_Conn.await_notification(); }

Then derive your concrete trigger classes from that.

(BTW, don't use headers such as <stdio.h> in C++; use <cstdio> instead)

[get_notifs()]
> Its interesting: there is nothing about this functions in documentation,
> only
> in "pqxx/connection_base.hxx" listing and without comments. Need to look
> in
> source. Doxygen problem, bug?

Ah, I see it, thanks.  I think it's one of those nasty interactions
between documentation "modules" and regular class documentation.  Things
end up in unexpected places.  Right now I can't find the connection_base
class in there at all!


Jeroen


_______________________________________________
Libpqxx-general mailing list
[email protected]
http://gborg.postgresql.org/mailman/listinfo/libpqxx-general

Reply via email to