2007-09-27 15:29 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/include/dbinfo.ch
  * harbour/contrib/rdd_ads/ads1.c
  * harbour/source/rdd/workarea.c
  * harbour/source/rdd/delim1.c
  * harbour/source/rdd/dbf1.c
  * harbour/source/rdd/sdf1.c
    + added support for DBI_POSITIONED flag. Because some RDDs may not
      support phantom record then checking for EOF() does not have to
      be enough to detect that the cursor is positioned to phantom
      record. Checking for RecNo() == LastRec() + 1 does not have to
      work either because some RDD may use not use continuous record
      numbers f.e. ADT. So in code like BROWSE() if you want to be sure
      that current record is phantom one then (!dbInfo(DBI_POSITIONED))
      should be used.
This commit is contained in:
Przemyslaw Czerpak
2007-09-27 13:30:20 +00:00
parent 893ba137b4
commit c384b23f25
7 changed files with 46 additions and 1 deletions

View File

@@ -8,6 +8,22 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-09-27 15:29 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/dbinfo.ch
* harbour/contrib/rdd_ads/ads1.c
* harbour/source/rdd/workarea.c
* harbour/source/rdd/delim1.c
* harbour/source/rdd/dbf1.c
* harbour/source/rdd/sdf1.c
+ added support for DBI_POSITIONED flag. Because some RDDs may not
support phantom record then checking for EOF() does not have to
be enough to detect that the cursor is positioned to phantom
record. Checking for RecNo() == LastRec() + 1 does not have to
work either because some RDD may use not use continuous record
numbers f.e. ADT. So in code like BROWSE() if you want to be sure
that current record is phantom one then (!dbInfo(DBI_POSITIONED))
should be used.
2007-09-27 14:40 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/rdd_ads/ads1.c
* harbour/source/rdd/workarea.c

View File

@@ -2710,6 +2710,10 @@ static ERRCODE adsInfo( ADSAREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
hb_itemPutL( pItem, pArea->fReadonly );
break;
case DBI_POSITIONED:
hb_itemPutL( pItem, pArea->fPositioned );
break;
case DBI_LOCKCOUNT:
{
UNSIGNED16 u16Count;

View File

@@ -286,6 +286,7 @@
#define DBI_DECRYPT 141 /* Decrypt table */
#define DBI_MEMOPACK 142 /* Pack memo file */
#define DBI_DIRTYREAD 143 /* Get/Set index dirty read flag */
#define DBI_POSITIONED 144 /* Is cursor positioned to valid record */
/* RECORD MAP (RM) support */
#define DBI_RM_SUPPORTED 150 /* has WA RDD record map support? */

View File

@@ -3273,6 +3273,10 @@ static ERRCODE hb_dbfInfo( DBFAREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
hb_itemPutL( pItem, pArea->fValidBuffer );
break;
case DBI_POSITIONED:
hb_itemPutL( pItem, pArea->fPositioned );
break;
case DBI_ISENCRYPTED:
hb_itemPutL( pItem, pArea->fTableEncrypted );
break;

View File

@@ -992,6 +992,10 @@ static ERRCODE hb_delimInfo( DELIMAREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
hb_itemPutL( pItem, pArea->fReadonly );
break;
case DBI_POSITIONED:
hb_itemPutL( pItem, pArea->fPositioned );
break;
case DBI_DB_VERSION:
case DBI_RDD_VERSION:
{

View File

@@ -743,6 +743,10 @@ static ERRCODE hb_sdfInfo( SDFAREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
hb_itemPutL( pItem, pArea->fReadonly );
break;
case DBI_POSITIONED:
hb_itemPutL( pItem, pArea->fPositioned );
break;
case DBI_DB_VERSION:
case DBI_RDD_VERSION:
{

View File

@@ -830,8 +830,20 @@ static ERRCODE hb_waInfo( AREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
}
}
hb_itemPutL( pItem, fScoped );
break;
}
case DBI_POSITIONED:
{
ULONG ulRecCount, ulRecNo;
if( SELF_RECNO( pArea, &ulRecNo ) != SUCCESS )
return FAILURE;
if( ulRecNo == 0 )
hb_itemPutL( pItem, TRUE );
else if( SELF_RECCOUNT( pArea, &ulRecCount ) != SUCCESS )
return FAILURE;
hb_itemPutL( pItem, ulRecNo != ulRecCount + 1 );
break;
}
case DBI_RM_SUPPORTED:
hb_itemPutL( pItem, FALSE );
break;