From: Michael Wallner Date: Tue, 3 May 2016 12:55:44 +0000 (+0200) Subject: rename php_pq_clear_res -> php_pqres_clear X-Git-Tag: v1.0.1~2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=b2a9a9cf919161a26c419906a2b73500bd533f96;p=m6w6%2Fext-pq rename php_pq_clear_res -> php_pqres_clear --- diff --git a/src/php_pq_misc.c b/src/php_pq_misc.c index 296c6b5..ba59183 100644 --- a/src/php_pq_misc.c +++ b/src/php_pq_misc.c @@ -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) { @@ -43,12 +43,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) { @@ -66,19 +66,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); } diff --git a/src/php_pq_misc.h b/src/php_pq_misc.h index c4fed18..eee535b 100644 --- a/src/php_pq_misc.h +++ b/src/php_pq_misc.h @@ -28,9 +28,9 @@ typedef enum { #include "php_pqres.h" /* 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); diff --git a/src/php_pqconn.c b/src/php_pqconn.c index ad1a0a9..1caf4d8 100644 --- a/src/php_pqconn.c +++ b/src/php_pqconn.c @@ -563,7 +563,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 TSRMLS_DC) { PGresult *res = PQexec(*handle, ""); - php_pq_clear_res(res); + php_pqres_clear(res); if (CONNECTION_OK != PQstatus(*handle)) { PQreset(*handle); @@ -597,7 +597,7 @@ static int apply_unlisten(void *p TSRMLS_DC, int argc, va_list argv, zend_hash_k PGresult *res = unlisten(obj->intern->conn, key->arKey, key->nKeyLength - 1 TSRMLS_CC); if (res) { - php_pq_clear_res(res); + php_pqres_clear(res); } return ZEND_HASH_APPLY_REMOVE; @@ -624,7 +624,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 */ @@ -638,7 +638,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) { @@ -783,7 +783,7 @@ static PHP_METHOD(pqconn, unlisten) if (res) { php_pqres_success(res TSRMLS_CC); - php_pq_clear_res(res); + php_pqres_clear(res); } } } @@ -894,7 +894,7 @@ static PHP_METHOD(pqconn, listen) { obj->intern->poller = PQconsumeInput; php_pqconn_add_listener(obj, channel_str, channel_len, &listener TSRMLS_CC); } - php_pq_clear_res(res); + php_pqres_clear(res); } php_pqconn_notify_listeners(obj TSRMLS_CC); @@ -979,7 +979,7 @@ static PHP_METHOD(pqconn, notify) { throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to notify listeners (%s)", PHP_PQerrorMessage(obj->intern->conn)); } else { php_pqres_success(res TSRMLS_CC); - php_pq_clear_res(res); + php_pqres_clear(res); } php_pqconn_notify_listeners(obj TSRMLS_CC); @@ -1074,7 +1074,7 @@ static PHP_METHOD(pqconn, exec) { } else if (SUCCESS == php_pqres_success(res TSRMLS_CC)) { php_pq_object_to_zval_no_addref(PQresultInstanceData(res, php_pqconn_event), &return_value TSRMLS_CC); } else { - php_pq_clear_res(res); + php_pqres_clear(res); } php_pqconn_notify_listeners(obj TSRMLS_CC); @@ -1181,7 +1181,7 @@ static PHP_METHOD(pqconn, execParams) { if (SUCCESS == php_pqres_success(res TSRMLS_CC)) { php_pq_object_to_zval_no_addref(PQresultInstanceData(res, php_pqconn_event), &return_value TSRMLS_CC); } else { - php_pq_clear_res(res); + php_pqres_clear(res); } php_pqconn_notify_listeners(obj TSRMLS_CC); @@ -1254,7 +1254,7 @@ ZEND_RESULT_CODE php_pqconn_prepare(zval *object, php_pqconn_object_t *obj, cons throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to prepare statement (%s)", PHP_PQerrorMessage(obj->intern->conn)); } else { rv = php_pqres_success(res TSRMLS_CC); - php_pq_clear_res(res); + php_pqres_clear(res); php_pqconn_notify_listeners(obj TSRMLS_CC); } @@ -1369,7 +1369,7 @@ ZEND_RESULT_CODE php_pqconn_declare(zval *object, php_pqconn_object_t *obj, cons throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to declare cursor (%s)", PHP_PQerrorMessage(obj->intern->conn)); } else { rv = php_pqres_success(res TSRMLS_CC); - php_pq_clear_res(res); + php_pqres_clear(res); php_pqconn_notify_listeners(obj TSRMLS_CC); } @@ -1606,7 +1606,7 @@ ZEND_RESULT_CODE php_pqconn_start_transaction(zval *zconn, php_pqconn_object_t * throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to start transaction (%s)", PHP_PQerrorMessage(conn_obj->intern->conn)); } else { rv = php_pqres_success(res TSRMLS_CC); - php_pq_clear_res(res); + php_pqres_clear(res); php_pqconn_notify_listeners(conn_obj TSRMLS_CC); } diff --git a/src/php_pqcopy.c b/src/php_pqcopy.c index d4a042a..c073798 100644 --- a/src/php_pqcopy.c +++ b/src/php_pqcopy.c @@ -164,7 +164,7 @@ static PHP_METHOD(pqcopy, __construct) { php_pq_object_addref(conn_obj TSRMLS_CC); } - php_pq_clear_res(res); + php_pqres_clear(res); } smart_str_free(&cmd); @@ -232,7 +232,7 @@ static PHP_METHOD(pqcopy, end) { throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to fetch COPY result (%s)", PHP_PQerrorMessage(obj->intern->conn->intern->conn)); } else { php_pqres_success(res TSRMLS_CC); - php_pq_clear_res(res); + php_pqres_clear(res); } } @@ -277,7 +277,7 @@ static PHP_METHOD(pqcopy, get) { throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to fetch COPY result (%s)", PHP_PQerrorMessage(obj->intern->conn->intern->conn)); } else { php_pqres_success(res TSRMLS_CC); - php_pq_clear_res(res); + php_pqres_clear(res); RETVAL_FALSE; } break; diff --git a/src/php_pqcur.c b/src/php_pqcur.c index cda7ebc..e24c042 100644 --- a/src/php_pqcur.c +++ b/src/php_pqcur.c @@ -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, cmd.c))) { - php_pq_clear_res(res); + php_pqres_clear(res); } else if (!silent) { throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to close cursor (%s)", PHP_PQerrorMessage(obj->intern->conn->intern->conn)); } diff --git a/src/php_pqstm.c b/src/php_pqstm.c index e075860..b82adcf 100644 --- a/src/php_pqstm.c +++ b/src/php_pqstm.c @@ -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, cmd.c))) { - php_pq_clear_res(res); + php_pqres_clear(res); } else if (!silent) { throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to deallocate statement (%s)", PHP_PQerrorMessage(obj->intern->conn->intern->conn)); } @@ -350,7 +350,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 TSRMLS_CC); } } diff --git a/src/php_pqtxn.c b/src/php_pqtxn.c index 4230266..e90a2d8 100644 --- a/src/php_pqtxn.c +++ b/src/php_pqtxn.c @@ -58,7 +58,7 @@ static void php_pqtxn_object_free(void *o TSRMLS_DC) 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 TSRMLS_CC); @@ -166,7 +166,7 @@ static void php_pqtxn_object_write_isolation(zval *object, void *o, zval *value if (res) { php_pqres_success(res TSRMLS_CC); - php_pq_clear_res(res); + php_pqres_clear(res); } } @@ -183,7 +183,7 @@ static void php_pqtxn_object_write_readonly(zval *object, void *o, zval *value T if (res) { php_pqres_success(res TSRMLS_CC); - php_pq_clear_res(res); + php_pqres_clear(res); } } @@ -200,7 +200,7 @@ static void php_pqtxn_object_write_deferrable(zval *object, void *o, zval *value if (res) { php_pqres_success(res TSRMLS_CC); - php_pq_clear_res(res); + php_pqres_clear(res); } } @@ -297,7 +297,7 @@ static PHP_METHOD(pqtxn, savepoint) { throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to create %s (%s)", cmd.c, PHP_PQerrorMessage(obj->intern->conn->intern->conn)); } else { php_pqres_success(res TSRMLS_CC); - php_pq_clear_res(res); + php_pqres_clear(res); } smart_str_free(&cmd); @@ -379,7 +379,7 @@ static PHP_METHOD(pqtxn, commit) { obj->intern->open = 0; } } - php_pq_clear_res(res); + php_pqres_clear(res); } smart_str_free(&cmd); @@ -475,7 +475,7 @@ static PHP_METHOD(pqtxn, rollback) { obj->intern->open = 0; } } - php_pq_clear_res(res); + php_pqres_clear(res); } smart_str_free(&cmd); @@ -556,7 +556,7 @@ static PHP_METHOD(pqtxn, exportSnapshot) { RETVAL_STRING(PQgetvalue(res, 0, 0), 1); } - php_pq_clear_res(res); + php_pqres_clear(res); } php_pqconn_notify_listeners(obj->intern->conn TSRMLS_CC); @@ -627,7 +627,7 @@ static PHP_METHOD(pqtxn, importSnapshot) { throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to import transaction snapshot (%s)", PHP_PQerrorMessage(obj->intern->conn->intern->conn)); } else { php_pqres_success(res TSRMLS_CC); - php_pq_clear_res(res); + php_pqres_clear(res); } smart_str_free(&cmd); diff --git a/src/php_pqtypes.c b/src/php_pqtypes.c index e3bc623..25cdc1e 100644 --- a/src/php_pqtypes.c +++ b/src/php_pqtypes.c @@ -309,7 +309,7 @@ static PHP_METHOD(pqtypes, refresh) { } } - php_pq_clear_res(res); + php_pqres_clear(res); php_pqconn_notify_listeners(obj->intern->conn TSRMLS_CC); } }