Types of User Scripts

The DATABridge Client supports the following types of user scripts:

Script/Filename

Description

Session initialization

The script.user.session script allows you to change session parameters without changing the database settings. Use this script to alter session parameters whose default values are not suitable for client operations. For example, when the NLS_LANGUAGE for Oracle is a European language, ALTER the NLS_LANGUAGE parameter to set the language to AMERICAN and the NLS_TERRITORY to AMERICA.

The DATABridge Client executes these scripts when running any command that connects to the relational database.

Data set mapping customization scripts

script.user_layout.primary_tablename

where primary_tablename is the name of the primary table mapped from the data set. These scripts make changes to the DATASETS and DMS_ITEMS client control tables for such things as selecting and deselecting DMSII items for cloning, flattening OCCURS clauses, specifying that certain DMSII items should be mapped to relational database dates, creating composite keys, and so on. Such changes are made before DATABridge performs the actual mapping from DMSII to the relational database.

Create one of these scripts for each data set whose mapping needs to be customized. The DATABridge Client runs these scripts for all data sets—selected or not—after the DMSII layout has been received from the DATABridge Engine during a define or define command. See also Using Scripts to Disable Data Sets.

Data table global customization scripts

The script.user_datatables.datasource script is run after the relational database layout has been created during a define or redefine command. It allows you to make global changes to DATATABLES and DATAITEMS. You can use this script to insert common scripts into a single file rather than having to duplicate the SQL in each of the define scripts for the individual data sets. For an example, see Sample Data Table Global Customization Script.

Data table customization scripts

script.user_define.primary_tablename

where primary_tablename is the name of the primary table mapped from the data set.

These scripts make changes to the DATATABLES and DATAITEMS tables for changing table or column names, changing SQL data types, and so on. Create one of these scripts for each data set that has one or more tables which need to be customized. When you change the name of the table within the script, you must use the original primary table name in the script filename.

All changes related to tables mapped from a data set are contained in the data table customization script for the primary table specified by tablename. The DATABridge Client runs these scripts after the relational database layout has been created by the define and redefine commands.

Data table creation user scripts

 

script.user_create. tablename

where tablename is the name of the relational database table. Use this script for the following:

  • To define default values for non DMSII columns
  • To alter the table and add a column that the DATABridge client does not need to be aware of, add a "ALTER TABLE xxx ADD COLUMN yyy" SQL statement to these scripts instead of adding SQL statements to the table creation scripts

    These scripts are executed immediately after the related DATABridge Client script.create.tablename scripts during the process or clone command. If you set the check_user_scripts parameter, the DATABridge Client returns a warning if it cannot find the script.

Caution: Do not use this script to create columns for specific types of data generated by the Client. This script creates a type of user column that the Client is unaware of. To create user columns that the Client is aware of, see Adding a Non DMSII Column.

Index creation user scripts

script.user_index. tablename

where tablename is the name of the relational database table.

Use this script to add SQL statements to the index creation scripts (script.index.tablename) created by the dbutility generate command. Do not modify the scripts created by the generate command, as your changes will be lost the next time a generate command is run.

These scripts are executed immediately after the related DATABridge Client script named script.index.tablename during the process or clone command. If you set the check_user_scripts parameter, the DATABridge Client returns a warning if it cannot find the script.

Data table cleanup user scripts

script.user_cleanup.tablename

where tablename is the name of the relational database table

Use these scripts to undo any actions, such as creating a secondary index, that are done in the script.user_index.table user script. These scripts are run during the process or clone command, prior to executing the cleanup scripts created by the generate command. The scripts are only used in cases where the relational database tables are not dropped when a data set is recloned, such as when deleted records are to be preserved.