Only in DbVisualizer Pro
This document and the Database Profile Framework in general is appropriate only when using the licensed DbVisualizer Pro edition.
The InitCommands element define initialization commands that are executed just before the rest of the database profile is loaded. These commands are typically used to determine characteristics of the target database and database session. The result of these commands are stored in variables that can be used in conditions that are evaluated when the rest of the profile is loaded. A common use case is to find out the authorization level of the current user as defined in the database. If the user have limited privileges then some object types, views and actions should be disabled.
Multiple commands may be defined in the InitCommands element and these are executed in order.
The following sample is from the HP Neoview database profile. The main purpose with its commands is to first determine the database version by quering a system table. Based on the database version a condition controls which of two queries will be executed to find out another property from the database. The result of the executed query is stored in a the METACAT variable.
The extends="true" attribute specifies that the list of commands will extend the list of commands defined in the profile being extended.
Initialization commands are processed in two stages:
- First stage is to execute all commands having the attribute method="runBeforeConditionsEval" set. As the attribute reveal, these commands are execute before any conditions are evaluated,
- The second and last stage will execute all commands with no method="runBeforeConditionsEval" set. This time any conditions are evaluated.
The reason for these stages is that the processing of initialization commands may also rely on conditions.
Here is an example how the new METACAT variable is used in the rest of the database profile:
Here is another example for Oracle getting the instance_type property from the v$parameter table and put the value in the INSTANCE_TYPE variable.
Below show that only if INSTANCE_TYPE have the value RDBMS schema objects should be displayed in the database objects tree: