From 48adfafab8a347c2b1b62292e013f30af52feb9f Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Mon, 8 Mar 2010 12:39:44 +0000 Subject: [PATCH] Fixed bug #51213 (pdo_mssql is trimming value of the money column). --- NEWS | 2 ++ ext/pdo_dblib/dblib_stmt.c | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index ca8cc5c2d70..78abcbc5e50 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,8 @@ PHP NEWS - Added stream filter support to mcrypt extension (ported from mcrypt_filter). (Stas) +- Fixed bug #51213 (pdo_mssql is trimming value of the money column). (Ilia, + alexr at oplot dot com) - Fixed bug #51190 (ftp_put() returns false when transfer was successful). (Ilia) - Fixed bug #51176 (Static calling in non-static method behaves like $this->). diff --git a/ext/pdo_dblib/dblib_stmt.c b/ext/pdo_dblib/dblib_stmt.c index 6ce7ec7cfae..a9f8cf2f0c6 100644 --- a/ext/pdo_dblib/dblib_stmt.c +++ b/ext/pdo_dblib/dblib_stmt.c @@ -166,7 +166,14 @@ static int pdo_dblib_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC) 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; + dbconvert(NULL, S->cols[i].coltype, dbdata(H->link, i+1), dbdatlen(H->link, i+1), SQLFLT8, (LPBYTE)&money_value, val->len); + val->len = spprintf(val->data, 0, "%.4f", money_value); + } + break; default: if (dbwillconvert(S->cols[i].coltype, SQLCHAR)) { val->len = 32 + (2 * dbdatlen(H->link, i+1));