Review of Preprocessing Events [ ALLBASE/SQL FORTRAN Application Programming Guide ] MPE/iX 5.0 Documentation
ALLBASE/SQL FORTRAN Application Programming Guide
Review of Preprocessing Events
All embedded SQL statements must be preprocessed before they can be
executed. Preprocessing may be done by running the FORTRAN preprocessor
during application development, or it may be done for dynamic commands
when the program is run. Preprocessing does the following:
* Checks syntax: The syntax of SQL commands and host variable
declarations must be correct.
* Verifies the existence of objects: Any object named in an SQL
command must exist.
* Optimizes data access: If the statement accesses data, the
fastest way to access the data must be determined.
* Checks authorizations: Both the program owner and the executor
must have the required authorities.
* Creates sections: ALLBASE/SQL creates sections for SQL commands
when this is appropriate. At run time, the section is executed.
These preprocessing events take place for all non-dynamic SQL commands
when you run the ALLBASE/SQL preprocessor. Non-dynamic commands are
fully defined in the source code and are preprocessed before run time.
So far, most of the examples in this manual have shown non-dynamic
preprocessing.
ALLBASE/SQL completes the preprocessing of dynamic commands at run time,
in an event known as dynamic preprocessing. Any SQL command except the
following can be preprocessed at run time:
BEGIN DECLARE SECTION FETCH
CLOSE CURSOR INCLUDE
DECLARE CURSOR OPEN CURSOR
DELETE WHERE CURRENT PREPARE
DESCRIBE SELECT
END DECLARE SECTION SQLEXPLAIN
EXECUTE UPDATE WHERE CURRENT
EXECUTE IMMEDIATE WHENEVER
Dynamic commands that are not queries can be preprocessed at run time
using the PREPARE and EXECUTE statements or the EXECUTE IMMEDIATE
statement. Dynamic queries are preprocessed using the PREPARE and
DESCRIBE commands in conjunction with the SQLDA or SQL Description Area
and other data structures. These statements and data structures, used
with a cursor, are described further in a later section.
MPE/iX 5.0 Documentation