Determining Compatibility With The Sql Executor - HP NonStop SQL/MP Programming Manual

For c
Table of Contents

Advertisement

Program Execution
Determining Compatibility With the
SQL Executor
The PFV of an SQL program indicates the oldest version of the SQL executor that can
run the program. During SQL compilation, the SQL compiler writes the PFV in the
program's file label. Then, at run time, the SQL executor checks the PFV, and if the
executor version is the same as or later than the PFV, it runs the program. Otherwise,
the executor returns an error.
To determine the version of the SQL executor, use the GET VERSION OF SYSTEM
statement. All SQL/MP components on a system, including the executor, have the
same version. You can run the GET VERSION OF SYSTEM statement from SQLCI or
a C program.
For a static GET VERSION OF SYSTEM statement in a C program, include the INTO
clause with a host variable:
EXEC SQL GET VERSION OF SYSTEM \newyork INTO :hv_sys_version;
In this example, the GET VERSION OF SYSTEM statement returns the version of
NonStop SQL/MP installed on the \NEWYORK system to the host variable named
hv_sys_version. If you do not specify a system name, the statement returns the
version of the local system.
To determine the PFV of an SQL program, use a FUP INFO or SQLCI FILEINFO
command with the DETAIL option. For programs registered in version 300 or later
catalogs, you can also query the PROGRAMS.PROGRAMFORMATVERSION column.
However, for version 300 or later SQL/MP software, HP recommends that you use the
GET VERSION OF PROGRAM statement with the FORMAT option. You can enter this
statement from SQLCI or in a C program. To embed a static
GET VERSION OF PROGRAM statement in a C program, include the INTO clause
with a host variable. This statement returns the PFV of SQLPROG to the host variable
hv_pfv:
EXEC SQL GET FORMAT VERSION OF PROGRAM sqlprog INTO :hv_pfv;
You can also run a dynamic GET VERSION OF PROGRAM statement using the
PREPARE and EXECUTE statements as shown in this example:
strcpy (hv_text,"GET FORMAT VERSION OF PROGRAM SQLPROG");
EXEC SQL PREPARE dynamic_statement FROM :hv_text;
EXEC SQL EXECUTE dynamic_statement RETURNING :hv_pfv;
You cannot, however, use a GET VERSION OF PROGRAM statement with the
EXECUTE IMMEDIATE statement.
For the syntax of the GET VERSION statements, see the SQL/MP Reference Manual.
HP NonStop SQL/MP Programming Manual for C—429847-008

Determining Compatibility With the SQL Executor

7-7

Advertisement

Table of Contents
loading

Table of Contents