Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide to Clip-4-Win version 3.0 - Norton Guide http://www.X-Hacker.org [^^Up^^] [Menu] [About The Guide]
 WTable                 Database table class
 ----------------------------------------------------------------------------
 WTable
 Database table class
 ----------------------------------------------------------------------------
 
 Properties
 Alias          The work area alias
 Area           The table's work area number
 Cargo          User-defined value
 ClassName      The name of the class
 Name           The table's file name
 oParent        Contains the table's parent (owner) window object
 RDD            The name of the table's RDD
 
 Methods
 WTable:Axit()        Destroy a table object
 WTable:Init()        Construct a table object
 WTable:ReDo()        User-extensible generic refresh/update method
 
 Inherits From
 Nothing.
 
 Inherited By
 WDBTable
 
 Description
 This class can be used to open the same table more than once.
 This is done using a different work area for each open file,
 so you can access each open instance independently of any
 others.  To allow the file to be opened more than once, the
 class creates a unique alias.  If your application can have
 the same file open more than once, as this class allows, you
 can use the ReDo() method to co-ordinate the different
 instances.
 
 Normally you open tables SHARED in a Windows application, and
 this is the default for this class.  Potentially this allows
 you to attempt to lock the same record more than once in the
 same application.  If your application design allows this, it
 is up to you how to resolve this issue.
 
 The WDBTable class is the same as this class, but provides
 simple method wrappers for commonly used functions.
 
 Example
 // From SOURCE\OO\USERSRES\USERSMDI.PRG:
 CLASS UsersDialog INHERIT WDialog
      PROTECT oUsers AS OBJECT // AS WTable
 // . . .
      METHOD ReDo(nRec)        ; // nRec has changed, see ::Save()
             INLINE local lCur,;
                    lCur := ( (::oUsers:Area)->(RecNo()) == nRec ),   ;
                    ; // I don't think this dbSkip(0) should be needed
                    ; // but it is...
                    iif(lCur, (::oUsers:Area)->( dbSkip(0) ), ),       ;
                    iif(lCur, ::Update(), self)
 ENDCLASS
 
 METHOD Save() CLASS UsersDialog
 local     nArea := ::oUsers:Area
 if ::Valid
      (nArea)->( RLock() )
      ::Gather()    // update the fields from the vars
      (nArea)->( dbUnlock() )
      (nArea)->( dbCommit() )
      ::oUsers:ReDo((nArea)->( RecNo() ))
 endif
 return 1       // means msg has been processed
 
 See Also  (press Enter)

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