fmk Thu Jul 3 12:53:05 2003 EDT Modified files: /php-src/ext/mssql php_mssql.c Log: Change fetch functions and protos so they make more sense. fetch_row or fetch_assoc should not take the optional parameter Index: php-src/ext/mssql/php_mssql.c diff -u php-src/ext/mssql/php_mssql.c:1.114 php-src/ext/mssql/php_mssql.c:1.115 --- php-src/ext/mssql/php_mssql.c:1.114 Fri Jun 13 23:34:42 2003 +++ php-src/ext/mssql/php_mssql.c Thu Jul 3 12:53:04 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_mssql.c,v 1.114 2003/06/14 03:34:42 fmk Exp $ */ +/* $Id: php_mssql.c,v 1.115 2003/07/03 16:53:04 fmk Exp $ */ #ifdef COMPILE_DL_MSSQL #define HAVE_MSSQL 1 @@ -1262,12 +1262,16 @@ /* }}} */ -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 @@ 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 @@ 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 @@ 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); } /* }}} */
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php