Martin Evans wrote:
I don't know exactly what postgres async notifications are but I know DBD::ODBC has limited support for a asynchronous mode which is pretty useful for picking up debug output etc from procedures.

DBD::ODBC has odbc_async_exec flag which is described as:

Allow asynchronous execution of queries. Right now, this causes a spin-loop (with a small "sleep") until the sql is complete. This is useful, however, if you want the error handling and asynchronous messages (see the err_handler) below. See t/20SQLServer.t for an example of this.

Not sure if this helps you at all or not but you did ask about other databases.

Martin

It is different concept. In psql you could register listener in one
process with :

LISTEN FOO;

Then if another process executes

NOTIFY FOO;

The first process receives notification.

I use it mostly to execute some code on the system when there is data
inserted, deleted or updated in some table.


Here is an example :

use DBI;
use DBI::Listen::pg;

#Callback function
sub foo {
        $dbh = shift;
        #... etc.
}

$dbh = DBI->connect($data_source, $username, $auth, \%attr);
$dbl = DBI::Listen::pg->new($dbh);
$dbl->register(’foo’,\&foo);  # on "foo" notification call foo sub
$dbl->register(’bar’,\&foo);  # on "bar" notification call foo sub
$dbl->unregister(’bar’);      # unregister callback for "bar"
$dbl->register("baz", sub { print "baz\n" } );
$dbl->run(); # loops forever waiting for events

#------ end

NOTIFY could be executed by query or stored procedure/trigger.


I hope this clarification helps

luben








Reply via email to