2022-10-17 20:11 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* include/harbour.hbx
  * src/harbour.def
  * src/rdd/dbcmd.c
    + added two new functions:
         hb_FieldGet( <cFieldName> | <nFieldPos> )
               -> <xFieldValue> | NIL
         hb_FieldPut( <cFieldName> | <nFieldPos>, <xFieldValue> )
               -> <xFieldValue> | NIL
      They works like FieldGet() and FieldPut() but allows to use field
      name instead of field index.
This commit is contained in:
Przemysław Czerpak
2022-10-17 20:11:27 +02:00
parent 5cf00ad438
commit 2807eb7bb5
4 changed files with 65 additions and 0 deletions

View File

@@ -453,6 +453,18 @@
* src/rdd/workarea.c
* pacified warning
2022-10-17 20:11 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* include/harbour.hbx
* src/harbour.def
* src/rdd/dbcmd.c
+ added two new functions:
hb_FieldGet( <cFieldName> | <nFieldPos> )
-> <xFieldValue> | NIL
hb_FieldPut( <cFieldName> | <nFieldPos>, <xFieldValue> )
-> <xFieldValue> | NIL
They works like FieldGet() and FieldPut() but allows to use field
name instead of field index.
2019-12-03 11:42 UTC+0100 Maurizio la Cecilia (m.lacecilia/at/gmail.com)
* ChangeLog.txt
* restored UTF-8 encoding after previous wrong commit (Sorry!!!)

View File

@@ -437,7 +437,9 @@ DYNAMIC hb_FEof
DYNAMIC hb_FGetAttr
DYNAMIC hb_FGetDateTime
DYNAMIC hb_FieldDec
DYNAMIC hb_FieldGet
DYNAMIC hb_FieldLen
DYNAMIC hb_FieldPut
DYNAMIC hb_FieldType
DYNAMIC hb_FileDelete
DYNAMIC hb_FileExists

View File

@@ -524,7 +524,9 @@ HB_FUN_HB_FEOF
HB_FUN_HB_FGETATTR
HB_FUN_HB_FGETDATETIME
HB_FUN_HB_FIELDDEC
HB_FUN_HB_FIELDGET
HB_FUN_HB_FIELDLEN
HB_FUN_HB_FIELDPUT
HB_FUN_HB_FIELDTYPE
HB_FUN_HB_FILEDELETE
HB_FUN_HB_FILEEXISTS

View File

@@ -2283,6 +2283,55 @@ HB_FUNC( HB_FIELDTYPE )
hb_retc_null();
}
HB_FUNC( HB_FIELDGET )
{
AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer();
if( pArea )
{
HB_USHORT uiField;
const char * szField = hb_parc( 1 );
if( szField )
uiField = hb_rddFieldIndex( pArea, szField );
else
uiField = ( HB_FIELDNO ) hb_parni( 1 );
if( uiField > 0 )
{
PHB_ITEM pItem = hb_itemNew( NULL );
SELF_GETVALUE( pArea, uiField, pItem );
hb_itemReturnRelease( pItem );
}
}
}
HB_FUNC( HB_FIELDPUT )
{
AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer();
if( pArea )
{
HB_USHORT uiField;
const char * szField = hb_parc( 1 );
if( szField )
uiField = hb_rddFieldIndex( pArea, szField );
else
uiField = ( HB_FIELDNO ) hb_parni( 1 );
if( uiField > 0 )
{
PHB_ITEM pItem = hb_param( 2, HB_IT_ANY );
if( pItem && ! HB_IS_NIL( pItem ) )
{
if( SELF_PUTVALUE( pArea, uiField, pItem ) == HB_SUCCESS )
hb_itemReturn( pItem );
}
}
}
}
HB_FUNC( HB_WAEVAL )
{
PHB_ITEM pBlock = hb_param( 1, HB_IT_BLOCK );