Using the COMPILETIME Clause

From InterBase
Jump to: navigation, search

Go Up to Preprocessing and Run Time Databases


A program can be designed to run against any one of several identically structured databases. In other cases, the actual database that a program will use at runtime is not available when a program is preprocessed and compiled. In such cases, SET DATABASE can include a COMPILETIME clause to specify a database for gpre to test against during preprocessing. For example, the following SET DATABASE statement declares that employee.ib is to be used by gpre during preprocessing:

EXEC SQL
SET DATABASE EMP = COMPILETIME 'employee.ib';
Important: The file specification that follows the COMPILETIME keyword must always be a hard-coded, quoted string.

When SET DATABASE uses the COMPILETIME clause, but no RUNTIME clause, and does not specify a different database file specification in a subsequent CONNECT statement, the same database file is used both for preprocessing and run time. To specify different preprocessing and runtime databases with SET DATABASE, use both the COMPILETIME and RUNTIME clauses.