/*
* call-seq:
* conn.get_notify()
*
* Returns an array of the unprocessed notifiers.
* If there is no unprocessed notifier, it returns +nil+.
*/
static VALUE
pgconn_get_notify(obj)
VALUE obj;
{
PGconn* conn = get_pgconn(obj);
PGnotify *notify;
VALUE ary;
if (PQconsumeInput(conn) == 0) {
rb_raise(rb_ePGError, PQerrorMessage(conn));
}
/* gets notify and builds result */
notify = PQnotifies(conn);
if (notify == NULL) {
/* there are no unhandled notifications */
return Qnil;
}
ary = rb_ary_new3(2, rb_tainted_str_new2(notify->relname), INT2NUM(notify->be_pid));
PQfreemem(notify);
/* returns result */
return ary;
}