HP NonStop SQL/MP Programming Manual page 155

For c
Table of Contents

Advertisement

Explicit Program Compilation
SQL Program Files
The HOSV and its relationship to the C compiler and SQL compiler are described next.
For more information about the PFV and PCV, see the SQL/MP Version Management
Guide.
The C compiler generates the HOSV and stores the value in the object file. If multiple
object files are bound together into a single target object file, the HOSV of the target
object file is the newest (maximum) HOSV of the individual object files. For example, if
an object file with an HOSV of 2 and another object file with an HOSV of 310 are
bound into a new target object file, the HOSV of the target object file is 310.
To return the HOSV of an SQL program file, use the GET VERSION OF PROGRAM
statement with the HOST OBJECT option. You can run this statement from SQLCI or in
a C program. This GET VERSION OF PROGRAM statement is run from SQLCI:
GET HOST OBJECT VERSION OF PROGRAM sqlprog;
VERSION: 310
--- SQL operation complete.
To embed a static GET VERSION OF PROGRAM statement in a C program, you must
include the INTO clause with a host variable. This statement returns the HOSV of
SQLPROG to the host variable HV_HOSV:
EXEC SQL
GET HOST OBJECT VERSION OF PROGRAM sqlprog INTO :hv_hosv;
You can also run a dynamic GET VERSION OF PROGRAM statement using the
PREPARE and EXECUTE statements as shown:
strcpy (hv_text,
"GET HOST OBJECT VERSION OF PROGRAM SQLPROG");
EXEC SQL PREPARE dynamic_statement FROM :hv_text;
EXEC SQL EXECUTE dynamic_statement RETURNING :hv_hosv;
...
You cannot, however, use the GET VERSION OF PROGRAM statement with the
EXECUTE IMMEDIATE statement.
For the syntax of the GET VERSION statement, see the SQL/MP Reference Manual.
HP NonStop SQL/MP Programming Manual for C—429847-008
6-39

Advertisement

Table of Contents
loading

Table of Contents