2010-12-23 13:45 UTC+0200 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)

* harbour/contrib/rddads/ads1.c
    + added DBFIELDINFO( DBS_ISNULL, ) support
    ; ADT tables support NULL values, but ADS returns ISNULL=.T. for 
      all empty CDX values. 
    ; This modification does not alter FIELDGET() values
  * harbour/contrib/hbmemio/memio.c
    * pacified MSVC warnings
This commit is contained in:
Mindaugas Kavaliauskas
2010-12-23 11:46:22 +00:00
parent 74616b27d6
commit 2ac9ec265f
3 changed files with 133 additions and 96 deletions

View File

@@ -16,6 +16,15 @@
The license applies to all entries newer than 2009-04-28.
*/
2010-12-23 13:45 UTC+0200 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)
* harbour/contrib/rddads/ads1.c
+ added DBFIELDINFO( DBS_ISNULL, ) support
; ADT tables support NULL values, but ADS returns ISNULL=.T. for
all empty CDX values.
; This modification does not alter FIELDGET() values
* harbour/contrib/hbmemio/memio.c
* pacified MSVC warnings
2010-12-22 01:36 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/src/vm/itemapi.c
+ added support for symbol items in hb_itemString() function

View File

@@ -199,7 +199,7 @@ static PHB_MEMFS_INODE memfsInodeAlloc( const char* szName )
pInode->llSize = 0;
pInode->llAlloc = HB_MEMFS_INITSIZE;
pInode->pData = ( char * ) hb_xgrab( ( HB_ULONG ) pInode->llAlloc );
memset( pInode->pData, 0, pInode->llAlloc );
memset( pInode->pData, 0, ( HB_SIZE ) pInode->llAlloc );
pInode->szName = hb_strdup( szName );
pInode->uiCount = 1;
@@ -545,7 +545,7 @@ HB_MEMFS_EXPORT HB_SIZE hb_memfsWriteAt( HB_FHANDLE hFile, const void * pBuff, H
llNewAlloc = llOffset + ( HB_FOFFSET ) nCount;
pInode->pData = ( char * ) hb_xrealloc( pInode->pData, ( HB_SIZE ) llNewAlloc );
memset( pInode->pData + ( HB_SIZE ) pInode->llAlloc, 0, llNewAlloc - pInode->llAlloc );
memset( pInode->pData + ( HB_SIZE ) pInode->llAlloc, 0, ( HB_SIZE ) ( llNewAlloc - pInode->llAlloc ) );
pInode->llAlloc = llNewAlloc;
}
memcpy( pInode->pData + ( HB_SIZE ) llOffset, pBuff, nCount );
@@ -599,7 +599,7 @@ HB_MEMFS_EXPORT HB_BOOL hb_memfsTruncAt( HB_FHANDLE hFile, HB_FOFFSET llOffset )
llNewAlloc = llOffset;
pInode->pData = ( char * ) hb_xrealloc( pInode->pData, ( HB_SIZE ) llNewAlloc );
memset( pInode->pData + ( HB_SIZE ) pInode->llAlloc, 0, llNewAlloc - pInode->llAlloc );
memset( pInode->pData + ( HB_SIZE ) pInode->llAlloc, 0, ( HB_SIZE ) ( llNewAlloc - pInode->llAlloc ) );
pInode->llAlloc = llNewAlloc;
}
else if( ( pInode->llAlloc >> 2 ) > ( llOffset > HB_MEMFS_INITSIZE ? llOffset : HB_MEMFS_INITSIZE ) )
@@ -608,7 +608,7 @@ HB_MEMFS_EXPORT HB_BOOL hb_memfsTruncAt( HB_FHANDLE hFile, HB_FOFFSET llOffset )
pInode->pData = ( char * ) hb_xrealloc( pInode->pData, ( HB_SIZE ) pInode->llAlloc );
}
memset( pInode->pData + ( HB_SIZE ) llOffset, 0, pInode->llAlloc - llOffset );
memset( pInode->pData + ( HB_SIZE ) llOffset, 0, ( HB_SIZE ) ( pInode->llAlloc - llOffset ) );
pInode->llSize = llOffset;
HB_MEMFSMT_UNLOCK

View File

@@ -1948,111 +1948,139 @@ static HB_ERRCODE adsFieldCount( ADSAREAP pArea, HB_USHORT * uiFields )
#define adsFieldDisplay NULL
static HB_ERRCODE adsFieldInfo( AREAP pArea, HB_USHORT uiIndex, HB_USHORT uiType, PHB_ITEM pItem )
static HB_ERRCODE adsFieldInfo( ADSAREAP pArea, HB_USHORT uiIndex, HB_USHORT uiType, PHB_ITEM pItem )
{
LPFIELD pField;
HB_TRACE(HB_TR_DEBUG, ("adsFieldInfo(%p, %hu, %hu, %p)", pArea, uiIndex, uiType, pItem));
if( uiIndex > pArea->uiFieldCount )
if( uiIndex > pArea->area.uiFieldCount )
return HB_FAILURE;
if( uiType != DBS_TYPE )
return SUPER_FIELDINFO( ( AREAP ) pArea, uiIndex, uiType, pItem );
pField = pArea->lpFields + uiIndex - 1;
switch( pField->uiType )
switch( uiType )
{
case HB_FT_STRING:
if( pField->uiFlags & HB_FF_BINARY )
hb_itemPutC( pItem, "RAW" );
else if( pField->uiFlags & HB_FF_UNICODE )
hb_itemPutC( pItem, "NCHAR" );
case DBS_ISNULL:
{
UNSIGNED16 bEmpty;
if( pArea->fPositioned )
{
UNSIGNED32 u32RetVal;
u32RetVal = AdsIsEmpty( pArea->hTable, ADSFIELD( uiIndex ), &bEmpty );
if( u32RetVal != AE_SUCCESS )
{
commonError( pArea, EG_READ, ( HB_ERRCODE ) u32RetVal, 0, NULL, 0, NULL );
return HB_FAILURE;
}
}
else
bEmpty = 1;
hb_itemPutL( pItem, bEmpty != 0 );
return HB_SUCCESS;
}
case DBS_TYPE:
{
pField = pArea->area.lpFields + uiIndex - 1;
switch( pField->uiType )
{
case HB_FT_STRING:
if( pField->uiFlags & HB_FF_BINARY )
hb_itemPutC( pItem, "RAW" );
else if( pField->uiFlags & HB_FF_UNICODE )
hb_itemPutC( pItem, "NCHAR" );
#ifdef ADS_CISTRING
else if( pField->uiTypeExtended == ADS_CISTRING )
hb_itemPutC( pItem, "CICHARACTER" );
else if( pField->uiTypeExtended == ADS_CISTRING )
hb_itemPutC( pItem, "CICHARACTER" );
#endif
else
hb_itemPutC( pItem, "C" );
break;
case HB_FT_LOGICAL:
hb_itemPutC( pItem, "L" );
break;
case HB_FT_DATE:
hb_itemPutC( pItem, "D" );
break;
case HB_FT_LONG:
hb_itemPutC( pItem, "N" );
break;
case HB_FT_INTEGER:
hb_itemPutC( pItem, "I" );
break;
case HB_FT_DOUBLE:
hb_itemPutC( pItem, "B" );
break;
case HB_FT_TIME:
hb_itemPutC( pItem, "T" );
break;
case HB_FT_TIMESTAMP:
hb_itemPutC( pItem, "@" );
break;
case HB_FT_MODTIME:
hb_itemPutC( pItem, "=" );
break;
case HB_FT_ROWVER:
hb_itemPutC( pItem, "^" );
break;
case HB_FT_AUTOINC:
hb_itemPutC( pItem, "+" );
break;
case HB_FT_CURRENCY:
hb_itemPutC( pItem, "Y" );
break;
case HB_FT_CURDOUBLE:
hb_itemPutC( pItem, "Z" );
break;
case HB_FT_VARLENGTH:
if( pField->uiFlags & HB_FF_BINARY )
hb_itemPutC( pItem, "VARBINARY" );
else if( pField->uiFlags & HB_FF_UNICODE )
hb_itemPutC( pItem, "NVARCHAR" );
else
hb_itemPutC( pItem, "Q" );
break;
case HB_FT_MEMO:
if( pField->uiFlags & HB_FF_UNICODE )
hb_itemPutC( pItem, "NMEMO" );
else
hb_itemPutC( pItem, "M" );
break;
case HB_FT_IMAGE:
hb_itemPutC( pItem, "P" );
break;
case HB_FT_BLOB:
hb_itemPutC( pItem, "W" );
break;
else
hb_itemPutC( pItem, "C" );
break;
case HB_FT_LOGICAL:
hb_itemPutC( pItem, "L" );
break;
case HB_FT_DATE:
hb_itemPutC( pItem, "D" );
break;
case HB_FT_LONG:
hb_itemPutC( pItem, "N" );
break;
case HB_FT_INTEGER:
hb_itemPutC( pItem, "I" );
break;
case HB_FT_DOUBLE:
hb_itemPutC( pItem, "B" );
break;
case HB_FT_TIME:
hb_itemPutC( pItem, "T" );
break;
case HB_FT_TIMESTAMP:
hb_itemPutC( pItem, "@" );
break;
case HB_FT_MODTIME:
hb_itemPutC( pItem, "=" );
break;
case HB_FT_ROWVER:
hb_itemPutC( pItem, "^" );
break;
case HB_FT_AUTOINC:
hb_itemPutC( pItem, "+" );
break;
case HB_FT_CURRENCY:
hb_itemPutC( pItem, "Y" );
break;
case HB_FT_CURDOUBLE:
hb_itemPutC( pItem, "Z" );
break;
case HB_FT_VARLENGTH:
if( pField->uiFlags & HB_FF_BINARY )
hb_itemPutC( pItem, "VARBINARY" );
else if( pField->uiFlags & HB_FF_UNICODE )
hb_itemPutC( pItem, "NVARCHAR" );
else
hb_itemPutC( pItem, "Q" );
break;
case HB_FT_MEMO:
if( pField->uiFlags & HB_FF_UNICODE )
hb_itemPutC( pItem, "NMEMO" );
else
hb_itemPutC( pItem, "M" );
break;
case HB_FT_IMAGE:
hb_itemPutC( pItem, "P" );
break;
case HB_FT_BLOB:
hb_itemPutC( pItem, "W" );
break;
default:
hb_itemPutC( pItem, "U" );
break;
}
return HB_SUCCESS;
}
default:
hb_itemPutC( pItem, "U" );
break;
return SUPER_FIELDINFO( ( AREAP ) pArea, uiIndex, uiType, pItem );
}
return HB_SUCCESS;
}
static HB_ERRCODE adsFieldName( ADSAREAP pArea, HB_USHORT uiIndex, void * szName )