summaryrefslogtreecommitdiff
path: root/ext/mssql/php_mssql.c
diff options
context:
space:
mode:
authorFrank M. Kromann <fmk@php.net>2003-07-03 16:47:10 +0000
committerFrank M. Kromann <fmk@php.net>2003-07-03 16:47:10 +0000
commite5523b4954248084a24b8190a31a2891ca04b7b1 (patch)
treebefa639f3747b08639b5695010a41434fed551f4 /ext/mssql/php_mssql.c
parentde9f4018774dad911eee045938f8ef8fb4ae42ba (diff)
downloadphp-git-e5523b4954248084a24b8190a31a2891ca04b7b1.tar.gz
Change fetch functions and protos so they make more sense.
fetch_row or fetch_assoc should not take the optional parameter
Diffstat (limited to 'ext/mssql/php_mssql.c')
-rw-r--r--ext/mssql/php_mssql.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c
index 21612aab30..6a85dd2214 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) {
@@ -1357,11 +1361,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);
}
/* }}} */
@@ -1370,7 +1374,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));
}
@@ -1382,16 +1386,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);
}
/* }}} */