2016-03-18 17:42 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* include/harbour.hbx
  * src/rdd/dbcmd.c
    + added new function:
         hb_dbGetFilter() -> <bCode> | NIL
      it returns codeblock used as work area filter or NIL

  * src/debug/dbgwa.prg
    * use hb_dbGetFilter() to check if WA filter was set without
      filter text representation

  ; above modifications created by Rolf - thanks

  * src/rdd/dbcmd.c
    ! clear filter if dbGetFilter( , "" ) is called instead of setting
      dummy one - thanks to Rolf
This commit is contained in:
Przemysław Czerpak
2016-03-18 17:42:58 +01:00
parent ac3e681530
commit 0d57fdacfa
4 changed files with 62 additions and 29 deletions

View File

@@ -10,6 +10,23 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2016-03-18 17:42 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* include/harbour.hbx
* src/rdd/dbcmd.c
+ added new function:
hb_dbGetFilter() -> <bCode> | NIL
it returns codeblock used as work area filter or NIL
* src/debug/dbgwa.prg
* use hb_dbGetFilter() to check if WA filter was set without
filter text representation
; above modifications created by Rolf - thanks
* src/rdd/dbcmd.c
! clear filter if dbGetFilter( , "" ) is called instead of setting
dummy one - thanks to Rolf
2016-03-16 14:19 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* include/hbclass.ch
* typo in comment

View File

@@ -397,6 +397,7 @@ DYNAMIC hb_dbCreateTemp
DYNAMIC hb_dbDetach
DYNAMIC hb_dbDrop
DYNAMIC hb_dbExists
DYNAMIC hb_dbGetFilter
DYNAMIC hb_dbPack
DYNAMIC hb_dbRename
DYNAMIC hb_dbRequest

View File

@@ -366,9 +366,13 @@ STATIC PROCEDURE UpdateInfo( oDlg, cAlias )
hb_DispOutAt( oDlg:nTop + 2, oDlg:nLeft + 40, iif( Deleted(), "Yes", "No " ), oDlg:cColor )
hb_DispOutAt( oDlg:nTop + 3, oDlg:nLeft + 23, iif( Eof(), "Yes", "No " ), oDlg:cColor )
hb_DispOutAt( oDlg:nTop + 3, oDlg:nLeft + 40, iif( Found(), "Yes", "No " ), oDlg:cColor )
hb_DispOutAt( oDlg:nTop + 4, oDlg:nLeft + 23, PadR( dbFilter(), 30 ), oDlg:cColor )
hb_DispOutAt( oDlg:nTop + 4, oDlg:nLeft + 23, PadR( dbFilterInfo(), 30 ), oDlg:cColor )
hb_DispOutAt( oDlg:nTop + 5, oDlg:nLeft + 23, PadR( ordKey(), 30 ), oDlg:cColor )
dbSelectArea( nOldArea )
RETURN
STATIC FUNCTION dbFilterInfo()
RETURN iif( Empty( dbFilter() ), ;
iif( Empty( hb_dbGetFilter() ), "", "{|| ... }" ), dbFilter() )

View File

@@ -287,16 +287,6 @@ HB_FUNC( DBAPPEND )
hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, HB_ERR_FUNCNAME );
}
HB_FUNC( DBCLEARFILTER )
{
AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer();
if( pArea )
SELF_CLEARFILTER( pArea );
else
hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, HB_ERR_FUNCNAME );
}
HB_FUNC( DBCLOSEALL )
{
hb_rddCloseAll();
@@ -535,18 +525,14 @@ HB_FUNC( DBDELETE )
hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, HB_ERR_FUNCNAME );
}
HB_FUNC( DBFILTER )
HB_FUNC( DBRECALL )
{
AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer();
if( pArea )
{
PHB_ITEM pFilter = hb_itemPutC( NULL, NULL );
SELF_FILTERTEXT( pArea, pFilter );
hb_itemReturnRelease( pFilter );
}
SELF_RECALL( pArea );
else
hb_retc_null();
hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, HB_ERR_FUNCNAME );
}
HB_FUNC( DBGOBOTTOM )
@@ -678,16 +664,6 @@ HB_FUNC( __DBPACK )
hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, HB_ERR_FUNCNAME );
}
HB_FUNC( DBRECALL )
{
AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer();
if( pArea )
SELF_RECALL( pArea );
else
hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, HB_ERR_FUNCNAME );
}
HB_FUNC( DBRLOCK )
{
AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer();
@@ -818,7 +794,7 @@ HB_FUNC( DBSETFILTER )
may use only text version of filter and ignore or use with
lower priority the codeblock so Harbour has to work like
Cl*pper here. [druzus] */
if( pBlock || pText )
if( pBlock || hb_itemGetCLen( pText ) > 0 )
{
pFilterInfo.itmCobExpr = pBlock;
if( pText )
@@ -841,6 +817,41 @@ HB_FUNC( DBSETFILTER )
hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, HB_ERR_FUNCNAME );
}
HB_FUNC( DBCLEARFILTER )
{
AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer();
if( pArea )
SELF_CLEARFILTER( pArea );
else
hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, HB_ERR_FUNCNAME );
}
HB_FUNC( DBFILTER )
{
AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer();
if( pArea )
{
PHB_ITEM pFilter = hb_itemPutC( NULL, NULL );
SELF_FILTERTEXT( pArea, pFilter );
hb_itemReturnRelease( pFilter );
}
else
hb_retc_null();
}
/* Harbour extension to retrieve CB */
HB_FUNC( HB_DBGETFILTER )
{
AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer();
if( pArea )
hb_itemReturn( pArea->dbfi.itmCobExpr );
else
hb_ret();
}
HB_FUNC( DBSKIP )
{
AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer();