Program Execution
HP NonStop SQL/MP Programming Manual for C—429847-008
7-7
Determining Compatibility With the SQL Executor
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
.
Summary of Contents for NonStop SQL/MP
Page 4: ......
Page 14: ...Contents HP NonStop SQL MP Programming Manual for C 429847 008 x ...
Page 60: ...Host Variables HP NonStop SQL MP Programming Manual for C 429847 008 2 26 VARCHAR Data Type ...
Page 294: ...SQL MP Sample Database HP NonStop SQL MP Programming Manual for C 429847 008 A 6 ...