fix issue #9 @github: execAsync - gets another result
[m6w6/ext-pq] / src / php_pqstm.c
index d360d0dc97450dc0f823bb55014d2aa12f3cfc5a..e075860193d97f249ac12ebae8f29482ff7473d2 100644 (file)
@@ -51,8 +51,8 @@ static void php_pqstm_deallocate(php_pqstm_object_t *obj, zend_bool async, zend_
                        } else {
                                PGresult *res;
 
-                               if ((res = PQexec(obj->intern->conn->intern->conn, cmd.c))) {
-                                       PHP_PQclear(res);
+                               if ((res = php_pq_exec(obj->intern->conn->intern->conn, cmd.c))) {
+                                       php_pq_clear_res(res);
                                } else if (!silent) {
                                        throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to deallocate statement (%s)", PHP_PQerrorMessage(obj->intern->conn->intern->conn));
                                }
@@ -180,7 +180,7 @@ static PHP_METHOD(pqstm, __construct) {
        char *name_str, *query_str;
        int name_len, *query_len;
        zend_bool async = 0;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oss|a/!b", &zconn, php_pqconn_class_entry, &name_str, &name_len, &query_str, &query_len, &ztypes, &async);
@@ -217,7 +217,7 @@ static PHP_METHOD(pqstm, bind) {
        long param_no;
        zval **param_ref;
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lZ", &param_no, &param_ref);
@@ -245,7 +245,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(pqstm, exec) {
        zend_error_handling zeh;
        zval *zparams = NULL;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a/!", &zparams);
@@ -262,7 +262,7 @@ static PHP_METHOD(pqstm, exec) {
                        PGresult *res;
 
                        php_pq_params_set_params(obj->intern->params, zparams ? Z_ARRVAL_P(zparams) : &obj->intern->bound);
-                       res = PQexecPrepared(obj->intern->conn->intern->conn, obj->intern->name, obj->intern->params->param.count, (const char *const*) obj->intern->params->param.strings, NULL, NULL, 0);
+                       res = php_pq_exec_prepared(obj->intern->conn->intern->conn, obj->intern->name, obj->intern->params->param.count, (const char *const*) obj->intern->params->param.strings, NULL, NULL, 0);
                        php_pq_params_set_params(obj->intern->params, NULL);
 
                        if (!res) {
@@ -283,7 +283,7 @@ static PHP_METHOD(pqstm, execAsync) {
        zend_error_handling zeh;
        zval *zparams = NULL;
        php_pq_callback_t resolver = {{0}};
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a/!f", &zparams, &resolver.fci, &resolver.fcc);
@@ -323,7 +323,7 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqstm_desc, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(pqstm, desc) {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();
@@ -350,7 +350,7 @@ static PHP_METHOD(pqstm, desc) {
                                                add_next_index_long(return_value, PQparamtype(res, p));
                                        }
                                }
-                               PHP_PQclear(res);
+                               php_pq_clear_res(res);
                                php_pqconn_notify_listeners(obj->intern->conn TSRMLS_CC);
                        }
                }
@@ -363,7 +363,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(pqstm, descAsync) {
        zend_error_handling zeh;
        php_pq_callback_t resolver = {{0}};
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "f", &resolver.fci, &resolver.fcc);
@@ -389,7 +389,7 @@ static PHP_METHOD(pqstm, descAsync) {
 static zend_always_inline void php_pqstm_deallocate_handler(INTERNAL_FUNCTION_PARAMETERS, zend_bool async)
 {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();
@@ -423,7 +423,7 @@ static PHP_METHOD(pqstm, deallocateAsync)
 static zend_always_inline void php_pqstm_prepare_handler(INTERNAL_FUNCTION_PARAMETERS, zend_bool async)
 {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();