summaryrefslogtreecommitdiff
path: root/ext/mssql/php_mssql.c
diff options
context:
space:
mode:
authorFrank M. Kromann <fmk@php.net>2003-07-03 16:53:04 +0000
committerFrank M. Kromann <fmk@php.net>2003-07-03 16:53:04 +0000
commitd77e8393cdd817f0ca8d0c07c0beed95d7ba75b0 (patch)
treef30cd16c6bca2287202b13ce697d1ece9a06c3ef /ext/mssql/php_mssql.c
parentd7e14ad8a3f0c2f4b5f4820ec3caca7be59a9b71 (diff)
downloadphp-git-d77e8393cdd817f0ca8d0c07c0beed95d7ba75b0.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 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);
}
/* }}} */