diff --git a/ChangeLog.txt b/ChangeLog.txt index 95a29c9e62..8ba99445d3 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,21 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2015-03-23 15:03 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * include/hbapirdd.h + * include/hbusrrdd.ch + + added DBTF_RECALL flag which disables transferring record DELETED flag + + * src/rdd/dbcmd.c + * src/rdd/workarea.c + ! disable transferring DELETED flag to destination area in SORT TO / + __dbArrange() operations + + * src/rdd/delim1.c + * src/rdd/sdf1.c + + added dummy RECALL() methods - now RECALL() can be executed by workarea + TRANSREC() method when DBTF_RECALL flag is set + 2015-03-22 17:23 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/rdd/dbf1.c * pacified warnings diff --git a/include/hbapirdd.h b/include/hbapirdd.h index b817d824a0..c7d30c23de 100644 --- a/include/hbapirdd.h +++ b/include/hbapirdd.h @@ -126,6 +126,7 @@ HB_EXTERN_BEGIN #define DBTF_MATCH 0x0001 #define DBTF_PUTREC 0x0002 #define DBTF_CPYCTR 0x0004 +#define DBTF_RECALL 0x0008 diff --git a/include/hbusrrdd.ch b/include/hbusrrdd.ch index 466b0a06a1..0603f1cbef 100644 --- a/include/hbusrrdd.ch +++ b/include/hbusrrdd.ch @@ -203,6 +203,7 @@ #define DBTF_MATCH 0x0001 #define DBTF_PUTREC 0x0002 #define DBTF_CPYCTR 0x0004 +#define DBTF_RECALL 0x0008 /* Codes for Locking methods */ #define DBLM_EXCLUSIVE 1 diff --git a/src/rdd/dbcmd.c b/src/rdd/dbcmd.c index c6ec8bbc04..56e7005ef6 100644 --- a/src/rdd/dbcmd.c +++ b/src/rdd/dbcmd.c @@ -1859,6 +1859,9 @@ HB_FUNC( __DBARRANGE ) dbSortInfo.dbtri.dbsci.fOptimized = HB_FALSE; dbSortInfo.dbtri.dbsci.fIncludeDeleted = HB_TRUE; + /* do not transfer record deleted flag to destination area */ + dbSortInfo.dbtri.uiFlags |= DBTF_RECALL; + dbSortInfo.uiItemCount = pFields ? ( HB_USHORT ) hb_arrayLen( pFields ) : 0; if( dbSortInfo.uiItemCount > 0 ) { diff --git a/src/rdd/delim1.c b/src/rdd/delim1.c index 4f93211f55..320bb62a0b 100644 --- a/src/rdd/delim1.c +++ b/src/rdd/delim1.c @@ -554,6 +554,18 @@ static HB_ERRCODE hb_delimDeleteRec( DELIMAREAP pArea ) return HB_SUCCESS; } +/* + * Undelete the current record. + */ +static HB_ERRCODE hb_delimRecall( DELIMAREAP pArea ) +{ + HB_TRACE( HB_TR_DEBUG, ( "hb_delimRecall(%p)", pArea ) ); + + HB_SYMBOL_UNUSED( pArea ); + + return HB_SUCCESS; +} + /* * Obtain the current value of a field. */ @@ -1518,7 +1530,7 @@ static const RDDFUNCS delimTable = { NULL /* hb_delimBof */, ( DBENTRYP_V ) hb_delimGoHot, ( DBENTRYP_P ) hb_delimPutRec, ( DBENTRYP_SI ) hb_delimPutValue, - NULL /* hb_delimRecall */, + ( DBENTRYP_V ) hb_delimRecall, ( DBENTRYP_ULP ) hb_delimRecCount, NULL /* hb_delimRecInfo */, ( DBENTRYP_ULP ) hb_delimRecNo, diff --git a/src/rdd/sdf1.c b/src/rdd/sdf1.c index 332f96ff6d..152eebee29 100644 --- a/src/rdd/sdf1.c +++ b/src/rdd/sdf1.c @@ -367,6 +367,18 @@ static HB_ERRCODE hb_sdfDeleteRec( SDFAREAP pArea ) return HB_SUCCESS; } +/* + * Undelete the current record. + */ +static HB_ERRCODE hb_sdfRecall( SDFAREAP pArea ) +{ + HB_TRACE( HB_TR_DEBUG, ( "hb_sdfRecall(%p)", pArea ) ); + + HB_SYMBOL_UNUSED( pArea ); + + return HB_SUCCESS; +} + /* * Obtain the current value of a field. */ @@ -1247,7 +1259,7 @@ static const RDDFUNCS sdfTable = { NULL /* hb_sdfBof */, ( DBENTRYP_V ) hb_sdfGoHot, ( DBENTRYP_P ) hb_sdfPutRec, ( DBENTRYP_SI ) hb_sdfPutValue, - NULL /* hb_sdfRecall */, + ( DBENTRYP_V ) hb_sdfRecall, ( DBENTRYP_ULP ) hb_sdfRecCount, NULL /* hb_sdfRecInfo */, ( DBENTRYP_ULP ) hb_sdfRecNo, diff --git a/src/rdd/workarea.c b/src/rdd/workarea.c index a5aad89f87..e3000bee68 100644 --- a/src/rdd/workarea.c +++ b/src/rdd/workarea.c @@ -1296,13 +1296,13 @@ static HB_ERRCODE hb_waTransRec( AREAP pArea, LPDBTRANSINFO pTransInfo ) HB_TRACE( HB_TR_DEBUG, ( "hb_waTransRec(%p, %p)", pArea, pTransInfo ) ); - /* Record deleted? */ - errCode = SELF_DELETED( pArea, &bDeleted ); - if( errCode != HB_SUCCESS ) - return errCode; - if( pTransInfo->uiFlags & DBTF_MATCH && pTransInfo->uiFlags & DBTF_PUTREC ) { + /* Record deleted? */ + errCode = SELF_DELETED( pArea, &bDeleted ); + if( errCode != HB_SUCCESS ) + return errCode; + errCode = SELF_GETREC( pArea, &pRecord ); if( errCode != HB_SUCCESS ) return errCode; @@ -1321,6 +1321,16 @@ static HB_ERRCODE hb_waTransRec( AREAP pArea, LPDBTRANSINFO pTransInfo ) PHB_ITEM pItem; HB_USHORT uiCount; + if( pTransInfo->uiFlags & DBTF_RECALL ) + bDeleted = HB_FALSE; + else + { + /* Record deleted? */ + errCode = SELF_DELETED( pArea, &bDeleted ); + if( errCode != HB_SUCCESS ) + return errCode; + } + /* Append a new record */ errCode = SELF_APPEND( pTransInfo->lpaDest, HB_TRUE ); if( errCode != HB_SUCCESS ) @@ -1344,16 +1354,17 @@ static HB_ERRCODE hb_waTransRec( AREAP pArea, LPDBTRANSINFO pTransInfo ) /* Delete the new record if copy fail */ if( errCode != HB_SUCCESS ) - { SELF_DELETE( pTransInfo->lpaDest ); - return errCode; + else if( bDeleted ) + { + /* Record with deleted flag */ + if( pTransInfo->uiFlags & DBTF_RECALL ) + errCode = SELF_RECALL( pTransInfo->lpaDest ); + else + errCode = SELF_DELETE( pTransInfo->lpaDest ); } - /* Delete the new record */ - if( bDeleted ) - return SELF_DELETE( pTransInfo->lpaDest ); - - return HB_SUCCESS; + return errCode; } /*