The first two Database Events fire when a database is validated using VALIDATE DATABASE. The last one fires when it's packed, either programmatically with PACK DATABASE or visually by choosing "Clean Up Database" from the Database menu.
PROCEDURE DBC_BeforeValidateData( lRecover, lNoConsole, lPrint,
lFile [, cFileName ] )
PROCEDURE DBC_AfterValidateData( lRecover, lNoConsole, lPrint,
lFile [, cFileName ] )|
Parameter |
Value |
Meaning |
|
lRecover |
Logical |
Indicates whether the RECOVER clause was specified. |
|
lNoConsole |
Logical |
Indicates whether the NOCONSOLE clause was used. |
|
lPrint |
Logical |
Indicates whether the TO PRINTER clause was used. |
|
lFile |
Logical |
Indicates whether the TO FILE clause was specified. |
|
cFileName |
Character |
The name of the file output is directed to. |
As is the case with other before-and-after pairs of events, you can prevent a database from being validated by returning .F. in the BeforeValidateData event, while the AfterValidateData event simply receives notification that something happened.
* This code goes in the stored procedures of a database.
PROCEDURE DBC_BeforeValidateData(lRecover, lNoConsole, lPrint, ;
lFile, cFileName)
WAIT WINDOW PROGRAM() + CHR(13) + ;
'lRecover: ' + TRANSFORM(lRecover) + CHR(13) + ;
'lNoConsole: ' + TRANSFORM(lNoConsole) + CHR(13) + ;
'lPrint: ' + TRANSFORM(lPrint) + CHR(13) + ;
'lFile: ' + TRANSFORM(lFile) + CHR(13) + ;
'cFileName: ' + TRANSFORM(cFileName)
PROCEDURE DBC_AfterValidateData(lRecover, lNoConsole, lPrint, ;
lFile, cFileName)
WAIT WINDOW PROGRAM() + CHR(13) + ;
'lRecover: ' + TRANSFORM(lRecover) + CHR(13) + ;
'lNoConsole: ' + TRANSFORM(lNoConsole) + CHR(13) + ;
'lPrint: ' + TRANSFORM(lPrint) + CHR(13) + ;
'lFile: ' + TRANSFORM(lFile) + CHR(13) + ;
'cFileName: ' + TRANSFORM(cFileName)
* End of stored procedures.
* Validate a database.
OPEN DATABASE TestData EXCLUSIVE
VALIDATE DATABASE RECOVER TO PRINTPROCEDURE DBC_PackData()There are no before and after events for packing a database; the PackData event fires before packing occurs, so return .F. to prevent packing from taking place (you'll get a "file access denied" error in that case). This might be an issue if you need to do something after a database is packed, although we can't really think of anything useful you'd want to do.
* This code goes in the stored procedures of a database.
PROCEDURE DBC_PackData()
WAIT WINDOW PROGRAM()
* End of stored procedures.
* Pack a database.
OPEN DATABASE TestData EXCLUSIVE
PACK DATABASEDatabase Events, Open Database, OpenData, Pack, Pack Database, Validate Database

