fmk             Wed Jun 30 15:47:18 2004 EDT

  Modified files:              (Branch: PHP_4_3)
    /php-src/ext/mssql  php_mssql.c 
  Log:
  MFH: Fix for #28512. Allocate enough space to store data
  
http://cvs.php.net/diff.php/php-src/ext/mssql/php_mssql.c?r1=1.86.2.33&r2=1.86.2.34&ty=u
Index: php-src/ext/mssql/php_mssql.c
diff -u php-src/ext/mssql/php_mssql.c:1.86.2.33 php-src/ext/mssql/php_mssql.c:1.86.2.34
--- php-src/ext/mssql/php_mssql.c:1.86.2.33     Thu Jun  3 21:02:21 2004
+++ php-src/ext/mssql/php_mssql.c       Wed Jun 30 15:47:18 2004
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_mssql.c,v 1.86.2.33 2004/06/04 01:02:21 pollita Exp $ */
+/* $Id: php_mssql.c,v 1.86.2.34 2004/06/30 19:47:18 fmk Exp $ */
 
 #ifdef COMPILE_DL_MSSQL
 #define HAVE_MSSQL 1
@@ -847,8 +847,21 @@
 
                                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 :
+                                               case SQLDECIMAL :
+                                               case SQLNUMERIC :
+                                                       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);
@@ -917,6 +930,8 @@
                                case SQLMONEY :
                                case SQLMONEY4 :
                                case SQLMONEYN :
+                               case SQLDECIMAL :
+                               case SQLNUMERIC :
                                        res_length += 5;
                                        break;
                        }

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

Reply via email to