static void php_pqconn_wakeup(php_persistent_handle_factory_t *f, void **handle)
{
PGresult *res = PQexec(*handle, "");
- PHP_PQclear(res);
+ php_pqres_clear(res);
if (CONNECTION_OK != PQstatus(*handle)) {
PQreset(*handle);
PGresult *res = unlisten(obj->intern->conn, key->key->val, key->key->len);
if (res) {
- PHP_PQclear(res);
+ php_pqres_clear(res);
}
return ZEND_HASH_APPLY_REMOVE;
}
/* clean up async results */
while ((res = PQgetResult(*handle))) {
- PHP_PQclear(res);
+ php_pqres_clear(res);
}
/* clean up transaction & session */
}
if (res) {
- PHP_PQclear(res);
+ php_pqres_clear(res);
}
if (evdata) {
zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh);
rv = zend_parse_parameters(ZEND_NUM_ARGS(), "|sl", &dsn_str, &dsn_len, &flags);
- zend_restore_error_handling(&zeh TSRMLS_CC);
+ zend_restore_error_handling(&zeh);
if (SUCCESS == rv) {
php_pqconn_object_t *obj = PHP_PQ_OBJ(getThis(), NULL);
php_pqconn_object_t *obj = PHP_PQ_OBJ(getThis(), NULL);
if (!obj->intern) {
- throw_exce(EX_UNINITIALIZED TSRMLS_CC, "pq\\Connection not initialized");
+ throw_exce(EX_UNINITIALIZED, "pq\\Connection not initialized");
} else {
if (!PQresetStart(obj->intern->conn)) {
- throw_exce(EX_IO TSRMLS_CC, "Failed to start connection reset (%s)", PHP_PQerrorMessage(obj->intern->conn));
+ throw_exce(EX_IO, "Failed to start connection reset (%s)", PHP_PQerrorMessage(obj->intern->conn));
} else {
obj->intern->poller = (int (*)(PGconn*)) PQresetPoll;
}
if (res) {
php_pqres_success(res);
- PHP_PQclear(res);
+ php_pqres_clear(res);
}
}
}
smart_str_appends(&cmd, quoted_channel);
smart_str_0(&cmd);
- res = PQexec(obj->intern->conn, smart_str_v(&cmd));
+ res = php_pq_exec(obj->intern->conn, smart_str_v(&cmd));
smart_str_free(&cmd);
PQfreemem(quoted_channel);
obj->intern->poller = PQconsumeInput;
php_pqconn_add_listener(obj, channel_str, channel_len, &listener);
}
- PHP_PQclear(res);
+ php_pqres_clear(res);
}
php_pqconn_notify_listeners(obj);
php_pqconn_object_t *obj = PHP_PQ_OBJ(getThis(), NULL);
if (!obj->intern) {
- throw_exce(EX_UNINITIALIZED TSRMLS_CC, "pq\\Connection not initialized");
+ throw_exce(EX_UNINITIALIZED, "pq\\Connection not initialized");
} else {
char *quoted_channel = PQescapeIdentifier(obj->intern->conn, channel_str, channel_len);
if (!quoted_channel) {
- throw_exce(EX_ESCAPE TSRMLS_CC, "Failed to escape channel identifier (%s)", PHP_PQerrorMessage(obj->intern->conn));
+ throw_exce(EX_ESCAPE, "Failed to escape channel identifier (%s)", PHP_PQerrorMessage(obj->intern->conn));
} else {
smart_str cmd = {0};
throw_exce(EX_RUNTIME, "Failed to notify listeners (%s)", PHP_PQerrorMessage(obj->intern->conn));
} else {
php_pqres_success(res);
- PHP_PQclear(res);
+ php_pqres_clear(res);
}
php_pqconn_notify_listeners(obj);
if (!obj->intern) {
throw_exce(EX_UNINITIALIZED, "pq\\Connection not initialized");
} else {
- PGresult *res = PQexec(obj->intern->conn, query_str);
+ PGresult *res = php_pq_exec(obj->intern->conn, query_str);
if (!res) {
throw_exce(EX_RUNTIME, "Failed to execute query (%s)", PHP_PQerrorMessage(obj->intern->conn));
} else if (SUCCESS == php_pqres_success(res)) {
php_pq_object_to_zval_no_addref(PQresultInstanceData(res, php_pqconn_event), return_value);
} else {
- PHP_PQclear(res);
+ php_pqres_clear(res);
}
php_pqconn_notify_listeners(obj);
if (SUCCESS == php_pqres_success(res)) {
php_pq_object_to_zval_no_addref(PQresultInstanceData(res, php_pqconn_event), return_value);
} else {
- PHP_PQclear(res);
+ php_pqres_clear(res);
}
php_pqconn_notify_listeners(obj);
obj = PHP_PQ_OBJ(object, NULL);
}
- res = PQprepare(obj->intern->conn, name, query, params->type.count, params->type.oids);
+ res = php_pq_prepare(obj->intern->conn, name, query, params->type.count, params->type.oids);
if (!res) {
rv = FAILURE;
throw_exce(EX_RUNTIME, "Failed to prepare statement (%s)", PHP_PQerrorMessage(obj->intern->conn));
} else {
rv = php_pqres_success(res);
- PHP_PQclear(res);
+ php_pqres_clear(res);
php_pqconn_notify_listeners(obj);
}
}
}
-ZEND_RESULT_CODE php_pqconn_prepare_async(zval *object, php_pqconn_object_t *obj, const char *name, const char *query, php_pq_params_t *params TSRMLS_DC)
+ZEND_RESULT_CODE php_pqconn_prepare_async(zval *object, php_pqconn_object_t *obj, const char *name, const char *query, php_pq_params_t *params)
{
ZEND_RESULT_CODE rv;
obj = PHP_PQ_OBJ(object, NULL);
}
- res = PQexec(obj->intern->conn, decl);
+ res = php_pq_exec(obj->intern->conn, decl);
if (!res) {
rv = FAILURE;
throw_exce(EX_RUNTIME, "Failed to declare cursor (%s)", PHP_PQerrorMessage(obj->intern->conn));
} else {
rv = php_pqres_success(res);
- PHP_PQclear(res);
+ php_pqres_clear(res);
php_pqconn_notify_listeners(obj);
}
}
if (!conn_obj->intern) {
- throw_exce(EX_UNINITIALIZED TSRMLS_CC, "pq\\Connection not initialized");
+ throw_exce(EX_UNINITIALIZED, "pq\\Connection not initialized");
} else {
PGresult *res;
smart_str cmd = {0};
smart_str_appends(&cmd, " DEFERRABLE");
smart_str_0(&cmd);
- res = PQexec(conn_obj->intern->conn, smart_str_v(&cmd));
+ res = php_pq_exec(conn_obj->intern->conn, smart_str_v(&cmd));
if (!res) {
throw_exce(EX_RUNTIME, "Failed to start transaction (%s)", PHP_PQerrorMessage(conn_obj->intern->conn));
} else {
rv = php_pqres_success(res);
- PHP_PQclear(res);
+ php_pqres_clear(res);
php_pqconn_notify_listeners(conn_obj);
}
php_pqconn_object_t *obj = PHP_PQ_OBJ(getThis(), NULL);
if (!obj->intern) {
- throw_exce(EX_UNINITIALIZED TSRMLS_CC, "pq\\Connection not initialized");
+ throw_exce(EX_UNINITIALIZED, "pq\\Connection not initialized");
} else {
RETVAL_LONG(php_pqconn_add_eventhandler(obj, type_str, type_len, &cb));
}
zend_hash_str_add_mem(&php_pqconn_object_prophandlers, "defaultTransactionReadonly", sizeof("defaultTransactionReadonly")-1, (void *) &ph, sizeof(ph));
ph.write = NULL;
- zend_declare_property_bool(php_pqconn_class_entry, ZEND_STRL("defaultTransactionDeferrable"), 0, ZEND_ACC_PUBLIC TSRMLS_CC);
+ zend_declare_property_bool(php_pqconn_class_entry, ZEND_STRL("defaultTransactionDeferrable"), 0, ZEND_ACC_PUBLIC);
ph.read = php_pqconn_object_read_def_txn_deferrable;
ph.write = php_pqconn_object_write_def_txn_deferrable;
zend_hash_str_add_mem(&php_pqconn_object_prophandlers, "defaultTransactionDeferrable", sizeof("defaultTransactionDeferrable")-1, (void *) &ph, sizeof(ph));