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 - dbfdef database alias declaration block http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 dbfdef              Database alias declaration block
------------------------------------------------------------------------------
 Syntax
   dbfdef <alias> [<scope>]
      [ <datatype>( <width>[:<decimals>] ) <field> ]
      [ <fielddecl> ]
   enddef

 Arguments
   <alias> is the name of the alias variable used to refer to the alias
   structure being declared.

   <scope> is the range of visibility for the alias (public, static,
   extern).

   <datatype> is the data type of the field in a field declaration.

   <width> is the width of the field in a field declaration.

   <decimals> is the number of decimal places for dbl fields in a field
   declaration.

   <field> is the field name in a field declaration.

   <fielddecl> is an optional list of further field declarations.

 Description
   The dbfdef keyword initiates an alias declaration block. An
   alias declaration block is used to describe the structure of a database
   accessed via the given alias variable.

   Aliases can be allocated in the data or the stack segments, but not
   in a far data segment. Therefore the far and sfar scope specifiers can
   not be used with a dbfdef block.

 Example
   #define EXAMPLE_KEYWORD
   #include example.hdr

   dbfdef sTest static
      char( 15 ) firstname
      char( 20 ) lastname
      uint( 3 )  age
      logical    male
      date       birthday
   enddef
   
   proc Test_dbfdef
   build "stest.dbf" from alias sTest
   open sTest
   append blank
   sTest->lastname := "Smith"
   ? sTest->lastname
   close sTest
   erase "stest.dbf"
   endproc

   proc main
   Test_dbfdef()
   endproc

See Also: Database field type table alias indexdef

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