diff options
author | Frank M. Kromann <fmk@php.net> | 2001-06-13 17:00:32 +0000 |
---|---|---|
committer | Frank M. Kromann <fmk@php.net> | 2001-06-13 17:00:32 +0000 |
commit | a86a08cc061462218cd45bf75b495d66b933513b (patch) | |
tree | 9984ca248d17c818064637ec58f200b4386b452f /ext | |
parent | bfd1f986b173d62a3e3a455b71073f7a97ee9c51 (diff) | |
download | php-git-a86a08cc061462218cd45bf75b495d66b933513b.tar.gz |
Fixing the return type of numeric data to be numeric
Diffstat (limited to 'ext')
-rw-r--r-- | ext/mssql/php_mssql.c | 51 |
1 files changed, 32 insertions, 19 deletions
diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c index fad5894c0c..47f2ef1e44 100644 --- a/ext/mssql/php_mssql.c +++ b/ext/mssql/php_mssql.c @@ -1165,8 +1165,6 @@ static void php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) MSSQLLS_FETCH(); PLS_FETCH(); - - switch (ZEND_NUM_ARGS()) { case 1: if (zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) { @@ -1204,25 +1202,40 @@ static void php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) int data_len; int should_copy; - if (PG(magic_quotes_runtime) && Z_TYPE(result->data[result->cur_row][i]) == IS_STRING) { - data = php_addslashes(Z_STRVAL(result->data[result->cur_row][i]), Z_STRLEN(result->data[result->cur_row][i]), &result->data[result->cur_row][i].value.str.len, 1); - should_copy = 0; - } - else - { - data = Z_STRVAL(result->data[result->cur_row][i]); - data_len = Z_STRLEN(result->data[result->cur_row][i]); - should_copy = 1; - } - + if (Z_TYPE(result->data[result->cur_row][i]) == IS_STRING) { + if (PG(magic_quotes_runtime)) { + data = php_addslashes(Z_STRVAL(result->data[result->cur_row][i]), Z_STRLEN(result->data[result->cur_row][i]), &result->data[result->cur_row][i].value.str.len, 1); + should_copy = 0; + } + else + { + data = Z_STRVAL(result->data[result->cur_row][i]); + data_len = Z_STRLEN(result->data[result->cur_row][i]); + should_copy = 1; + } - if (result_type & MSSQL_NUM) { - add_index_stringl(return_value, i, data, data_len, should_copy); - should_copy = 1; + if (result_type & MSSQL_NUM) { + add_index_stringl(return_value, i, data, data_len, should_copy); + should_copy = 1; + } + + if (result_type & MSSQL_ASSOC) { + add_assoc_stringl(return_value, result->fields[i].name, data, data_len, should_copy); + } } - - if (result_type & MSSQL_ASSOC) { - add_assoc_stringl(return_value, result->fields[i].name, data, data_len, should_copy); + else if (Z_TYPE(result->data[result->cur_row][i]) == IS_LONG) { + if (result_type & MSSQL_NUM) + add_index_long(return_value, i, result->data[result->cur_row][i].value.lval); + + if (result_type & MSSQL_ASSOC) + add_assoc_long(return_value, result->fields[i].name, result->data[result->cur_row][i].value.lval); + } + else if (Z_TYPE(result->data[result->cur_row][i]) == IS_DOUBLE) { + if (result_type & MSSQL_NUM) + add_index_double(return_value, i, result->data[result->cur_row][i].value.dval); + + if (result_type & MSSQL_ASSOC) + add_assoc_double(return_value, result->fields[i].name, result->data[result->cur_row][i].value.dval); } } else |