thekid          Sun May 16 16:36:41 2004 EDT

  Modified files:              (Branch: PHP_4_3)
    /php-src/ext/sybase_ct      php_sybase_ct.c 
  Log:
  - MFH: Fixed auto-conversion from long to double when LONG_MAX /
    LONG_MIN where overflown
  
http://cvs.php.net/diff.php/php-src/ext/sybase_ct/php_sybase_ct.c?r1=1.73.2.12&r2=1.73.2.13&ty=u
Index: php-src/ext/sybase_ct/php_sybase_ct.c
diff -u php-src/ext/sybase_ct/php_sybase_ct.c:1.73.2.12 
php-src/ext/sybase_ct/php_sybase_ct.c:1.73.2.13
--- php-src/ext/sybase_ct/php_sybase_ct.c:1.73.2.12     Fri Apr 16 12:27:57 2004
+++ php-src/ext/sybase_ct/php_sybase_ct.c       Sun May 16 16:36:41 2004
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_sybase_ct.c,v 1.73.2.12 2004/04/16 16:27:57 thetaphi Exp $ */
+/* $Id: php_sybase_ct.c,v 1.73.2.13 2004/05/16 20:36:41 thekid Exp $ */
 
 
 #ifdef HAVE_CONFIG_H
@@ -1127,15 +1127,14 @@
                                                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 @@
                        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++;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to