X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Fphp_pqcur.c;h=e24c042915c695ea7626f6510761f45d791dd9eb;hb=refs%2Fheads%2Fv1.0.x;hp=7680880550daec5450f586f37530411adb8bfcfe;hpb=4cfd0cce73f503b6de3eb2b281d1484f4dcb0713;p=m6w6%2Fext-pq diff --git a/src/php_pqcur.c b/src/php_pqcur.c index 7680880..e24c042 100644 --- a/src/php_pqcur.c +++ b/src/php_pqcur.c @@ -47,8 +47,8 @@ static void cur_close(php_pqcur_object_t *obj, zend_bool async, zend_bool silent throw_exce(EX_IO TSRMLS_CC, "Failed to close cursor (%s)", PHP_PQerrorMessage(obj->intern->conn->intern->conn)); } } else { - 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_pqres_clear(res); } else if (!silent) { throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to close cursor (%s)", PHP_PQerrorMessage(obj->intern->conn->intern->conn)); } @@ -62,7 +62,8 @@ static void cur_close(php_pqcur_object_t *obj, zend_bool async, zend_bool silent static void cur_open(INTERNAL_FUNCTION_PARAMETERS, zend_bool async) { zend_error_handling zeh; - STATUS rv; + ZEND_RESULT_CODE rv; + php_pqcur_object_t *obj; zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC); rv = zend_parse_parameters_none(); @@ -72,7 +73,7 @@ static void cur_open(INTERNAL_FUNCTION_PARAMETERS, zend_bool async) return; } - php_pqcur_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC); + obj = zend_object_store_get_object(getThis() TSRMLS_CC); if (!obj->intern) { throw_exce(EX_UNINITIALIZED TSRMLS_CC, "pq\\Cursor not initialized"); @@ -96,7 +97,7 @@ static void cur_fetch_or_move(INTERNAL_FUNCTION_PARAMETERS, const char *action, { char *spec_str = "1"; int spec_len = 1; - STATUS rv; + ZEND_RESULT_CODE rv; php_pq_callback_t resolver = {{0}}; zend_error_handling zeh; @@ -132,7 +133,7 @@ static void cur_fetch_or_move(INTERNAL_FUNCTION_PARAMETERS, const char *action, obj->intern->conn->intern->poller = PQconsumeInput; } } else { - PGresult *res = PQexec(obj->intern->conn->intern->conn, cmd.c); + PGresult *res = php_pq_exec(obj->intern->conn->intern->conn, cmd.c); if (!res) { throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to %s cursor (%s)", *action == 'f' ? "fetch from" : "move in", PHP_PQerrorMessage(obj->intern->conn->intern->conn)); @@ -281,7 +282,7 @@ static PHP_METHOD(pqcur, __construct) { int name_len, query_len; long flags; zval *zconn; - STATUS rv; + ZEND_RESULT_CODE rv; zend_bool async = 0; zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC); @@ -334,7 +335,7 @@ ZEND_END_ARG_INFO(); static PHP_METHOD(pqcur, close) { 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(); @@ -356,7 +357,7 @@ ZEND_END_ARG_INFO(); static PHP_METHOD(pqcur, closeAsync) { 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(); @@ -444,7 +445,7 @@ PHP_MINIT_FUNCTION(pqcur) php_pqcur_object_handlers.get_properties = php_pq_object_properties; php_pqcur_object_handlers.get_debug_info = php_pq_object_debug_info; - zend_hash_init(&php_pqcur_object_prophandlers, 2, NULL, NULL, 1); + zend_hash_init(&php_pqcur_object_prophandlers, 4, NULL, NULL, 1); zend_declare_class_constant_long(php_pqcur_class_entry, ZEND_STRL("BINARY"), PHP_PQ_DECLARE_BINARY TSRMLS_CC); zend_declare_class_constant_long(php_pqcur_class_entry, ZEND_STRL("INSENSITIVE"), PHP_PQ_DECLARE_INSENSITIVE TSRMLS_CC);