Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.2 . Drivers Guide - <b>rdd basics</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 RDD Basics
------------------------------------------------------------------------------

     The cornerstone of the replaceable database driver system is the
     CA-Clipper  work area.  All CA-Clipper database commands and functions
     operate in a work area through a database driver that actually performs
     the access to the stored database information.  The layering of the
     system looks like this:

                      +---------------------------------+
                      | Database Commands and Functions |
                      ----------------------------------|
                      |          RDD Interface          |
                      |---------------------------------|
                      |         Database driver         |
                      |---------------------------------|
                      |           Stored Data           |
                      +---------------------------------+

     In this system, each work area is associated with a single database
     driver.  Each database driver, in turn, is supplied as a separate
     library  file (.LIB) you link into your application programs.  Within an
     application, you specify the name of the database driver when you open
     or access a database file or table with the USE command or DBUSEAREA()
     function.  If you specify no database driver at the time a file is
     opened, the default driver is used.  You may select which driver will be
     used as the default driver.

     Once you open a database in a work area, the RDD used for that work area
     is automatically used for all operations on that database (except
     commands and functions that create a new table).  Any command or
     function that creates a new table (i.e., SORT, CREATE FROM, DBCREATE(),
     etc.) uses the default RDD.  Most of the new commands and functions let
     you specify a driver other than the default driver.

     The normal default database driver, DBFNTX (which supports the
     traditional (.dbf), (.ntx), and (.dbt) files) is installed into your
     \CLIPPER5\LIB directory.  This driver is linked into each program
     automatically to provide backwards compatibility.

     To use any of the other supplied drivers, either as an additional driver
     or an alternate driver, you must use the REQUEST command to assure that
     the driver will be linked in.  You must also include the appropriate
     library on the link line.

     All CA-Clipper applications will automatically include code generated by
     RDDSYS.PRG from the \CLIPPER5\SOURCE\SYS subdirectory.  If you wish to
     automatically load another RDD, you must modify and compile RDDSYS.PRG
     and link the resulting object file into your application.  The content
     of the default RDDSYS.PRG is shown below.  Only the portion in bold
     should be modified.

     //  Current RDDSYS.PRG
     #include "rddsys.ch"

     ANNOUNCE RDDSYS                     // This line must not change
     INIT PROCEDURE RddInit
        REQUEST DBFNTX                   // Force link for DBFNTX RDD
        RDDSETDEFAULT( "DBFNTX" )        // Set up DBFNTX as default
                                         // driver

        RETURN

     // eof: rddsys.prg

     To change the default to a new automatically-loading driver, modify the
     bold lines in RDDSYS.PRG to include the name of the new driver.  For
     example:

     //  Revised RDDSYS.PRG
     #include "rddsys.ch"

     ANNOUNCE RDDSYS                     // This line must not change
     INIT PROCEDURE RddInit
        REQUEST DBFCDX                   // Force link for DBFCDX RDD
        RDDSETDEFAULT( "DBFCDX" )        // Set up DBFCDX as default
                                         // driver

        RETURN

     // eof: rddsys.prg

     If you change this file, all CA-Clipper applications in which it is
     linked will automatically include the new RDD.

     To use any RDD other than the default, you must explicitly identify it
     through use of the VIA clause of the USE command.

     You need not disable the automatic DBFNTX loading to use other RDDs in
     your applications, but if your application will not use any DBFNTX
     functionality, you can save its code overhead by disabling it.

     To completely disable the automatic loading of a default RDD, remove the
     two lines shown above in bold.  For example:

     //  New Revised RDDSYS.PRG
     //  disables auto-loading
     #include "rddsys.ch"

     ANNOUNCE RDDSYS                     // This line must not change
     INIT PROCEDURE RddInit

        RETURN
     // eof: rddsys.prg


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