2000-11-08 11:28 UTC+0800 Brian Hays <bhays@abacuslaw.com>
This commit is contained in:
@@ -1,8 +1,33 @@
|
||||
2000-11-08 11:28 UTC+0800 Brian Hays <bhays@abacuslaw.com>
|
||||
* source\vm\arrays.c
|
||||
* added Victor's fix for passing the second parameter to ascan's codeblock.
|
||||
|
||||
* contrib/rdd_ads/ads1.c
|
||||
* fixed adsSetScope -- SET SCOPE was busted
|
||||
* adsOrderInfo
|
||||
+added support for
|
||||
DBOI_ORDERCOUNT
|
||||
DBOI_KEYCOUNT
|
||||
DBOI_CUSTOM
|
||||
DBOI_POSITION << changed DBOI_RECNO to this!
|
||||
|
||||
* include/hbapirdd.h
|
||||
TEMPORARILY added extra 5.3 DBOI_* constants
|
||||
* contrib/rdd_ads/adsfunc.c
|
||||
* minor editing
|
||||
* source/rtl/dummy.prg
|
||||
* source/rdd/dbcmd.c
|
||||
* moved dbOrderInfo from dummy.prg to dbcmd.c
|
||||
* fixed ordScope parameter checking
|
||||
* source/rdd/workarea.c
|
||||
* added commented-out OrderInfo; waiting for agreement on how to implement it
|
||||
|
||||
|
||||
2000-11-08 18:25 UTC+0100 Ryszard Glab <rglab@imid.med.pl>
|
||||
|
||||
*source/vm/macro.c
|
||||
*fixed support for field variables in TYPE() function
|
||||
|
||||
|
||||
*tests/dbevalts.prg
|
||||
*tests/newrdd.prg
|
||||
*tests/testbrdb.prg
|
||||
@@ -25,8 +50,8 @@
|
||||
*source/vm/memvars.c
|
||||
* fixed the order of memory deallocations done in the garbage
|
||||
collector (this will fix many random core dumps/GPF's)
|
||||
* removed unnecessary reference counter inc/dec operations
|
||||
|
||||
* removed unnecessary reference counter inc/dec operations
|
||||
|
||||
|
||||
2000-11-07 22:50 UTC+0800 Ron Pinkas <ron@profit-master.com>
|
||||
* include/hberrors.h
|
||||
|
||||
@@ -1415,12 +1415,49 @@ static ERRCODE adsOrderInfo( ADSAREAP pArea, USHORT uiIndex, LPDBORDERINFO pOrde
|
||||
}
|
||||
else
|
||||
phIndex = pArea->hOrdCurrent;
|
||||
|
||||
switch( uiIndex )
|
||||
{
|
||||
case DBOI_BAGEXT:
|
||||
hb_itemPutC( pOrderInfo->itmResult,
|
||||
((adsFileType==ADS_ADT) ? ".adi" : (adsFileType==ADS_CDX) ? ".cdx" : ".ntx") );
|
||||
break;
|
||||
case DBOI_ORDERCOUNT:
|
||||
pusLen = 0;
|
||||
if( pOrderInfo->atomBagName && (UNSIGNED8*) hb_itemGetCPtr( pOrderInfo->atomBagName ))
|
||||
{
|
||||
/* if already open, ads fills other info OK.
|
||||
TODO: verify it is already open, or be sure to close it!
|
||||
*/
|
||||
AdsOpenIndex (pArea->hTable,
|
||||
(UNSIGNED8*) hb_itemGetCPtr( pOrderInfo->atomBagName ), NULL, &pusLen);
|
||||
|
||||
}else /* no specific bag requested; get all current indexes */
|
||||
{
|
||||
AdsGetNumIndexes(pArea->hTable, &pusLen);
|
||||
}
|
||||
hb_itemPutNI(pOrderInfo->itmResult, pusLen);
|
||||
break;
|
||||
case DBOI_CUSTOM :
|
||||
pusLen = 0;
|
||||
AdsIsIndexCustom (phIndex, &pusLen);
|
||||
hb_itemPutL(pOrderInfo->itmResult, pusLen);
|
||||
break;
|
||||
case DBOI_KEYCOUNT :
|
||||
{
|
||||
UNSIGNED32 pulKey ;
|
||||
AdsGetRecordCount( (phIndex ? phIndex : pArea->hTable), ADS_RESPECTSCOPES/*usFilterOption*/, &pulKey);
|
||||
hb_itemPutNL(pOrderInfo->itmResult, pulKey);
|
||||
break;
|
||||
}
|
||||
case DBOI_KEYCOUNTRAW : /* ignore filter or scope */
|
||||
{
|
||||
UNSIGNED32 pulKey ;
|
||||
AdsGetRecordCount( (phIndex ? phIndex : pArea->hTable), ADS_IGNOREFILTERS/*usFilterOption*/, &pulKey);
|
||||
hb_itemPutNL(pOrderInfo->itmResult, pulKey);
|
||||
break;
|
||||
}
|
||||
|
||||
case DBOI_EXPRESSION:
|
||||
AdsGetIndexExpr( phIndex, aucBuffer, &pusLen);
|
||||
hb_itemPutC( pOrderInfo->itmResult, (char*)aucBuffer );
|
||||
@@ -1447,7 +1484,7 @@ static ERRCODE adsOrderInfo( ADSAREAP pArea, USHORT uiIndex, LPDBORDERINFO pOrde
|
||||
hb_itemPutNI(pOrderInfo->itmResult, usOrder);
|
||||
break;
|
||||
}
|
||||
case DBOI_RECNO :
|
||||
case DBOI_POSITION :
|
||||
{
|
||||
UNSIGNED32 pulKey ;
|
||||
if( phIndex )
|
||||
@@ -1457,7 +1494,10 @@ static ERRCODE adsOrderInfo( ADSAREAP pArea, USHORT uiIndex, LPDBORDERINFO pOrde
|
||||
hb_itemPutNL(pOrderInfo->itmResult, pulKey);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
// TODO: This should call SUPER for default handling, but it never gets there
|
||||
//SUPER_ORDINFO( ( AREAP ) pArea, uiIndex, pOrderInfo );
|
||||
break;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -1521,7 +1561,7 @@ static ERRCODE adsSetScope( ADSAREAP pArea, LPDBORDSCOPEINFO sInfo )
|
||||
{
|
||||
if( sInfo->scopeValue )
|
||||
{
|
||||
AdsSetScope( pArea->hOrdCurrent, (UNSIGNED16) sInfo->nScope,
|
||||
AdsSetScope( pArea->hOrdCurrent, (UNSIGNED16) (sInfo->nScope + 1), /*ADS top/bottom are 1,2 instead of 0,1*/
|
||||
(UNSIGNED8*) sInfo->scopeValue,
|
||||
(UNSIGNED16) strlen( (const char *)sInfo->scopeValue), ADS_STRINGKEY );
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ HB_FUNC( ADSKEYCOUNT )
|
||||
return;
|
||||
}
|
||||
else
|
||||
hIndex = (pArea->hOrdCurrent == 0)? pArea->hTable:pArea->hOrdCurrent;
|
||||
hIndex = (pArea->hOrdCurrent == 0) ? pArea->hTable : pArea->hOrdCurrent;
|
||||
|
||||
if( hb_pcount() > 2 )
|
||||
{
|
||||
|
||||
@@ -117,6 +117,40 @@ extern void hb_rddShutDown( void );
|
||||
#define DBOI_ISDESC 12 /* Get the flag if the order is descending */
|
||||
#define DBOI_UNIQUE 13 /* Get the flag if the order has the unique attribute set */
|
||||
|
||||
/* 53-level constants */
|
||||
#define DBOI_FULLPATH 20 /* Get the order Bag Full Path */
|
||||
#define DBOI_KEYTYPE 24 /* Get the keytype of order */
|
||||
#define DBOI_KEYSIZE 25 /* Get the keysize of order */
|
||||
#define DBOI_KEYCOUNT 26 /* Get the number of keys */
|
||||
#define DBOI_SETCODEBLOCK 27 /* Set codeblock for order key */
|
||||
#define DBOI_KEYDEC 28 /* Get decimals of order key */
|
||||
#define DBOI_HPLOCKING 29 /* High performance index locking */
|
||||
#define DBOI_LOCKOFFSET 35 /* New locking offset */
|
||||
|
||||
#define DBOI_KEYADD 36 /* Gets/Sets the Key to be added */
|
||||
#define DBOI_KEYDELETE 37 /* Gets/Sets the Key to be deleted */
|
||||
#define DBOI_KEYVAL 38 /* Get current key value */
|
||||
#define DBOI_SCOPETOP 39 /* Gets/Sets top of scope */
|
||||
#define DBOI_SCOPEBOTTOM 40 /* Gets/Sets bottom of scope */
|
||||
#define DBOI_SCOPETOPCLEAR 41 /* Clears top scope setting */
|
||||
#define DBOI_SCOPEBOTTOMCLEAR 42 /* Clears bottom scope setting */
|
||||
|
||||
#define DBOI_CUSTOM 45 /* Custom created order */
|
||||
#define DBOI_SKIPUNIQUE 46 /* Flag for skip unique */
|
||||
|
||||
#define DBOI_KEYSINCLUDED 50 /* # of keys included while indexing */
|
||||
/* keyno */
|
||||
#define DBOI_KEYGOTO DBOI_POSITION
|
||||
#define DBOI_KEYNORAW 51 /* keyno ignoring any filter */
|
||||
#define DBOI_KEYCOUNTRAW 52 /* keycount ignoring any filter */
|
||||
#define DBOI_OPTLEVEL 53 /* Optimization achieved for last query */
|
||||
|
||||
// Ideally shoud be an entry point that doesn't require an open table
|
||||
#define DBOI_STRICTREAD 60 /* Get/set read thru RDD when indexing */
|
||||
#define DBOI_OPTIMIZE 61 /* Get/set use of query optimization */
|
||||
#define DBOI_AUTOOPEN 62 /* Get/set auto open of production index */
|
||||
#define DBOI_AUTOORDER 63 /* Get/set default order: production index */
|
||||
#define DBOI_AUTOSHARE 64 /* Get/set automatic sharing control */
|
||||
|
||||
|
||||
/* Codes for SELF_INFO() */
|
||||
@@ -1083,4 +1117,4 @@ extern USHORT hb_rddFieldType( USHORT extendType );
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HB_APIRDD_H_ */
|
||||
#endif /* HB_APIRDD_H_ */
|
||||
|
||||
@@ -2387,6 +2387,7 @@ HB_FUNC( ORDKEY )
|
||||
}
|
||||
|
||||
#ifdef HB_COMPAT_C53
|
||||
|
||||
HB_FUNC( ORDKEYNO )
|
||||
{
|
||||
DBORDERINFO pOrderInfo;
|
||||
@@ -2400,7 +2401,7 @@ HB_FUNC( ORDKEYNO )
|
||||
/* Either or both may be NIL */
|
||||
|
||||
pOrderInfo.itmResult = hb_itemPutNL( NULL, 0 );
|
||||
SELF_ORDINFO( ( AREAP ) s_pCurrArea->pArea, DBOI_RECNO, &pOrderInfo );
|
||||
SELF_ORDINFO( ( AREAP ) s_pCurrArea->pArea, DBOI_POSITION, &pOrderInfo );
|
||||
hb_retnl( hb_itemGetNL( pOrderInfo.itmResult ) );
|
||||
hb_itemRelease( pOrderInfo.itmResult );
|
||||
}
|
||||
@@ -2515,6 +2516,7 @@ HB_FUNC( ORDSETFOCUS )
|
||||
hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "ORDSETFOCUS" );
|
||||
}
|
||||
|
||||
|
||||
HB_FUNC( RDDLIST )
|
||||
{
|
||||
USHORT uiType;
|
||||
@@ -2735,8 +2737,7 @@ HB_FUNC( ORDSCOPE )
|
||||
|
||||
if( s_pCurrArea )
|
||||
{
|
||||
if( hb_pcount() == 0 || !(hb_parinfo( 1 ) & HB_IT_NUMERIC) ||
|
||||
( hb_pcount() > 1 && hb_parinfo( 2 ) != HB_IT_STRING ) )
|
||||
if( !ISNUM( 1 ) || ( !ISNIL( 2 ) && hb_parinfo( 2 ) != HB_IT_STRING ) )
|
||||
{
|
||||
hb_errRT_DBCMD( EG_ARG, EDBCMD_REL_BADPARAMETER, NULL, "ORDSCOPE" );
|
||||
return;
|
||||
@@ -2751,7 +2752,7 @@ HB_FUNC( ORDSCOPE )
|
||||
sInfo.scopeValue = (BYTE*) hb_parc( 2 );
|
||||
else
|
||||
sInfo.scopeValue = NULL;
|
||||
SELF_SETSCOPE( ( AREAP ) s_pCurrArea->pArea, (LPDBOPENINFO) &sInfo );
|
||||
SELF_SETSCOPE( ( AREAP ) s_pCurrArea->pArea, (LPDBORDSCOPEINFO) &sInfo );
|
||||
}
|
||||
else
|
||||
hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "ORDSCOPE" );
|
||||
@@ -3012,6 +3013,49 @@ HB_FUNC( DBINFO )
|
||||
hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "DBINFO" );
|
||||
}
|
||||
|
||||
HB_FUNC( DBORDERINFO )
|
||||
{
|
||||
PHB_ITEM pType, pInfo;
|
||||
BOOL bDeleteItem;
|
||||
DBORDERINFO pOrderInfo;
|
||||
|
||||
if( s_pCurrArea )
|
||||
{
|
||||
pType = hb_param( 1 , HB_IT_NUMERIC );
|
||||
if( pType )
|
||||
{
|
||||
|
||||
pOrderInfo.atomBagName = hb_param( 2, HB_IT_STRING );
|
||||
/* atomBagName may be NIL */
|
||||
pOrderInfo.itmOrder = hb_param( 3, HB_IT_STRING );
|
||||
if( !pOrderInfo.itmOrder )
|
||||
pOrderInfo.itmOrder = hb_param( 3, HB_IT_NUMERIC );
|
||||
|
||||
/* TODO: 4TH parameter is not supported in current ads code or the structure */
|
||||
pInfo = hb_param( 4 , HB_IT_ANY ); /* Set new value */
|
||||
if( !pInfo )
|
||||
{
|
||||
pInfo = hb_itemNew( NULL );
|
||||
bDeleteItem = TRUE;
|
||||
}
|
||||
else
|
||||
bDeleteItem = FALSE;
|
||||
|
||||
pOrderInfo.itmResult = hb_itemNew( NULL );
|
||||
SELF_ORDINFO( ( AREAP ) s_pCurrArea->pArea, hb_itemGetNI( pType ), &pOrderInfo );
|
||||
hb_itemReturn( pOrderInfo.itmResult );
|
||||
hb_itemRelease( pOrderInfo.itmResult );
|
||||
|
||||
if( bDeleteItem )
|
||||
hb_itemRelease( pInfo );
|
||||
return;
|
||||
}
|
||||
hb_errRT_DBCMD( EG_ARG, EDBCMD_DBCMDBADPARAMETER, NULL, "DBORDERINFO" );
|
||||
}
|
||||
else
|
||||
hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "DBORDERINFO" );
|
||||
}
|
||||
|
||||
HB_FUNC( DBFIELDINFO )
|
||||
{
|
||||
PHB_ITEM pType, pInfo;
|
||||
|
||||
@@ -460,6 +460,23 @@ ERRCODE hb_waInfo( AREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Retrieve information about the current order.
|
||||
* Called by SELF_ORDINFO if uiIndex is not supported.
|
||||
*/
|
||||
#ifdef HB_COMPAT_C53
|
||||
//ERRCODE hb_waorderInfo( AREAP pArea, USHORT index, LPDBORDERINFO param )
|
||||
//{
|
||||
// HB_TRACE(HB_TR_DEBUG, ("hb_waOrderInfo(%p, %hu, %p)", pArea, index, param));
|
||||
// HB_SYMBOL_UNUSED( pArea );
|
||||
|
||||
// if ( param->itmResult )
|
||||
// hb_itemRelease( param->itmResult );
|
||||
// hb_errRT_DBCMD( EG_ARG, EDBCMD_BADPARAMETER, NULL, "ORDERINFO" );
|
||||
// return FAILURE;
|
||||
//}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Clear the WorkArea for use.
|
||||
*/
|
||||
|
||||
@@ -45,16 +45,11 @@ FUNCTION ordKeyAdd() ; RETURN .F.
|
||||
FUNCTION ordKeyCount() ; RETURN 0
|
||||
FUNCTION ordKeyDel() ; RETURN .F.
|
||||
FUNCTION ordKeyGoto() ; RETURN .F.
|
||||
// FUNCTION ordKeyNo() ; RETURN 0
|
||||
FUNCTION ordKeyVal() ; RETURN NIL
|
||||
FUNCTION ordSetRelation() ; RETURN NIL
|
||||
FUNCTION ordSkipUnique() ; RETURN .F.
|
||||
#endif
|
||||
|
||||
#ifdef HB_COMPAT_C53
|
||||
FUNCTION dbOrderInfo() ; RETURN NIL
|
||||
#endif
|
||||
|
||||
FUNCTION MLCToPos() ; RETURN 0
|
||||
FUNCTION MPosToLC() ; RETURN 0
|
||||
|
||||
|
||||
@@ -473,7 +473,8 @@ ULONG hb_arrayScan( PHB_ITEM pArray, PHB_ITEM pValue, ULONG * pulStart, ULONG *
|
||||
hb_vmPushSymbol( &hb_symEval );
|
||||
hb_vmPush( pValue );
|
||||
hb_vmPush( pBaseArray->pItems + ulStart );
|
||||
hb_vmDo( 1 );
|
||||
hb_vmPushNumber( ( double ) ( ulStart + 1 ), 0 );
|
||||
hb_vmDo( 2 );
|
||||
|
||||
if( HB_IS_LOGICAL( &hb_stack.Return ) && hb_stack.Return.item.asLogical.value )
|
||||
return ulStart + 1; /* arrays start from 1 */
|
||||
|
||||
Reference in New Issue
Block a user