From 092b8a5657af1e152d1dd681b6fc2c23743b6c3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Czerpak?= Date: Thu, 2 Oct 2014 22:01:07 +0200 Subject: [PATCH] 2014-10-02 22:01 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/sddsqlt3/core.c * set default number of decimal places in float SQLITE3 values to _SET_DECIMAL. If user needs different number of decimal places when he converts number to strings then he can set it explicitly. Harbour does not change values of float point number retrieved from SQLITE3 and always returns original data. * do not set default length of numeric values for to string conversions. --- ChangeLog.txt | 9 +++++++++ contrib/sddsqlt3/core.c | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 85ae4b880c..c44da00e38 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,15 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2014-10-02 22:01 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * contrib/sddsqlt3/core.c + * set default number of decimal places in float SQLITE3 values + to _SET_DECIMAL. If user needs different number of decimal places + when he converts number to strings then he can set it explicitly. + Harbour does not change values of float point number retrieved + from SQLITE3 and always returns original data. + * do not set default length of numeric values for to string conversions. + 2014-10-02 16:20 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/sddsqlt3/core.c * removed dummy break statements diff --git a/contrib/sddsqlt3/core.c b/contrib/sddsqlt3/core.c index 0bac8c6536..af5b256730 100644 --- a/contrib/sddsqlt3/core.c +++ b/contrib/sddsqlt3/core.c @@ -361,7 +361,7 @@ static HB_ERRCODE sqlite3Open( SQLBASEAREAP pArea ) iDataType = sqlite3DeclType( st, uiIndex ); iSize = sqlite3_column_bytes( st, uiIndex ); - iDec = 0; + iDec = iDataType == HB_FT_LONG ? hb_setGetDecimals() : 0; pFieldInfo.uiType = ( HB_USHORT ) iDataType; pFieldInfo.uiLen = ( HB_USHORT ) iSize; @@ -512,11 +512,11 @@ static HB_ERRCODE sqlite3GoTo( SQLBASEAREAP pArea, HB_ULONG ulRecNo ) case HB_FT_INTEGER: #if HB_VMLONG_MAX > INT32_MAX && ! defined( HB_LONG_LONG_OFF ) - pItem = hb_itemPutNIntLen( NULL, sqlite3_column_int64( st, ui ), pField->uiLen ); + pItem = hb_itemPutNInt( NULL, sqlite3_column_int64( st, ui ) ); break; #endif case HB_FT_LONG: - pItem = hb_itemPutNDLen( NULL, sqlite3_column_double( st, ui ), pField->uiLen, pField->uiDec ); + pItem = hb_itemPutNDDec( NULL, sqlite3_column_double( st, ui ), pField->uiDec ); break; case HB_FT_BLOB: