From 55e43151d556af68b8a66e245e295adef2ffa16d Mon Sep 17 00:00:00 2001 From: Dan Kalowsky Date: Wed, 24 Apr 2002 22:07:29 +0000 Subject: [PATCH] clearing up some code to remove any possible confusion in variable counts --- ext/odbc/php_odbc.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index 4a7b214d6f..6ee3e8f7e2 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -1546,14 +1546,19 @@ PHP_FUNCTION(odbc_fetch_row) #endif numArgs = ZEND_NUM_ARGS(); - if (numArgs == 1) { - if (zend_get_parameters_ex(1, &pv_res) == FAILURE) - WRONG_PARAM_COUNT; - } else { - if (zend_get_parameters_ex(2, &pv_res, &pv_row) == FAILURE) + switch (numArgs) { + case 1: + if (zend_get_parameters_ex(1, &pv_res) == FAILURE) + WRONG_PARAM_COUNT; + break; + case 2: + if (zend_get_parameters_ex(2, &pv_res, &pv_row) == FAILURE) + WRONG_PARAM_COUNT; + convert_to_long_ex(pv_row); + rownum = Z_LVAL_PP(pv_row); + break; + default: WRONG_PARAM_COUNT; - convert_to_long_ex(pv_row); - rownum = Z_LVAL_PP(pv_row); } ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); @@ -1647,7 +1652,7 @@ PHP_FUNCTION(odbc_result) } if (result->fetched == 0) { - /* User forgot to call odbc_fetchrow(), let's do it here */ + /* User forgot to call odbc_fetch_row(), or wants to reload the results, do it now */ #ifdef HAVE_SQL_EXTENDED_FETCH if (result->fetch_abs) rc = SQLExtendedFetch(result->stmt, SQL_FETCH_NEXT, 1, &crow,RowStatus); -- 2.40.0