diff options
author | Felipe Pena <felipe@php.net> | 2008-11-27 02:17:22 +0000 |
---|---|---|
committer | Felipe Pena <felipe@php.net> | 2008-11-27 02:17:22 +0000 |
commit | d5bb19938d3b936deb8098d161984fa50eee89fc (patch) | |
tree | 61e0a9efb965619b6aab64ddc002b3d583fd9e55 /ext/interbase/ibase_query.c | |
parent | a9132bb75f6275a855a9fe3ee9d378bfaa7b0088 (diff) | |
download | php-git-d5bb19938d3b936deb8098d161984fa50eee89fc.tar.gz |
- MFH: New parameter parsing API
Diffstat (limited to 'ext/interbase/ibase_query.c')
-rw-r--r-- | ext/interbase/ibase_query.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/ext/interbase/ibase_query.c b/ext/interbase/ibase_query.c index c2568f66a0..9bc7b5102b 100644 --- a/ext/interbase/ibase_query.c +++ b/ext/interbase/ibase_query.c @@ -1070,7 +1070,7 @@ PHP_FUNCTION(ibase_query) { zval *zlink, *ztrans, ***bind_args = NULL; char *query; - int bind_i, query_len; + int bind_i, query_len, bind_num; long trans_res_id = 0; ibase_db_link *ib_link = NULL; ibase_trans *trans = NULL; @@ -1176,11 +1176,9 @@ PHP_FUNCTION(ibase_query) if (bind_n < expected_n) { break; } - } else if (bind_n > 0) { - bind_args = (zval ***) safe_emalloc(sizeof(zval **), ZEND_NUM_ARGS(), 0); - - if (FAILURE == zend_get_parameters_array_ex(ZEND_NUM_ARGS(), bind_args)) { - break; + } else if (bind_n > 0) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &bind_args, &bind_num) == FAILURE) { + return; } } @@ -1491,7 +1489,6 @@ static int _php_ibase_arr_zval(zval *ar_zval, char *data, unsigned long data_siz static void _php_ibase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int fetch_type) /* {{{ */ { zval *result_arg; - long flag_arg; long i, array_cnt = 0, flag = 0; ibase_result *ib_result; @@ -2059,16 +2056,16 @@ PHP_FUNCTION(ibase_field_info) Get the number of params in a prepared query */ PHP_FUNCTION(ibase_num_params) { - zval **result; + zval *result; ibase_query *ib_query; RESET_ERRMSG; - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &result) == FAILURE) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &result) == FAILURE) { + return; } - ZEND_FETCH_RESOURCE(ib_query, ibase_query *, result, -1, LE_QUERY, le_query); + ZEND_FETCH_RESOURCE(ib_query, ibase_query *, &result, -1, LE_QUERY, le_query); if (ib_query->in_sqlda == NULL) { RETURN_LONG(0); @@ -2082,28 +2079,27 @@ PHP_FUNCTION(ibase_num_params) Get information about a parameter */ PHP_FUNCTION(ibase_param_info) { - zval **result_arg, **field_arg; + zval *result_arg; + long field_arg; ibase_query *ib_query; RESET_ERRMSG; - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &result_arg, &field_arg) == FAILURE) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result_arg, &field_arg) == FAILURE) { + return; } - ZEND_FETCH_RESOURCE(ib_query, ibase_query *, result_arg, -1, LE_QUERY, le_query); + ZEND_FETCH_RESOURCE(ib_query, ibase_query *, &result_arg, -1, LE_QUERY, le_query); if (ib_query->in_sqlda == NULL) { RETURN_FALSE; } - convert_to_long_ex(field_arg); - - if (Z_LVAL_PP(field_arg) < 0 || Z_LVAL_PP(field_arg) >= ib_query->in_sqlda->sqld) { + if (field_arg < 0 || field_arg >= ib_query->in_sqlda->sqld) { RETURN_FALSE; } - _php_ibase_field_info(return_value,ib_query->in_sqlda->sqlvar + Z_LVAL_PP(field_arg)); + _php_ibase_field_info(return_value,ib_query->in_sqlda->sqlvar + field_arg); } /* }}} */ |