2002-01-17 15:32 UTC+0300 Alexander Kresin <alex@belacy.belgorod.su>

This commit is contained in:
Alexander S.Kresin
2002-01-17 12:29:29 +00:00
parent 22ade6b2f0
commit 56776d498a
3 changed files with 124 additions and 121 deletions

View File

@@ -7,6 +7,11 @@
For example:
2002-12-01 23:12 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2002-01-18 17:45 UTC+0300 Alexander Kresin <alex@belacy.belgorod.su>
* source/rdd/dbfntx/dbfntx1.c
* support of EVAL and EVERY clauses of INDEX ON command implemented
2002-01-18 13:42 UTC+0300 Alexander Kresin <alex@belacy.belgorod.su>
* source/rdd/dbfntx/dbfntx1.c
* WHILE, etc, conditions support implemented (DBFNTX )

View File

@@ -156,6 +156,7 @@ typedef struct _TAGINFO
USHORT keyNext;
LPKEYINFO CurKeyInfo;
LPPAGEINFO RootPage;
BOOL InIndex;
struct _NTXINDEX * Owner;
struct _TAGINFO * pNext;
} TAGINFO;
@@ -192,6 +193,8 @@ typedef struct _NTXHEADER /* Header of NTX file */
USHORT half_page;
char key_expr[ NTX_MAX_KEY ];
char unique;
char reserve[9];
char for_expr[ NTX_MAX_KEY ];
} NTXHEADER;
typedef NTXHEADER * LPNTXHEADER;
@@ -322,7 +325,8 @@ static ERRCODE ntxSeek( NTXAREAP pArea, BOOL bSoftSeek, PHB_ITEM pKey, BOOL bFin
#define ntxSkipFilter NULL
static ERRCODE ntxSkipRaw( NTXAREAP pArea, LONG lToSkip );
#define ntxAddField NULL
static ERRCODE ntxAppend( NTXAREAP pArea, BOOL bUnLockAll );
// static ERRCODE ntxAppend( NTXAREAP pArea, BOOL bUnLockAll );
#define ntxAppend NULL
#define ntxCreateFields NULL
#define ntxDeleteRec NULL
#define ntxDeleted NULL

View File

@@ -182,6 +182,36 @@ static char * numToStr( PHB_ITEM pItem, char* szBuffer, USHORT length, USHORT de
return szBuffer;
}
static BOOL checkLogicalExpr( PHB_ITEM pForItem, PHB_ITEM pItem )
{
HB_MACRO_PTR pMacro;
BOOL res, lNewItem = FALSE;
if( !pItem )
{
pItem = hb_itemNew( NULL );
lNewItem = TRUE;
}
if( hb_itemType( pForItem ) == HB_IT_BLOCK )
{
hb_vmPushSymbol( &hb_symEval );
hb_vmPush( pForItem );
hb_vmDo( 0 );
hb_itemCopy( pItem, &hb_stack.Return );
}
else
{
pMacro = ( HB_MACRO_PTR ) hb_itemGetPtr( pForItem );
hb_macroRun( pMacro );
hb_itemCopy( pItem, hb_stackItemFromTop( - 1 ) );
hb_stackPop();
}
res = hb_itemGetL( pItem );
if( lNewItem )
hb_itemRelease( pItem );
return res;
}
/* Implementation of internal functions */
static LPKEYINFO hb_ntxKeyNew( LPKEYINFO pKeyFrom )
@@ -218,22 +248,22 @@ static LONG hb_ntxTagKeyFind( LPTAGINFO pTag, LPKEYINFO pKey, BOOL * result )
K = hb_ntxTagFindCurrentKey( hb_ntxPageLoad( 0 ), pKey->Tag, pKey, FALSE, TRUE, 1 );
if( K == 0 )
{
if( pTag->pForItem == NULL )
{
// if( pTag->pForItem == NULL )
// {
*result = TRUE;
return pKey->Xtra;
}
else
// }
// else
/* TODO: test for expression */
pTag->TagEOF = TRUE;
// pTag->TagEOF = TRUE;
}
else if( K < 0 )
{
if( pTag->pForItem == NULL )
// if( pTag->pForItem == NULL )
return pKey->Xtra;
else
// else
/* TODO: test for expression */
pTag->TagEOF = TRUE;
// pTag->TagEOF = TRUE;
}
else
pTag->TagEOF = TRUE;
@@ -415,9 +445,6 @@ static void hb_ntxGetCurrentKey( LPTAGINFO pTag, LPKEYINFO pKey )
hb_stackPop();
}
/* printf( "\n\rhb_ntxGetCurrentKey - 3: |%s|",(pKey->pItem)->item.asString.value ); */
/* // pKey->Tag = 0; */
/* // pKey->Xtra = 0; */
}
static BOOL hb_ntxFindNextKey( LPTAGINFO pTag, BOOL lContinue )
@@ -752,24 +779,24 @@ static void hb_ntxTagKeyRead( LPTAGINFO pTag, BYTE bTypRead, BOOL * lContinue )
switch( bTypRead )
{
case TOP_RECORD:
if( pTag->pForItem != NULL )
printf( "hb_ntxTagKeyRead()" );
else
// if( pTag->pForItem != NULL )
// printf( "hb_ntxTagKeyRead()" );
// else
pTag->TagBOF = !hb_ntxPageReadTopKey( NULL,0 );
if( pTag->pForItem != NULL )
printf( "hb_ntxTagTestRange()" );
// if( pTag->pForItem != NULL )
// printf( "hb_ntxTagTestRange()" );
if( pTag->TagEOF )
pTag->TagBOF = TRUE;
pTag->TagEOF = pTag->TagBOF;
break;
case BTTM_RECORD:
if( pTag->pForItem != NULL )
printf( "hb_ntxTagKeyRead()" );
else
// if( pTag->pForItem != NULL )
// printf( "hb_ntxTagKeyRead()" );
// else
pTag->TagEOF = !hb_ntxPageReadBottomKey( NULL,0 );
if( pTag->pForItem != NULL )
printf( "hb_ntxTagTestRange()" );
// if( pTag->pForItem != NULL )
// printf( "hb_ntxTagTestRange()" );
if( pTag->TagBOF )
pTag->TagEOF = TRUE;
pTag->TagBOF = pTag->TagEOF;
@@ -779,10 +806,12 @@ static void hb_ntxTagKeyRead( LPTAGINFO pTag, BYTE bTypRead, BOOL * lContinue )
while( TRUE )
{
pTag->TagEOF = !hb_ntxPageReadNextKey( pTag, *lContinue );
/*
if( pTag->pForItem != NULL )
printf( "hb_ntxTagKeyRead()" );
else
break;
*/
break;
}
break;
@@ -790,9 +819,11 @@ static void hb_ntxTagKeyRead( LPTAGINFO pTag, BYTE bTypRead, BOOL * lContinue )
while( TRUE )
{
pTag->TagBOF = !hb_ntxPageReadPrevKey( pTag, *lContinue );
/*
if( pTag->pForItem != NULL )
printf( "hb_ntxTagKeyRead()" );
else
*/
break;
}
break;
@@ -1164,11 +1195,6 @@ static ERRCODE hb_ntxPageAddPageKeyAdd( LPPAGEINFO pPage, PHB_ITEM pKey, int lev
int MaxKeys = pPage->TagParent->MaxKeys;
int nCount, nMaxCount = MaxKeys / 5;
LPPAGEINFO pNewPage;
/*
int i;
for( i = 0; i < pPage->uiKeys; i++ )
printf( "\n --- ( %d %5lx %s )", i,pPage->pKeys[i].Tag,hb_itemGetCPtr( pPage->pKeys[i].pItem ) );
*/
/* printf( "\nntxPageAddPageKeyAdd - 0 ( %d )",level ); */
pNewPage = hb_ntxPageNew( pPage->TagParent );
if( pNewPage == NULL )
@@ -1201,36 +1227,6 @@ static ERRCODE hb_ntxPageAddPageKeyAdd( LPPAGEINFO pPage, PHB_ITEM pKey, int lev
pNewPage->uiKeys = 1;
pPage->pKeys[pPage->uiKeys].Tag = pNewPage->Page;
}
/*
nEnd = pPage->uiKeys/2;
while( ( nEnd < pPage->uiKeys ) && ( pPage->pKeys[ nEnd ].Tag != 0 ) )
nEnd++;
if( nEnd == pPage->uiKeys )
{
memmove( pNewPage->pKeys , pPage->pKeys,
( pPage->uiKeys + 1 ) * sizeof( KEYINFO ) );
pNewPage->uiKeys = pPage->uiKeys;
pPage->uiKeys = 1;
pPage->pKeys[0].Tag = pNewPage->Page;
pPage->pKeys[0].Xtra = pPage->TagParent->Owner->Owner->ulRecNo;
pPage->pKeys[0].pItem = hb_itemNew( pKey );
}
else
{
memmove( pNewPage->pKeys , pPage->pKeys,
( nEnd ) * sizeof( KEYINFO ) );
pNewPage->uiKeys = nEnd;
memmove( pPage->pKeys , pPage->pKeys+nEnd,
( pPage->uiKeys+1-nEnd ) * sizeof( KEYINFO ) );
pPage->uiKeys = pPage->uiKeys - nEnd;
pPage->pKeys[0].Tag = pNewPage->Page;
pPage->pKeys[pPage->uiKeys].Xtra = pPage->TagParent->Owner->Owner->ulRecNo;
pPage->pKeys[pPage->uiKeys].pItem = hb_itemNew( pKey );
pPage->uiKeys ++;
}
pPage->pKeys[pPage->uiKeys].Tag = 0;
*/
/* printf( "\nntxPageAddPageKeyAdd - 2( %s %d )", hb_itemGetCPtr( pKey ),pPage->uiKeys ); */
}
else
{
@@ -1426,31 +1422,6 @@ static int hb_ntxPageKeyAdd( LPPAGEINFO pPage, PHB_ITEM pKey, int level, BOOL is
return 1;
}
/*
static ERRCODE hb_ntxTagKeyAdd( LPTAGINFO pTag, PHB_ITEM pKey)
{
LPPAGEINFO pPage;
if( pTag->RootPage )
{
return hb_ntxPageKeyAdd( pTag->RootPage, pKey, 0, FALSE );
}
else
{
pPage = hb_ntxPageNew( pTag );
pPage->Changed = TRUE;
pPage->NewRoot = TRUE;
pPage->uiKeys = 1;
pPage->pKeys[0].Xtra = pTag->Owner->Owner->ulRecNo;
pPage->pKeys[0].pItem = hb_itemNew( pKey );
pTag->RootPage = pPage;
}
return SUCCESS;
}
*/
/*
typedef struct _SORTITEM
{
@@ -1483,7 +1454,7 @@ typedef struct _NTXSORTINFO
typedef NTXSORTINFO * LPNTXSORTINFO;
static void hb_ntxSortKeyAdd( LPTAGINFO pTag, LPNTXSORTINFO pSortInfo, char* szkey )
static void hb_ntxSortKeyAdd( LPTAGINFO pTag, LPNTXSORTINFO pSortInfo, char* szkey, ULONG ulKeyNo )
{
LPSORTITEM pKeyNew, pKey, pKeyTmp, pKeyLast = NULL, pKeyPrev;
@@ -1498,7 +1469,7 @@ static void hb_ntxSortKeyAdd( LPTAGINFO pTag, LPNTXSORTINFO pSortInfo, char* szk
/* printf( "\n\rhb_ntxSortKeyAdd - 0 ( %s )",szkey ); */
pKeyNew = (LPSORTITEM) ( pSortInfo->sortBuffer +
pSortInfo->itemLength * ( pTag->Owner->Owner->ulRecNo - 1 ) );
pSortInfo->itemLength * ( ulKeyNo - 1 ) );
pKeyNew->rec_no = pTag->Owner->Owner->ulRecNo;
pKeyNew->pNext = NULL;
memcpy( pKeyNew->key, szkey, pTag->KeyLength );
@@ -1509,7 +1480,7 @@ static void hb_ntxSortKeyAdd( LPTAGINFO pTag, LPNTXSORTINFO pSortInfo, char* szk
if( pSortInfo->nItems == 2 )
{
pKeyTmp = (LPSORTITEM) ( pSortInfo->sortBuffer +
pSortInfo->itemLength * ( pTag->Owner->Owner->ulRecNo - 2 ) );
pSortInfo->itemLength * ( ulKeyNo - 2 ) );
if( memcmp( pKeyNew->key, pKeyTmp->key, pTag->KeyLength ) < 0 )
pKeyNew->pNext = pKeyTmp;
else
@@ -1518,7 +1489,7 @@ static void hb_ntxSortKeyAdd( LPTAGINFO pTag, LPNTXSORTINFO pSortInfo, char* szk
pKeyNew = pKeyTmp;
}
}
if( pTag->Owner->Owner->ulRecNo < 3 )
if( ulKeyNo < 3 )
{
pSortInfo->pKeyFirst = pKeyNew;
pSortInfo->nItems = 0;
@@ -1724,7 +1695,7 @@ static void hb_ntxReadBuf( NTXAREAP pArea, BYTE* readBuffer, USHORT* numRecinBuf
static ERRCODE hb_ntxIndexCreate( LPNTXINDEX pIndex )
{
ULONG ulRecNo, ulRecCount;
ULONG ulRecNo, ulRecCount, ulKeyNo = 0;
USHORT uiCurLen;
char szBuffer[ HB_MAX_DOUBLE_LENGTH + 1 ];
NTXAREAP pArea;
@@ -1770,12 +1741,12 @@ static ERRCODE hb_ntxIndexCreate( LPNTXINDEX pIndex )
hb_ntxReadBuf( pArea, readBuffer, &numRecinBuf );
pArea->ulRecNo = ulRecNo;
if( pTag->pForItem != NULL )
/* TODO: test for expression */
bWhileOk = TRUE;
bWhileOk = checkLogicalExpr( pTag->pForItem, pItem );
else
bWhileOk = TRUE;
if( bWhileOk )
{
ulKeyNo ++;
if( hb_itemType( pTag->pKeyItem ) == HB_IT_BLOCK )
{
hb_vmPushSymbol( &hb_symEval );
@@ -1801,23 +1772,22 @@ static ERRCODE hb_ntxIndexCreate( LPNTXINDEX pIndex )
hb_itemRelease( pItem );
return FAILURE;
}
/* hb_ntxTagKeyAdd( pTag, pItem ); */
hb_ntxSortKeyAdd( pTag, &sortInfo, pItem->item.asString.value );
hb_ntxSortKeyAdd( pTag, &sortInfo, pItem->item.asString.value, ulKeyNo );
break;
case HB_IT_INTEGER:
case HB_IT_LONG:
case HB_IT_DOUBLE:
numToStr( pItem, szBuffer, pTag->KeyLength, pTag->KeyDec );
hb_ntxSortKeyAdd( pTag, &sortInfo,szBuffer );
hb_ntxSortKeyAdd( pTag, &sortInfo,szBuffer, ulKeyNo );
break;
case HB_IT_DATE:
hb_itemGetDS( pItem, szBuffer );
hb_ntxSortKeyAdd( pTag, &sortInfo, szBuffer );
hb_ntxSortKeyAdd( pTag, &sortInfo, szBuffer, ulKeyNo );
break;
case HB_IT_LOGICAL:
szBuffer[0] = ( hb_itemGetL( pItem ) ? 'T' : 'F' );
szBuffer[1] = 0;
hb_ntxSortKeyAdd( pTag, &sortInfo, szBuffer );
hb_ntxSortKeyAdd( pTag, &sortInfo, szBuffer, ulKeyNo );
break;
default:
printf( "ntxCreateOrder" );
@@ -1832,9 +1802,7 @@ static ERRCODE hb_ntxIndexCreate( LPNTXINDEX pIndex )
hb_xfree( sortInfo.sortBuffer );
hb_xfree( readBuffer );
hb_itemRelease( pItem );
/* hb_ntxPageFree( pTag->RootPage,TRUE ); */
pTag->RootPage = NULL;
/* printf( "\nntxIndexCreate - 10" ); */
return SUCCESS;
}
@@ -1853,6 +1821,8 @@ static void hb_ntxHeaderSave( LPNTXINDEX pIndex )
Header.max_item = pIndex->CompoundTag->MaxKeys;
Header.half_page = Header.max_item/2;
strcpy( Header.key_expr , pIndex->CompoundTag->KeyExpr );
if( pIndex->CompoundTag->ForExpr )
strcpy( Header.for_expr , pIndex->CompoundTag->ForExpr );
Header.unique = pIndex->CompoundTag->UniqueKey;
hb_fsSeek( pIndex->DiskFile , 0 , 0 );
hb_fsWrite( pIndex->DiskFile,(BYTE*)&Header,sizeof(NTXHEADER));
@@ -1931,6 +1901,8 @@ static void hb_ntxIndexFree( LPNTXINDEX pIndex )
}
if( pTag->pForItem != NULL )
{
if( hb_itemType( pTag->pForItem ) != HB_IT_BLOCK )
hb_macroDelete( ( HB_MACRO_PTR ) hb_itemGetPtr( pTag->pForItem ) );
hb_itemRelease( pTag->pForItem );
}
hb_ntxKeyFree( pTag->CurKeyInfo );
@@ -1943,7 +1915,7 @@ static ERRCODE hb_ntxHeaderLoad( LPNTXINDEX pIndex , char *ITN)
{
NTXHEADER Header;
LPTAGINFO pTag;
PHB_ITEM pExpr, pKeyExp;
PHB_ITEM pKeyExp, pForExp = NULL;
ULONG ulPos;
ulPos = hb_fsSeek( pIndex->DiskFile, 0, SEEK_END );
@@ -1951,11 +1923,20 @@ static ERRCODE hb_ntxHeaderLoad( LPNTXINDEX pIndex , char *ITN)
hb_fsSeek( pIndex->DiskFile , 0 , 0 );
if( hb_fsRead( pIndex->DiskFile,(BYTE*)&Header,sizeof(NTXHEADER)) != sizeof(NTXHEADER) )
return FAILURE;
if( SELF_COMPILE( ( AREAP ) pIndex->Owner, (BYTE*)Header.key_expr ) == FAILURE )
return FAILURE;
pExpr = pIndex->Owner->valResult;
pKeyExp = hb_itemNew( NULL );
hb_itemCopy( pKeyExp, pExpr );
hb_itemCopy( pKeyExp, pIndex->Owner->valResult );
if( Header.for_expr[0] > 20 )
{
if( SELF_COMPILE( ( AREAP ) pIndex->Owner, (BYTE*)Header.for_expr ) == FAILURE )
return FAILURE;
pForExp = hb_itemNew( NULL );
hb_itemCopy( pForExp, pIndex->Owner->valResult );
}
pTag = ( LPTAGINFO ) hb_xgrab( sizeof( TAGINFO ) );
memset( pTag, 0, sizeof( TAGINFO ) );
pIndex->CompoundTag = pTag;
@@ -1966,7 +1947,15 @@ static ERRCODE hb_ntxHeaderLoad( LPNTXINDEX pIndex , char *ITN)
hb_strncpyUpper( pTag->TagName, ITN, strlen( ITN ) );
pTag->KeyExpr = (char *) hb_xgrab( NTX_MAX_KEY );
strcpy( pTag->KeyExpr, Header.key_expr );
if( pForExp )
{
pTag->ForExpr = (char *) hb_xgrab( NTX_MAX_KEY );
strcpy( pTag->ForExpr, Header.for_expr );
}
pTag->pKeyItem = pKeyExp;
pTag->pForItem = pForExp;
pTag->AscendKey = 1; /* fAscendKey; */
pTag->UniqueKey = Header.unique;
pTag->KeyType = 'C'; /* bKeyType; */
@@ -2256,6 +2245,7 @@ static ERRCODE ntxSkipRaw( NTXAREAP pArea, LONG lToSkip )
return SUCCESS;
}
/*
static ERRCODE ntxAppend( NTXAREAP pArea, BOOL bUnLockAll )
{
HB_TRACE(HB_TR_DEBUG, ("ntxAppend(%p, %d)", pArea, bUnLockAll ));
@@ -2272,17 +2262,10 @@ static ERRCODE ntxAppend( NTXAREAP pArea, BOOL bUnLockAll )
pArea->lpCurIndex = lpIndex;
pTag = lpIndex->CompoundTag;
hb_ntxGetCurrentKey( pTag, pTag->CurKeyInfo );
/*
if( pArea->fShared )
while( !hb_fsLock( lpIndex->DiskFile, 0, 512, FL_LOCK ) );
hb_ntxPageKeyAdd( hb_ntxPageLoad( 0 ), pTag->CurKeyInfo->pItem, 0, FALSE );
if( pArea->fShared )
{
hb_ntxPageFree( pTag->RootPage,TRUE );
pTag->RootPage = NULL;
hb_fsLock( lpIndex->DiskFile, 0, 512, FL_UNLOCK );
}
*/
if( pTag->pForItem == NULL || checkLogicalExpr( pTag->pForItem, NULL ) )
pTag->InIndex = TRUE;
else
pTag->InIndex = FALSE;
lpIndex = lpIndex->pNext;
}
pArea->lpCurIndex = lpIndexTmp;
@@ -2291,6 +2274,7 @@ static ERRCODE ntxAppend( NTXAREAP pArea, BOOL bUnLockAll )
else
return FAILURE;
}
*/
static ERRCODE ntxGoCold( NTXAREAP pArea )
{
@@ -2300,6 +2284,7 @@ static ERRCODE ntxGoCold( NTXAREAP pArea )
LPPAGEINFO pPage;
BOOL fRecordChanged = pArea->fRecordChanged;
BOOL fAppend = pArea->fAppend;
BOOL InIndex;
HB_TRACE(HB_TR_DEBUG, ("ntxGoCold(%p)", pArea));
@@ -2315,16 +2300,21 @@ static ERRCODE ntxGoCold( NTXAREAP pArea )
{
pTag = lpIndex->CompoundTag;
hb_ntxGetCurrentKey( pTag, pKey );
if( fAppend || hb_ntxItemCompare( pKey->pItem, pTag->CurKeyInfo->pItem, TRUE ) )
if( pTag->pForItem == NULL || checkLogicalExpr( pTag->pForItem, NULL ) )
InIndex = TRUE;
else
InIndex = FALSE;
if( fAppend || hb_ntxItemCompare( pKey->pItem, pTag->CurKeyInfo->pItem, TRUE )
|| InIndex != pTag->InIndex )
{
pArea->lpCurIndex = lpIndex;
hb_itemCopy( pKeyOld->pItem, pTag->CurKeyInfo->pItem );
pKeyOld->Xtra = pTag->CurKeyInfo->Xtra;
pKeyOld->Tag = NTX_IGNORE_REC_NUM;
if( pArea->fShared )
while( !hb_fsLock( lpIndex->DiskFile, 0, 512, FL_LOCK ) );
if( !fAppend )
if( !fAppend && pTag->InIndex )
{
hb_itemCopy( pKeyOld->pItem, pTag->CurKeyInfo->pItem );
pKeyOld->Xtra = pTag->CurKeyInfo->Xtra;
pKeyOld->Tag = NTX_IGNORE_REC_NUM;
if( hb_ntxTagFindCurrentKey( hb_ntxPageLoad( 0 ), pKeyOld->Tag, pKeyOld, FALSE, FALSE, 1 ) )
{
printf( "\n\rntxGoCold: Cannot find current key:" );
@@ -2335,7 +2325,8 @@ static ERRCODE ntxGoCold( NTXAREAP pArea )
pPage->CurKey = hb_ntxPageFindCurrentKey( pPage,pTag->CurKeyInfo->Xtra ) - 1;
hb_ntxPageKeyDel( pPage, pPage->CurKey, 1 );
}
hb_ntxPageKeyAdd( hb_ntxPageLoad( 0 ), pKey->pItem, 0, FALSE );
if( InIndex )
hb_ntxPageKeyAdd( hb_ntxPageLoad( 0 ), pKey->pItem, 0, FALSE );
if( pArea->fShared )
{
hb_ntxPageFree( pTag->RootPage,TRUE );
@@ -2369,6 +2360,10 @@ static ERRCODE ntxGoHot( NTXAREAP pArea )
{
pTag = lpIndex->CompoundTag;
hb_ntxGetCurrentKey( pTag, pTag->CurKeyInfo );
if( pTag->pForItem == NULL || checkLogicalExpr( pTag->pForItem, NULL ) )
pTag->InIndex = TRUE;
else
pTag->InIndex = FALSE;
lpIndex = lpIndex->pNext;
}
return SUCCESS;
@@ -2534,8 +2529,6 @@ static ERRCODE ntxOrderCreate( NTXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo )
break;
}
/* hb_itemRelease( pResult ); */
/* Make sure uiLen is not 0 */
if( !uiLen )
{
@@ -2557,13 +2550,14 @@ static ERRCODE ntxOrderCreate( NTXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo )
{
/* If we have a codeblock for the conditional expression, use it */
if( pArea->lpdbOrdCondInfo->itmCobFor )
{
pExpr = pArea->lpdbOrdCondInfo->itmCobFor;
}
else /* Otherwise, try compiling the conditional expression string */
{
if( SELF_COMPILE( ( AREAP ) pArea, pArea->lpdbOrdCondInfo->abFor ) == FAILURE )
return FAILURE;
pExpr = pArea->valResult;
/* pArea->valResult = NULL; */
}
/* Save for later use */
pForExp = hb_itemNew( NULL );
@@ -2593,7 +2587,7 @@ static ERRCODE ntxOrderCreate( NTXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo )
hb_itemCopy( pResult, &hb_stack.Return );
}
uiType = hb_itemType( pResult );
hb_itemRelease( pResult );
// hb_itemRelease( pResult );
if( uiType != HB_IT_LOGICAL )
{
hb_itemRelease( pKeyExp );