Programs: OdxSQL

Command Files

OdxSQL can execute a file of commands using the USE command. This is useful to run a batch of commands in succession. A common use of this approach are the CREATE ENVIRONMENT, CREATE DATABASE and CREATE TABLE statements that are used to create an Omnidex environment file. A command file is often used to process the commands to update the rollup tables, indexes and text dictionaries for an environment. A command file can also contain a series of SELECT statements to be processed, both in test and production environments.

Any OdxSQL command can be used in a command file. The only restriction is on the USE statement so that files cannot be recursively called. A command file can contain a USE statement, but that second command file cannot contain a USE statement.

Test Directives

OdxSQL supports additional test directives that can be placed in command files for testing purposes. These are special comments that OdxSQL will recognize and process accordingly.


The COMMON directive contains statements that must be run whenever the command file is run. These commands are not a test per se, but rather essential commands that prepare for running tests. The most common statements found in the COMMON section are CONNECT, DISCONNECT and SET.


The SECTION directive indicates a section of tests. It is provided for organizational purposes only.


The TEST directive is the most essential directive, and it starts a series of statements that must be run together. For example, some tests may require that a segment be created before it is subsequently referenced, or a row must be updated before it is retrieved. All statements between one TEST directive and the next TEST, SECTION or COMMON directive will be considered a single test. If an error occurs, though, the remaining statements in the test will not be processed.


The TEST_CLEANUP directive is optionally at the end of a test and contains commands that must be processed, even if the test fails. For example, if a TEST uses a CREATE SEGMENT command, the TEST_CLEANUP will likely contain a DROP SEGMENT command.

Additional Resources

See also:

Back to top
programs/odxsql/files.txt ยท Last modified: 2016/06/28 22:38 (external edit)