Method Sql.pgsql()->set_notify_callback()
- Method
set_notify_callback
finalvoidset_notify_callback(stringcondition,void|function(int,string,string,mixed... :void)notify_cb,void|intselfnotify,mixed...args)- Description
With PostgreSQL you can LISTEN to NOTIFY events. This function allows you to detect and handle such events.
- Parameter
condition Name of the notification event we're listening to. A special case is the empty string, which matches all events, and can be used as fallback function which is called only when the specific condition is not handled. Another special case is
"_lost"which gets called whenever the connection to the database unexpectedly drops.- Parameter
notify_cb Function to be called on receiving a notification-event of condition
condition. The callback function is invoked withvoid notify_cb(pid,condition,extrainfo, .. args);pid is the process id of the database session that originated the event. condition contains the current condition. extrainfo contains optional extra information specified by the database. The rest of the arguments tonotify_cbare passed verbatim fromargs. The callback function must return no value.- Parameter
selfnotify Normally notify events generated by your own session are ignored. If you want to receive those as well, set
selfnotifyto one.- Parameter
args Extra arguments to pass to
notify_cb.- Note
This function is PostgreSQL-specific.