diff options
author | Timm Friebe <thekid@php.net> | 2004-05-16 20:36:41 +0000 |
---|---|---|
committer | Timm Friebe <thekid@php.net> | 2004-05-16 20:36:41 +0000 |
commit | 22214bc11e0418e70e93bda9da83f96b87faba15 (patch) | |
tree | 10d2e742d8ab48e4d80b6dacc9756b3675345e80 | |
parent | 5eaf82b6eb0871b9f9ef2416040985abb79c24bd (diff) | |
download | php-git-22214bc11e0418e70e93bda9da83f96b87faba15.tar.gz |
- MFH: Fixed auto-conversion from long to double when LONG_MAX /
LONG_MIN where overflown
-rw-r--r-- | ext/sybase_ct/php_sybase_ct.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/ext/sybase_ct/php_sybase_ct.c b/ext/sybase_ct/php_sybase_ct.c index f156d4afdd..d715c4b0c9 100644 --- a/ext/sybase_ct/php_sybase_ct.c +++ b/ext/sybase_ct/php_sybase_ct.c @@ -1127,15 +1127,14 @@ static int php_sybase_fetch_result_row (sybase_result *result, int numrows) convert_to_long(&result->data[i][j]); break; case 2: - /* We also get numbers that are actually integers here due to the check on - * precision against > 9 (ranges are -1E10 to -1E9 and 1E9 to 1E10). As we - * cannot be sure that they "fit" into MIN_LONG <= x <= MAX_LONG, we call - * convert_to_double() on them. This is a small performance penalty, but - * ensures that "select 2147483648" will be a float and "select 2147483647" - * will be become an int. - */ convert_to_double(&result->data[i][j]); break; + case 3: + /* This signals we have an integer datatype, but we need to convert to double if we + * overflow. + */ + convert_scalar_to_number(&result->data[i][j]); + break; } } } @@ -1243,7 +1242,7 @@ static sybase_result * php_sybase_fetch_result_set (sybase_link *sybase_ptr, int case CS_DECIMAL_TYPE: result->datafmt[i].maxlength = result->datafmt[i].precision + 3; /* numeric(10) vs numeric(10, 1) */ - result->numerics[i] = (result->datafmt[i].scale == 0 && result->datafmt[i].precision <= 9) ? 1 : 2; + result->numerics[i] = (result->datafmt[i].scale == 0) ? 3 : 2; break; default: result->datafmt[i].maxlength++; |