BeforeDropTable, AfterDropTable, BeforeRemoveTable, AfterRemoveTable
These database events fire when you remove a table from its database. The BeforeDropTable and AfterDropTable events fire when you use the DROP TABLE command, while the BeforeRemoveTable and AfterRemoveTable events fire when you use the REMOVE TABLE command or remove the table visually using the Database Designer.
Usage |
PROCEDURE DBC_BeforeDropTable( cTableName, lRecycle ) PROCEDURE DBC_AfterDropTable( cTableName, lRecycle ) PROCEDURE DBC_BeforeRemoveTable( cTableName, lDelete, lRecycle ) PROCEDURE DBC_AfterRemoveTable( cTableName, lDelete, lRecycle ) |
Parameter |
Value |
Meaning |
cTableName |
Character |
The name of the table to remove. |
lRecycle |
Logical |
Indicates whether the RECYCLE clause was specified in the command. |
lDelete |
Logical |
Indicates whether the DELETE clause was specified in the command. |
Example |
* This goes in the stored procedures of the database. PROCEDURE DBC_BeforeDropTable(cTableName, lRecycle) WAIT WINDOW PROGRAM() + CHR(13) + ; 'cTableName: ' + cTableName + CHR(13) + ; 'lRecycle: ' + TRANSFORM(lRecycle) PROCEDURE DBC_AfterDropTable(cTableName, lRecycle) WAIT WINDOW PROGRAM() + CHR(13) + ; 'cTableName: ' + cTableName + CHR(13) + ; 'lRecycle: ' + TRANSFORM(lRecycle) PROCEDURE DBC_BeforeRemoveTable(cTableName, lDelete, lRecycle) WAIT WINDOW PROGRAM() + CHR(13) + ; 'cTableName: ' + cTableName + CHR(13) + ; 'lDelete: ' + TRANSFORM(lDelete) + CHR(13) + ; 'lRecycle: ' + TRANSFORM(lRecycle) PROCEDURE DBC_AfterRemoveTable(cTableName, lDelete, lRecycle) WAIT WINDOW PROGRAM() + CHR(13) + ; 'cTableName: ' + cTableName + CHR(13) + ; 'lDelete: ' + TRANSFORM(lDelete) + CHR(13) + ; 'lRecycle: ' + TRANSFORM(lRecycle) * End of the stored procedures. * Create a table, and then remove it using REMOVE TABLE. OPEN DATABASE TestData DBSETPROP(DBC(), "DATABASE", "DBCEVENTS", .T.) && Turn events on. CREATE TABLE TestTable (Field1 C(10)) USE REMOVE TABLE TestTable DELETE * Create another table, and then remove it using DROP TABLE. CREATE TABLE TestTable2 (Field1 C(10)) USE DROP TABLE TestTable2 |
See Also |
BeforeAddTable, BeforeCreateTable, Database Events, Delete View, Drop Table, Drop View, Remove Table |