From d77e8393cdd817f0ca8d0c07c0beed95d7ba75b0 Mon Sep 17 00:00:00 2001 From: "Frank M. Kromann" Date: Thu, 3 Jul 2003 16:53:04 +0000 Subject: Change fetch functions and protos so they make more sense. fetch_row or fetch_assoc should not take the optional parameter --- ext/mssql/php_mssql.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'ext/mssql/php_mssql.c') diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c index 03f44097bd..57b4e6631b 100644 --- a/ext/mssql/php_mssql.c +++ b/ext/mssql/php_mssql.c @@ -1262,12 +1262,16 @@ PHP_FUNCTION(mssql_num_fields) /* }}} */ -static void php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) +static void php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type, int expected_args) { zval **mssql_result_index, **resulttype = NULL; mssql_result *result; int i; + if (ZEND_NUM_ARGS() > expected_args) { + WRONG_PARAM_COUNT; + } + switch (ZEND_NUM_ARGS()) { case 1: if (zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) { @@ -1355,11 +1359,11 @@ static void php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) result->cur_row++; } -/* {{{ proto array mssql_fetch_row(resource result_id [, int result_type]) +/* {{{ proto array mssql_fetch_row(resource result_id) Returns an array of the current row in the result set specified by result_id */ PHP_FUNCTION(mssql_fetch_row) { - php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MSSQL_NUM); + php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MSSQL_NUM, 1); } /* }}} */ @@ -1368,7 +1372,7 @@ PHP_FUNCTION(mssql_fetch_row) Returns a psuedo-object of the current row in the result set specified by result_id */ PHP_FUNCTION(mssql_fetch_object) { - php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MSSQL_ASSOC); + php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MSSQL_ASSOC, 2); if (Z_TYPE_P(return_value)==IS_ARRAY) { object_and_properties_init(return_value, ZEND_STANDARD_CLASS_DEF_PTR, Z_ARRVAL_P(return_value)); } @@ -1380,16 +1384,16 @@ PHP_FUNCTION(mssql_fetch_object) Returns an associative array of the current row in the result set specified by result_id */ PHP_FUNCTION(mssql_fetch_array) { - php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MSSQL_BOTH); + php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MSSQL_BOTH, 2); } /* }}} */ -/* {{{ proto array mssql_fetch_assoc(resource result_id [, int result_type]) +/* {{{ proto array mssql_fetch_assoc(resource result_id) Returns an associative array of the current row in the result set specified by result_id */ PHP_FUNCTION(mssql_fetch_assoc) { - php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MSSQL_ASSOC); + php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MSSQL_ASSOC, 1); } /* }}} */ -- cgit v1.2.1