ID: 44348 Comment by: p_christ at hol dot gr Reported By: p_ christ at hol dot gr Status: Open Bug Type: Feature/Change Request Operating System: Linux PHP Version: 5.2.5 New Comment:
/* {{{ proto array pg_wait_notify([resource connection[, timeout]]) Wait for postgres activity */ PHP_FUNCTION(pg_wait_notify) { zval *pgsql_link; int id = -1; int retval = 0; int timeout = -1; struct pollfd ps; PGconn *pgsql; if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &pgsql_link, &timeout) == FAILURE) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink); ps.fd = PQsocket(pgsql); ps.events = POLLIN; ps.revents = 0; if (ps.fd<0) RETURN_FALSE; retval = poll(&ps,1,timeout); if (retval == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to poll : %d", errno); RETURN_FALSE; } RETURN_LONG(retval); } /* }}} */ Previous Comments: ------------------------------------------------------------------------ [2008-03-06 00:32:52] p_ christ at hol dot gr Description: ------------ Add one more internal PHP function that will C-poll() the Postgres file descriptor for async events. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44348&edit=1