1
0
mirror of https://github.com/danog/ext-pq.git synced 2024-11-30 04:19:49 +01:00

rename php_pq_clear_res -> php_pqres_clear

This commit is contained in:
Michael Wallner 2016-05-03 14:55:44 +02:00
parent a06db6d217
commit b2a9a9cf91
No known key found for this signature in database
GPG Key ID: 480E3E14B0A4C7C7
8 changed files with 37 additions and 37 deletions

View 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) {
@ -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);
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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;

View 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, 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));
}

View 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, 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);
}
}

View File

@ -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);

View File

@ -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);
}
}