php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch pdo_mssql_money_column_conversion_fix for PDO related Bug #51213

Patch version 2010-03-05 09:38 UTC

Return to Bug #51213 | Download this patch
Patch Revisions:

Developer: alexr@oplot.com

Index: dblib_stmt.c
===================================================================
--- dblib_stmt.c	(revision 295848)
+++ dblib_stmt.c	(working copy)
@@ -166,7 +166,20 @@
 						memcpy(val->data, dbdata(H->link, i+1), val->len);
 						val->data[val->len] = '\0';
 						break;
+					case SQLMONEY:
+					case SQLMONEY4:
+					case SQLMONEYN: {
+						DBFLT8 money_value;
 
+						val->len = 32 + (2 * dbdatlen(H->link, i+1));
+						val->data = emalloc(val->len);
+
+						dbconvert(NULL, S->cols[i].coltype, dbdata(H->link, i+1), dbdatlen(H->link, i+1), SQLFLT8, (LPBYTE)&money_value, val->len);
+
+						sprintf(val->data, "%.4f", money_value);
+						val->len = strlen(val->data);
+						}
+						break;
 					default:
 						if (dbwillconvert(S->cols[i].coltype, SQLCHAR)) {
 							val->len = 32 + (2 * dbdatlen(H->link, i+1));
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 15:01:30 2024 UTC