SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)
C/C++ Program Compilation
HP NonStop SQL/MX Programming Manual for C and COBOL—523627-004
15-27
Compiling Embedded Module Definitions
•
Checks SQL object references to verify their existence
•
Determines an optimized execution plan and access path for each DML statement
if the SQL objects in the statement are present at compile time
•
Generates executable code for the execution plans (if the SQL objects in the
statement are present at compile time) and creates a module in the user-specified
local application directory or in the global /usr/tandem/sqlmx/USERMODULES
directory.
•
Generates a list of SQL statements in the program file, including messages
•
Returns a completion code indicating the outcome of the compilation
The SQL/MX compiler is an OSS program installed in the Guardian $SYSTEM.SYSTEM
subvolume (/G/system/system/ in the OSS environment). You must run the
compiler in the OSS environment. It does not run as a Guardian process.
You must explicitly invoke the SQL/MX compiler to compile static SQL statements. At
run time, the SQL/MX executor also invokes the compiler to compile dynamic SQL
statements and to recompile any static SQL statements that refer to database objects
that have changed and that affect the SQL statement’s execution plan.
If your program accesses a table that has changed since the last static compilation,
you should statically recompile the program to improve performance. Otherwise,
NonStop SQL/MX dynamically recompiles the program before each execution.
Compiling Embedded Module Definitions
To compile one or more of the modules of an embedded SQL/MX application
executable, use the mxCompileUserModule utility on the object file created by the
C/C++ compiler or on the executable file produced by the linker.
If you have a combination of module definition files and applications that contain
embedded module definitions, use mxCompileUserModule to SQL compile the self-
contained object files containing embedded module definitions, and use mxcmp to SQL
compile the application’s separate module definition files. For more information, see
Compiling a Module Definition File on page 15-31 and the example Building and
Deploying a C Application With Embedded Module Definitions and Module Definition
Files on page 15-46.