fmk Fri Mar 19 13:48:18 2004 EDT
Modified files: (Branch: PHP_4_3)
/php-src/ext/mssql php_mssql.c
Log:
MFH Fix for #26589. Crash when selecting many columns of type Money
http://cvs.php.net/diff.php/php-src/ext/mssql/php_mssql.c?r1=1.86.2.28&r2=1.86.2.29&ty=u
Index: php-src/ext/mssql/php_mssql.c
diff -u php-src/ext/mssql/php_mssql.c:1.86.2.28 php-src/ext/mssql/php_mssql.c:1.86.2.29
--- php-src/ext/mssql/php_mssql.c:1.86.2.28 Mon Mar 15 14:45:39 2004
+++ php-src/ext/mssql/php_mssql.c Fri Mar 19 13:47:02 2004
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_mssql.c,v 1.86.2.28 2004/03/15 19:45:39 fmk Exp $ */
+/* $Id: php_mssql.c,v 1.86.2.29 2004/03/19 18:47:02 fmk Exp $ */
#ifdef COMPILE_DL_MSSQL
#define HAVE_MSSQL 1
@@ -796,10 +796,13 @@
Z_TYPE_P(result) = IS_STRING;
break;
}
+ case SQLMONEY4:
case SQLFLT4:
Z_DVAL_P(result) = (double) floatcol4(offset);
Z_TYPE_P(result) = IS_DOUBLE;
break;
+ case SQLMONEY:
+ case SQLMONEYN:
case SQLFLT8:
Z_DVAL_P(result) = (double) floatcol8(offset);
Z_TYPE_P(result) = IS_DOUBLE;
@@ -898,8 +901,19 @@
if ((column_type != SQLDATETIME && column_type != SQLDATETIM4) ||
MS_SQL_G(datetimeconvert)) {
- if (column_type == SQLDATETIM4) res_length += 14;
- if (column_type == SQLDATETIME) res_length += 10;
+ switch (column_type) {
+ case SQLDATETIM4 :
+ res_length += 14;
+ break;
+ case SQLDATETIME :
+ res_length += 10;
+ break;
+ case SQLMONEY :
+ case SQLMONEY4 :
+ case SQLMONEYN :
+ res_length += 5;
+ break;
+ }
res_buf = (unsigned char *) emalloc(res_length+1);
res_length =
dbconvert(NULL,coltype(offset),dbdata(mssql_ptr->link,offset), res_length, SQLCHAR,
res_buf, -1);
@@ -956,6 +970,9 @@
case SQLFLT4:
case SQLFLT8:
case SQLFLTN:
+ case SQLMONEY4:
+ case SQLMONEY:
+ case SQLMONEYN:
convert_to_double_ex(&bind->zval);
Z_DVAL_P(bind->zval) =
*((double *)(dbretdata(mssql_ptr->link,i)));
break;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php