Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - _fldbag database field replacement structure http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _FLDBAG             Database field replacement structure
------------------------------------------------------------------------------
 Declaration
   database.hdr

 Syntax
   typedef struct _FLDBAG
      ulong   pSet
      int     iInt
      uint    uUint
      logical lLog
      long    gLong
      ulong   nUlong
      date    dDate
      dbl     eDbl
      char    cChar
   enddef

 Members
   pSet indicates the direction of field replacement (0 for getting,
   and non-zero for setting), and receives a pointer to the field value
   when getting a field's contents.

   iInt contains the field value for int fields.

   uUint contains the field value for uint fields.

   lLog contains the field value for logical fields.

   gLong contains the field value for long fields.

   nUlong contains the field value for ulong fields.

   dDate contains the field value for date fields.

   eDbl contains the field value for dbl fields.

   cChar contains the field value for char fields.

 Description
   The _FLDBAG structure stores data for database field replacement.
   A variable declared as of type _FLDBAG is used in conjunction with
   the dynrep() function to get or set the contents of a database field.

 Example
   #define EXAMPLE_TYPE
   #define _DYNALIAS_
   #define _ALIASPTR_
   #include example.hdr

   proc Test_FLDBAG
   vardef
      _PALIAS pDbf
      _FLDBAG sData
   enddef
   pDbf := dynopen( 0, "stest.dbf", DO_SHARED ) // open database
   if pDbf                                      // if successful
   
      sData.pSet := 0            // indicate getting field contents
      dynrep( pDbf, 1, sData )   // get current contents of 1st field
      ? "Original: ", sData.cChar
   
      sData.pSet := 0            // indicate getting field contents
      dynrep( pDbf, 6, sData )   // get current contents of 6th field
      ?? sData.dDate
   
      sData.pSet := 1            // indicate setting field contents
      sData.cChar := "Replaced"  // place new value in structure member
      dynrep( pDbf, 1, sData )   // set 1st field
   
      sData.pSet := 1            // indicate setting field contents
      sData.dDate := today()     // place new value in structure member
      dynrep( pDbf, 6, sData )   // set 6th field
   
      sData.pSet := 0            // indicate getting field contents
      dynrep( pDbf, 1, sData )   // get changed contents of 1st field
      ? "Changed:  ", sData.cChar
   
      sData.pSet := 0            // indicate getting field contents
      dynrep( pDbf, 6, sData )   // get changed contents of 6th field
      ?? sData.dDate
   
      dynclose( pDbf )           // close database
   else
      ? "Database could not be opened"
   endif
   endproc

   proc main
   Test_FLDBAG()
   endproc

See Also: dynrep()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson