Patch pg_send_query_flush_buffer.patch for PostgreSQL related Bug #65015
Patch version 2013-06-12 03:07 UTC
Return to Bug #65015 |
Download this patch
Patch Revisions:
Developer: adam@vektah.net
--- php-5.4.16/ext/pgsql/pgsql.c 2013-06-05 15:03:57.000000000 +1000
+++ php-5.4.16-patched/ext/pgsql/pgsql.c 2013-06-12 12:56:05.908199778 +1000
@@ -4573,6 +4573,7 @@ PHP_FUNCTION(pg_send_query)
PGconn *pgsql;
PGresult *res;
int leftover = 0;
+ int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs",
&pgsql_link, &query, &len) == FAILURE) {
@@ -4600,6 +4601,13 @@ PHP_FUNCTION(pg_send_query)
RETURN_FALSE;
}
}
+
+ while(ret = PQflush(pgsql)) {
+ if(ret == -1) {
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not empty postgres send buffer");
+ }
+ }
+
if (PQ_SETNONBLOCKING(pgsql, 0)) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode");
}
@@ -4620,6 +4628,7 @@ PHP_FUNCTION(pg_send_query_params)
PGconn *pgsql;
PGresult *res;
int leftover = 0;
+ int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsa/", &pgsql_link, &query, &query_len, &pv_param_arr) == FAILURE) {
return;
@@ -4686,6 +4695,13 @@ PHP_FUNCTION(pg_send_query_params)
}
}
_php_pgsql_free_params(params, num_params);
+
+ while(ret = PQflush(pgsql)) {
+ if(ret == -1) {
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not empty postgres send buffer");
+ }
+ }
+
if (PQ_SETNONBLOCKING(pgsql, 0)) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode");
}
|