2014-11-18 14:13 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* include/dbinfo.ch
    + added new rddInfo() action: RDDI_DECIMALS

  * include/hbrdddbf.h
  * src/rdd/dbf1.c
    + added support for RDDI_DECIMALS - when set it's used as default number
      of decimal places in conversions to string for fields type "B" and "8"
      with 0 number of decimal places in DBF header.
This commit is contained in:
Przemysław Czerpak
2014-11-18 14:13:03 +01:00
parent 926f351208
commit 41ddee0ea9
4 changed files with 29 additions and 4 deletions

View File

@@ -10,10 +10,20 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2014-11-18 14:13 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* include/dbinfo.ch
+ added new rddInfo() action: RDDI_DECIMALS
* include/hbrdddbf.h
* src/rdd/dbf1.c
+ added support for RDDI_DECIMALS - when set it's used as default number
of decimal places in conversions to string for fields type "B" and "8"
with 0 number of decimal places in DBF header.
2014-11-14 18:05 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* src/rtl/hbsocket.c
* clear socket error after successful connect
* src/rtl/hbznet.c
! fixed possible connection interrupting when data incomes fragmented
in very small peaces

View File

@@ -106,6 +106,7 @@
#define RDDI_LOCKRETRY 43 /* Get/Set record and file lock timeout value */
#define RDDI_DIRTYREAD 44 /* Get/Set index dirty read flag */
#define RDDI_INDEXPAGESIZE 45 /* Get/Set default index page size */
#define RDDI_DECIMALS 46 /* Get/Set default number of decimal places for numeric fields if it's undefined */
/*
Constants for SELF_ORDINFO ()

View File

@@ -142,6 +142,7 @@ typedef struct _DBFDATA
HB_BYTE bCryptType; /* DB_CRYPT_NONE */
HB_BYTE bMemoType; /* DB_MEMO_FPT */
HB_BYTE bMemoExtType; /* DB_MEMOVER_FLEX */
HB_BYTE bDecimals; /* RDDI_DECIMALS */
HB_USHORT uiDirtyRead; /* HB_IDXREAD_CLEANMASK */
HB_USHORT uiIndexPageSize; /* 0 */
HB_ULONG ulMemoBlockSize; /* 0 */

View File

@@ -3955,7 +3955,7 @@ static HB_ERRCODE hb_dbfNewArea( DBFAREAP pArea )
static HB_ERRCODE hb_dbfOpen( DBFAREAP pArea, LPDBOPENINFO pOpenInfo )
{
HB_ERRCODE errCode, errOsCode;
HB_USHORT uiFlags, uiFields, uiCount, uiSkip;
HB_USHORT uiFlags, uiFields, uiCount, uiSkip, uiDecimals;
HB_SIZE nSize;
HB_BOOL fRawBlob;
PHB_ITEM pError, pItem;
@@ -4071,7 +4071,9 @@ static HB_ERRCODE hb_dbfOpen( DBFAREAP pArea, LPDBOPENINFO pOpenInfo )
hb_itemClear( pItem );
fRawBlob = SELF_RDDINFO( SELF_RDDNODE( &pArea->area ), RDDI_BLOB_SUPPORT, pOpenInfo->ulConnection, pItem ) == HB_SUCCESS &&
hb_itemGetL( pItem );
hb_itemClear( pItem );
uiDecimals = SELF_RDDINFO( SELF_RDDNODE( &pArea->area ), RDDI_DECIMALS, pOpenInfo->ulConnection, pItem ) == HB_SUCCESS ?
hb_itemGetNI( pItem ) : 0;
hb_itemRelease( pItem );
if( fRawBlob )
@@ -4284,9 +4286,10 @@ static HB_ERRCODE hb_dbfOpen( DBFAREAP pArea, LPDBOPENINFO pOpenInfo )
dbFieldInfo.uiDec = pField->bDec;
if( dbFieldInfo.uiLen != 8 )
errCode = HB_FAILURE;
else if( dbFieldInfo.uiDec == 0 )
dbFieldInfo.uiDec = uiDecimals;
break;
/* types which are not supported by VM - mapped to different ones */
case 'T':
if( dbFieldInfo.uiLen == 8 )
dbFieldInfo.uiType = HB_FT_TIMESTAMP;
@@ -4296,6 +4299,7 @@ static HB_ERRCODE hb_dbfOpen( DBFAREAP pArea, LPDBOPENINFO pOpenInfo )
errCode = HB_FAILURE;
break;
/* types which are not supported by VM - mapped to different ones */
case '@':
dbFieldInfo.uiType = HB_FT_TIMESTAMP;
if( dbFieldInfo.uiLen != 8 )
@@ -5969,6 +5973,15 @@ static HB_ERRCODE hb_dbfRddInfo( LPRDDNODE pRDD, HB_USHORT uiIndex, HB_ULONG ulC
pData->uiIndexPageSize = ( HB_USHORT ) iPageSize;
break;
}
case RDDI_DECIMALS:
{
int iDecimals = HB_IS_NUMERIC( pItem ) ? hb_itemGetNI( pItem ) : -1;
hb_itemPutNI( pItem, pData->bDecimals );
if( iDecimals >= 0 && iDecimals <= 20 )
pData->bDecimals = ( HB_BYTE ) iDecimals;
break;
}
case RDDI_TRIGGER:
{
char * szTrigger = pData->szTrigger;