Compilation Using the DB-Schema

Overview

Prerequisites

Compilation Using the DB-Schema

Overview

A Database Schema, or DB-Schema, is a representation of a database structure, which describes table names, fields, relationships between them, data types, indexes, views, synonyms, and stored procedures. A compilation with the DB-Schema can have an improved performance compared to the usual compilation. Also, a compilation with the DB-Schema does not require a connection to the database.

Lycia supports compilation with DB-Schema files generated by the qexpt tool (*.xml) and *.sch schema files.

Prerequisites

To use a DB-Schema in your program compilation, you must set certain environment variables and create a Schema using the qexpt tool.

Note: The workflow described below applies to the Informix databases.

Step 1. Open the Terminal and export the environment variables for the connection to the database server:

export LOGNAME=<login> #the user name valid on Informix database server

export INFORMIXPASS=<password> #the password valid on Informix database server

export INFORMIXSERVER=<db_server> #the default database server to which an explicit or implicit connection is made by an SQL API client, the DB-Access utility, or another IBM® Informix product

export INFORMIXDIR=/opt/ibm/informix #the directory which contains sub-directories in which your Informix client is installed

export INFORMIXSQLHOSTS=/configs/lycia/sqlhosts.std #the location for the sqlhosts config file

export DB_LOCALE=en_US.utf8 #the Informix database locale, which the Informix database server uses to process locale-sensitive data

export CLIENT_LOCALE=en_US.utf8 #the language, territory, and code set that the client application uses in I/O operations, end user formats, and processing ESQL statements.

Step 2. In the Terminal, use the qexpt commands to generate the DB-Schema, like in the following example:

/opt/Querix/Lycia/bin/qexpt --format xml -d informix --database <db_name> --table-only

Note: By default, the qexpt tool exports the whole contents of the database. For the compilation using the DB-Schema, the file can contain tables, views, and synonyms only. To ensure no excessive data is added to the schema file, use the --table-only command while creating the schema. You can also include the system catalog tables by using the --system-tables option. For details, refer to the following page: qexpt.

The qexpt generates a DB-Schema into the file in XML format. If the -o option is not used along with the qexpt command, the file is placed in the current directory.

Step 3. Make sure also to set values appropriate to the current compilation demands for the following environment variables:

Return to top

Compilation Using the DB-Schema

The schema to be used in compilation is defined with the following statements:

Attention: During the compilation, the connection will be defined by the statement that is declared as latest in the .4gl file.

The DB-Schema file must reside in one of the following places:

If you specify the folder along with the file name in the SCHEMA statement, the compiler will search for such folder in the current directory or in the folders listed by $FGLDBPATH.

Note: If the compiler doesn’t find the DB-Schema file in the directories mentioned above, it will try to connect to the database server.

Usage of the DB-Schema file can be overridden by the environment variable QX_USE_DB_SCHEMA_FILE: if it is set to false, the DATABASE statement will force a connection to the database instead of loading the DB-Schema file.

After the environment variables have been set, and the schema has been created or imported and placed into one of the mentioned locations, find your program, and compile it.

Return to top

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.