Merge branch 'v1.0.x'
[m6w6/ext-pq] / src / php_pqconn.c
index 07c907f..976e336 100644 (file)
@@ -552,7 +552,7 @@ php_resource_factory_ops_t *php_pqconn_get_resource_factory_ops(void)
 static void php_pqconn_wakeup(php_persistent_handle_factory_t *f, void **handle)
 {
        PGresult *res = PQexec(*handle, "");
 static void php_pqconn_wakeup(php_persistent_handle_factory_t *f, void **handle)
 {
        PGresult *res = PQexec(*handle, "");
-       php_pq_clear_res(res);
+       php_pqres_clear(res);
 
        if (CONNECTION_OK != PQstatus(*handle)) {
                PQreset(*handle);
 
        if (CONNECTION_OK != PQstatus(*handle)) {
                PQreset(*handle);
@@ -586,7 +586,7 @@ static int apply_unlisten(zval *p, int argc, va_list argv, zend_hash_key *key)
        PGresult *res = unlisten(obj->intern->conn, key->key->val, key->key->len);
 
        if (res) {
        PGresult *res = unlisten(obj->intern->conn, key->key->val, key->key->len);
 
        if (res) {
-               php_pq_clear_res(res);
+               php_pqres_clear(res);
        }
 
        return ZEND_HASH_APPLY_REMOVE;
        }
 
        return ZEND_HASH_APPLY_REMOVE;
@@ -613,7 +613,7 @@ static void php_pqconn_retire(php_persistent_handle_factory_t *f, void **handle)
        }
        /* clean up async results */
        while ((res = PQgetResult(*handle))) {
        }
        /* clean up async results */
        while ((res = PQgetResult(*handle))) {
-               php_pq_clear_res(res);
+               php_pqres_clear(res);
        }
 
        /* clean up transaction & session */
        }
 
        /* clean up transaction & session */
@@ -627,7 +627,7 @@ static void php_pqconn_retire(php_persistent_handle_factory_t *f, void **handle)
        }
 
        if (res) {
        }
 
        if (res) {
-               php_pq_clear_res(res);
+               php_pqres_clear(res);
        }
 
        if (evdata) {
        }
 
        if (evdata) {
@@ -774,7 +774,7 @@ static PHP_METHOD(pqconn, unlisten)
 
                        if (res) {
                                php_pqres_success(res);
 
                        if (res) {
                                php_pqres_success(res);
-                               php_pq_clear_res(res);
+                               php_pqres_clear(res);
                        }
                }
        }
                        }
                }
        }
@@ -891,7 +891,7 @@ static PHP_METHOD(pqconn, listen) {
                                                obj->intern->poller = PQconsumeInput;
                                                php_pqconn_add_listener(obj, channel_str, channel_len, &listener);
                                        }
                                                obj->intern->poller = PQconsumeInput;
                                                php_pqconn_add_listener(obj, channel_str, channel_len, &listener);
                                        }
-                                       php_pq_clear_res(res);
+                                       php_pqres_clear(res);
                                }
 
                                php_pqconn_notify_listeners(obj);
                                }
 
                                php_pqconn_notify_listeners(obj);
@@ -976,7 +976,7 @@ static PHP_METHOD(pqconn, notify) {
                                throw_exce(EX_RUNTIME, "Failed to notify listeners (%s)", PHP_PQerrorMessage(obj->intern->conn));
                        } else {
                                php_pqres_success(res);
                                throw_exce(EX_RUNTIME, "Failed to notify listeners (%s)", PHP_PQerrorMessage(obj->intern->conn));
                        } else {
                                php_pqres_success(res);
-                               php_pq_clear_res(res);
+                               php_pqres_clear(res);
                        }
 
                        php_pqconn_notify_listeners(obj);
                        }
 
                        php_pqconn_notify_listeners(obj);
@@ -1071,7 +1071,7 @@ static PHP_METHOD(pqconn, exec) {
                        } else if (SUCCESS == php_pqres_success(res)) {
                                php_pq_object_to_zval_no_addref(PQresultInstanceData(res, php_pqconn_event), return_value);
                        } else {
                        } else if (SUCCESS == php_pqres_success(res)) {
                                php_pq_object_to_zval_no_addref(PQresultInstanceData(res, php_pqconn_event), return_value);
                        } else {
-                               php_pq_clear_res(res);
+                               php_pqres_clear(res);
                        }
 
                        php_pqconn_notify_listeners(obj);
                        }
 
                        php_pqconn_notify_listeners(obj);
@@ -1178,7 +1178,7 @@ static PHP_METHOD(pqconn, execParams) {
                                if (SUCCESS == php_pqres_success(res)) {
                                        php_pq_object_to_zval_no_addref(PQresultInstanceData(res, php_pqconn_event), return_value);
                                } else {
                                if (SUCCESS == php_pqres_success(res)) {
                                        php_pq_object_to_zval_no_addref(PQresultInstanceData(res, php_pqconn_event), return_value);
                                } else {
-                                       php_pq_clear_res(res);
+                                       php_pqres_clear(res);
                                }
 
                                php_pqconn_notify_listeners(obj);
                                }
 
                                php_pqconn_notify_listeners(obj);
@@ -1251,7 +1251,7 @@ ZEND_RESULT_CODE php_pqconn_prepare(zval *object, php_pqconn_object_t *obj, cons
                throw_exce(EX_RUNTIME, "Failed to prepare statement (%s)", PHP_PQerrorMessage(obj->intern->conn));
        } else {
                rv = php_pqres_success(res);
                throw_exce(EX_RUNTIME, "Failed to prepare statement (%s)", PHP_PQerrorMessage(obj->intern->conn));
        } else {
                rv = php_pqres_success(res);
-               php_pq_clear_res(res);
+               php_pqres_clear(res);
                php_pqconn_notify_listeners(obj);
        }
 
                php_pqconn_notify_listeners(obj);
        }
 
@@ -1364,7 +1364,7 @@ ZEND_RESULT_CODE php_pqconn_declare(zval *object, php_pqconn_object_t *obj, cons
                throw_exce(EX_RUNTIME, "Failed to declare cursor (%s)", PHP_PQerrorMessage(obj->intern->conn));
        } else {
                rv = php_pqres_success(res);
                throw_exce(EX_RUNTIME, "Failed to declare cursor (%s)", PHP_PQerrorMessage(obj->intern->conn));
        } else {
                rv = php_pqres_success(res);
-               php_pq_clear_res(res);
+               php_pqres_clear(res);
                php_pqconn_notify_listeners(obj);
        }
 
                php_pqconn_notify_listeners(obj);
        }
 
@@ -1599,7 +1599,7 @@ ZEND_RESULT_CODE php_pqconn_start_transaction(zval *zconn, php_pqconn_object_t *
                        throw_exce(EX_RUNTIME, "Failed to start transaction (%s)", PHP_PQerrorMessage(conn_obj->intern->conn));
                } else {
                        rv = php_pqres_success(res);
                        throw_exce(EX_RUNTIME, "Failed to start transaction (%s)", PHP_PQerrorMessage(conn_obj->intern->conn));
                } else {
                        rv = php_pqres_success(res);
-                       php_pq_clear_res(res);
+                       php_pqres_clear(res);
                        php_pqconn_notify_listeners(conn_obj);
                }
 
                        php_pqconn_notify_listeners(conn_obj);
                }