php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #44348 Wait for Postgres notifications
Submitted: 2008-03-06 00:32 UTC Modified: 2021-08-15 04:22 UTC
Votes:5
Avg. Score:3.2 ± 1.8
Reproduced:4 of 4 (100.0%)
Same Version:2 (50.0%)
Same OS:3 (75.0%)
From: p_ christ at hol dot gr Assigned: cmb (profile)
Status: No Feedback Package: PostgreSQL related
PHP Version: 5.2.5 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: p_ christ at hol dot gr
New email:
PHP Version: OS:

 

 [2008-03-06 00:32 UTC] p_ christ at hol dot gr
Description:
------------
Add one more internal PHP function that will C-poll() the Postgres file descriptor for async events.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-06 00:35 UTC] p_christ at hol dot gr
/* {{{ 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);
}
/* }}} */
 [2016-12-31 00:33 UTC] cmb@php.net
-Package: Feature/Change Request +Package: PostgreSQL related
 [2021-08-05 11:31 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-08-05 11:31 UTC] cmb@php.net
Would async pgsql connections and non-blocking queries[1]
(available as of PHP 5.6.0) resolve this request?

[1] <https://github.com/php/php-src/pull/626>
 [2021-08-15 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 05:01:28 2024 UTC