Merge branch 'v1.0.x'
authorMichael Wallner <mike@php.net>
Tue, 3 May 2016 13:02:54 +0000 (15:02 +0200)
committerMichael Wallner <mike@php.net>
Tue, 3 May 2016 13:02:54 +0000 (15:02 +0200)
src/php_pq_misc.c
src/php_pq_misc.h
src/php_pqconn.c
src/php_pqcopy.c
src/php_pqcur.c
src/php_pqstm.c
src/php_pqtxn.c
src/php_pqtypes.c

index 9eccae9..eb1ca97 100644 (file)
@@ -31,7 +31,7 @@
 
 
 /* clear result object associated with a result handle */
-void php_pq_clear_res(PGresult *r) {
+void php_pqres_clear(PGresult *r) {
        php_pq_object_t *o = PQresultInstanceData(r, php_pqconn_event);
 
        if (o) {
@@ -42,12 +42,12 @@ void php_pq_clear_res(PGresult *r) {
 }
 
 /* clear any asynchronous results */
-void php_pq_clear_conn(PGconn *conn) {
+void php_pqconn_clear(PGconn *conn) {
        PGresult *r;
        php_pqconn_event_data_t *evdata = PQinstanceData(conn, php_pqconn_event);
 
        while ((r = PQgetResult(conn))) {
-               php_pq_clear_res(r);
+               php_pqres_clear(r);
        }
 
        if (evdata && evdata->obj) {
@@ -63,19 +63,19 @@ void php_pq_clear_conn(PGconn *conn) {
 
 /* safe wrappers to clear any asynchronous wrappers before querying synchronously */
 PGresult *php_pq_exec(PGconn *conn, const char *query) {
-       php_pq_clear_conn(conn);
+       php_pqconn_clear(conn);
        return PQexec(conn, query);
 }
 PGresult *php_pq_exec_params(PGconn *conn, const char *command, int nParams, const Oid *paramTypes, const char *const * paramValues, const int *paramLengths, const int *paramFormats, int resultFormat) {
-       php_pq_clear_conn(conn);
+       php_pqconn_clear(conn);
        return PQexecParams(conn, command, nParams, paramTypes, paramValues, paramLengths, paramFormats, resultFormat);
 }
 PGresult *php_pq_prepare(PGconn *conn, const char *stmtName, const char *query, int nParams, const Oid *paramTypes) {
-       php_pq_clear_conn(conn);
+       php_pqconn_clear(conn);
        return PQprepare(conn, stmtName, query, nParams, paramTypes);
 }
 PGresult *php_pq_exec_prepared(PGconn *conn, const char *stmtName, int nParams, const char *const * paramValues, const int *paramLengths, const int *paramFormats, int resultFormat) {
-       php_pq_clear_conn(conn);
+       php_pqconn_clear(conn);
        return PQexecPrepared(conn, stmtName, nParams, paramValues, paramLengths, paramFormats, resultFormat);
 }
 
index 26ac0e1..2fdb7e1 100644 (file)
@@ -24,9 +24,9 @@
 #define smart_str_l(ss) (ss)->s->len
 
 /* clear result object associated with a result handle */
-extern void php_pq_clear_res(PGresult *r);
+extern void php_pqres_clear(PGresult *r);
 /* clear any asynchronous results */
-extern void php_pq_clear_conn(PGconn *conn);
+extern void php_pqconn_clear(PGconn *conn);
 /* safe wrappers to clear any asynchronous wrappers before querying synchronously */
 extern PGresult *php_pq_exec(PGconn *conn, const char *query);
 extern PGresult *php_pq_exec_params(PGconn *conn, const char *command, int nParams, const Oid *paramTypes, const char *const * paramValues, const int *paramLengths, const int *paramFormats, int resultFormat);
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, "");
-       php_pq_clear_res(res);
+       php_pqres_clear(res);
 
        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) {
-               php_pq_clear_res(res);
+               php_pqres_clear(res);
        }
 
        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))) {
-               php_pq_clear_res(res);
+               php_pqres_clear(res);
        }
 
        /* clean up transaction & session */
@@ -627,7 +627,7 @@ static void php_pqconn_retire(php_persistent_handle_factory_t *f, void **handle)
        }
 
        if (res) {
-               php_pq_clear_res(res);
+               php_pqres_clear(res);
        }
 
        if (evdata) {
@@ -774,7 +774,7 @@ static PHP_METHOD(pqconn, unlisten)
 
                        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);
                                        }
-                                       php_pq_clear_res(res);
+                                       php_pqres_clear(res);
                                }
 
                                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);
-                               php_pq_clear_res(res);
+                               php_pqres_clear(res);
                        }
 
                        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 {
-                               php_pq_clear_res(res);
+                               php_pqres_clear(res);
                        }
 
                        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 {
-                                       php_pq_clear_res(res);
+                                       php_pqres_clear(res);
                                }
 
                                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);
-               php_pq_clear_res(res);
+               php_pqres_clear(res);
                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);
-               php_pq_clear_res(res);
+               php_pqres_clear(res);
                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);
-                       php_pq_clear_res(res);
+                       php_pqres_clear(res);
                        php_pqconn_notify_listeners(conn_obj);
                }
 
index 1a6d37e..1b3a3aa 100644 (file)
@@ -155,7 +155,7 @@ static PHP_METHOD(pqcopy, __construct) {
                                        php_pq_object_addref(conn_obj);
                                }
 
-                               php_pq_clear_res(res);
+                               php_pqres_clear(res);
                        }
 
                        smart_str_free(&cmd);
@@ -223,7 +223,7 @@ static PHP_METHOD(pqcopy, end) {
                                        throw_exce(EX_RUNTIME, "Failed to fetch COPY result (%s)", PHP_PQerrorMessage(obj->intern->conn->intern->conn));
                                } else {
                                        php_pqres_success(res);
-                                       php_pq_clear_res(res);
+                                       php_pqres_clear(res);
                                }
                        }
 
@@ -268,7 +268,7 @@ static PHP_METHOD(pqcopy, get) {
                                        throw_exce(EX_RUNTIME, "Failed to fetch COPY result (%s)", PHP_PQerrorMessage(obj->intern->conn->intern->conn));
                                } else {
                                        php_pqres_success(res);
-                                       php_pq_clear_res(res);
+                                       php_pqres_clear(res);
                                        RETVAL_FALSE;
                                }
                                break;
index 4197cdf..682b78a 100644 (file)
@@ -48,7 +48,7 @@ static void cur_close(php_pqcur_object_t *obj, zend_bool async, zend_bool silent
                        }
                } else {
                        if ((res = php_pq_exec(obj->intern->conn->intern->conn, smart_str_v(&cmd)))) {
-                               php_pq_clear_res(res);
+                               php_pqres_clear(res);
                        } else if (!silent) {
                                throw_exce(EX_RUNTIME, "Failed to close cursor (%s)", PHP_PQerrorMessage(obj->intern->conn->intern->conn));
                        }
index fbab27e..4eec3b8 100644 (file)
@@ -52,7 +52,7 @@ static void php_pqstm_deallocate(php_pqstm_object_t *obj, zend_bool async, zend_
                                PGresult *res;
 
                                if ((res = php_pq_exec(obj->intern->conn->intern->conn, smart_str_v(&cmd)))) {
-                                       php_pq_clear_res(res);
+                                       php_pqres_clear(res);
                                } else if (!silent) {
                                        throw_exce(EX_RUNTIME, "Failed to deallocate statement (%s)", PHP_PQerrorMessage(obj->intern->conn->intern->conn));
                                }
@@ -340,7 +340,7 @@ static PHP_METHOD(pqstm, desc) {
                                                add_next_index_long(return_value, PQparamtype(res, p));
                                        }
                                }
-                               php_pq_clear_res(res);
+                               php_pqres_clear(res);
                                php_pqconn_notify_listeners(obj->intern->conn);
                        }
                }
index 7b57ebf..9a97a8f 100644 (file)
@@ -58,7 +58,7 @@ static void php_pqtxn_object_free(zend_object *o)
                        PGresult *res = php_pq_exec(obj->intern->conn->intern->conn, "ROLLBACK");
 
                        if (res) {
-                               php_pq_clear_res(res);
+                               php_pqres_clear(res);
                        }
                }
                php_pq_object_delref(obj->intern->conn);
@@ -140,7 +140,7 @@ static void php_pqtxn_object_write_isolation(zval *object, void *o, zval *value)
 
        if (res) {
                php_pqres_success(res);
-               php_pq_clear_res(res);
+               php_pqres_clear(res);
        }
 }
 
@@ -157,7 +157,7 @@ static void php_pqtxn_object_write_readonly(zval *object, void *o, zval *value)
 
        if (res) {
                php_pqres_success(res);
-               php_pq_clear_res(res);
+               php_pqres_clear(res);
        }
 }
 
@@ -174,7 +174,7 @@ static void php_pqtxn_object_write_deferrable(zval *object, void *o, zval *value
 
        if (res) {
                php_pqres_success(res);
-               php_pq_clear_res(res);
+               php_pqres_clear(res);
        }
 }
 
@@ -271,7 +271,7 @@ static PHP_METHOD(pqtxn, savepoint) {
                                throw_exce(EX_RUNTIME, "Failed to create %s (%s)", smart_str_v(&cmd), PHP_PQerrorMessage(obj->intern->conn->intern->conn));
                        } else {
                                php_pqres_success(res);
-                               php_pq_clear_res(res);
+                               php_pqres_clear(res);
                        }
 
                        smart_str_free(&cmd);
@@ -354,7 +354,7 @@ static PHP_METHOD(pqtxn, commit) {
                                                obj->intern->open = 0;
                                        }
                                }
-                               php_pq_clear_res(res);
+                               php_pqres_clear(res);
                        }
 
                        smart_str_free(&cmd);
@@ -452,7 +452,7 @@ static PHP_METHOD(pqtxn, rollback) {
                                                obj->intern->open = 0;
                                        }
                                }
-                               php_pq_clear_res(res);
+                               php_pqres_clear(res);
                        }
 
                        smart_str_free(&cmd);
@@ -534,7 +534,7 @@ static PHP_METHOD(pqtxn, exportSnapshot) {
                                        RETVAL_STRING(PQgetvalue(res, 0, 0));
                                }
 
-                               php_pq_clear_res(res);
+                               php_pqres_clear(res);
                        }
 
                        php_pqconn_notify_listeners(obj->intern->conn);
@@ -605,7 +605,7 @@ static PHP_METHOD(pqtxn, importSnapshot) {
                                        throw_exce(EX_RUNTIME, "Failed to import transaction snapshot (%s)", PHP_PQerrorMessage(obj->intern->conn->intern->conn));
                                } else {
                                        php_pqres_success(res);
-                                       php_pq_clear_res(res);
+                                       php_pqres_clear(res);
                                }
 
                                smart_str_free(&cmd);
index 3f05248..8fd12e0 100644 (file)
@@ -264,7 +264,7 @@ static PHP_METHOD(pqtypes, refresh) {
                                        }
                                }
 
-                               php_pq_clear_res(res);
+                               php_pqres_clear(res);
                                php_pqconn_notify_listeners(obj->intern->conn);
                        }
                }