Difference between revisions of "DBC OPENDATA"
Yvonne.milne (Talk | contribs) |
Yvonne.milne (Talk | contribs) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==Purpose== | ==Purpose== | ||
Database events are triggered by certain database operations | Database events are triggered by certain database operations | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==See Also== | ==See Also== | ||
Line 23: | Line 6: | ||
==Description== | ==Description== | ||
− | The DBC_OPENDATA database event is triggered when a database is opened. The | + | The DBC_OPENDATA database event is triggered when a database is opened and runs dbc_opendata.prg (.dbo compiled/runtime) if it exists. The code is run before the database is actually opened. Databases are opened using the OPEN DATABASE <database-name> command. |
+ | |||
+ | The following parameters are passed to the dbc_opendata program: | ||
{| class="wikitable" width="100%" | {| class="wikitable" width="100%" | ||
− | ! | + | !Parameter||Description |
|- | |- | ||
|<expC>||The database name | |<expC>||The database name | ||
Line 35: | Line 20: | ||
|- | |- | ||
|valign="top"|<expL3>||Specifies whether the VALIDATE keyword was included on the OPEN DATABASE command, .T. or not, .F. | |valign="top"|<expL3>||Specifies whether the VALIDATE keyword was included on the OPEN DATABASE command, .T. or not, .F. | ||
− | |||
− | |||
|- | |- | ||
|} | |} | ||
+ | |||
+ | If the dbc_opendata program returns .F., the database is not opened, if .T., the open operation continues. | ||
+ | |||
+ | Note: OPEN DATABASE also triggers the loading of the dbc_library (.prg/.dbo) procedure library file if it exists. | ||
Programs associated with database events should reside in the database's directory. These can be created and modified from the [[Database Events|Events tab in the Data Workspace]] when a database is open. | Programs associated with database events should reside in the database's directory. These can be created and modified from the [[Database Events|Events tab in the Data Workspace]] when a database is open. | ||
+ | |||
+ | From Lianja v6.3, the DBC_AFTEROPENDATA event is triggered after a database has been successfully opened. | ||
==Example== | ==Example== | ||
<code lang="recital"> | <code lang="recital"> | ||
− | + | // dbc_opendata.prg | |
lparameters cName, lExcl, lRo, lValidate | lparameters cName, lExcl, lRo, lValidate | ||
// ... | // ... |
Latest revision as of 07:26, 23 November 2021
Contents
Purpose
Database events are triggered by certain database operations
See Also
ADATABASES(), ALTER TABLE, ADD TABLE, ALTER INDEX, CLOSE DATABASES, CLOSE TABLES, COMPILE DATABASE, CREATE DATABASE, CREATE TABLE, CREATE INDEX, CREATE VIEW, DATABASE(), Database Events, DBUSED(), DISPLAY DATABASE, DISPLAY INDEXES, DISPLAY TABLES, DROP DATABASE, DROP INDEX, DROP TABLE, GETENV(), LIST DATABASE, LIST INDEXES, LIST TABLES, OPEN DATABASE, PACK DATABASE, REBUILD DATABASE, REINDEX DATABASE, SET AUTOCATALOG, SET EXCLUSIVE, USE
Description
The DBC_OPENDATA database event is triggered when a database is opened and runs dbc_opendata.prg (.dbo compiled/runtime) if it exists. The code is run before the database is actually opened. Databases are opened using the OPEN DATABASE <database-name> command.
The following parameters are passed to the dbc_opendata program:
Parameter | Description |
---|---|
<expC> | The database name |
<expL1> | Specifies whether the database is being opened exclusively, .T. or shared, .F. |
<expL2> | Specifies whether the NOPUDATE keyword was included on the OPEN DATABASE command, .T. or not, .F. |
<expL3> | Specifies whether the VALIDATE keyword was included on the OPEN DATABASE command, .T. or not, .F. |
If the dbc_opendata program returns .F., the database is not opened, if .T., the open operation continues.
Note: OPEN DATABASE also triggers the loading of the dbc_library (.prg/.dbo) procedure library file if it exists.
Programs associated with database events should reside in the database's directory. These can be created and modified from the Events tab in the Data Workspace when a database is open.
From Lianja v6.3, the DBC_AFTEROPENDATA event is triggered after a database has been successfully opened.
Example
// dbc_opendata.prg lparameters cName, lExcl, lRo, lValidate // ... return .T.