SQL/MP Version Management Guide
Program Versions
Compaq NonStop™ SQL/MP Version Management Guide—429833-001
5-15
Relation of Data-Structure Version to Program
Format Version
Relation of Data-Structure Version to Program Format Version
An SQL program cannot use data structures newer than its PFV; however, there is no
requirement that all SQL data structures used in a program have to be the same version.
You can place version 2 SQL data structures in a program whose PFV is 300 or newer if
you do not need the features of newer-version SQL data structures.
The version of the data structures included in a program cannot be newer than the
newest versions the host language compiler can generate. For example, suppose that you
are using version 315 of SQL/MP software and that you are still using the version 2 C
compiler. Finally, suppose that you specify the following directive in your program:
EXEC SQL
INCLUDE STRUCTURES SQLCA VERSION 315
sql-terminator
What does your version 2 C compiler do when it executes this statement? That depends
on whether the specified data structure (in this case, SQLCA) changed between version
2 (the version of your compiler) and version 315 (the version specified in the example).
In this case, the answer is that the SQLCA structure did not change between versions
300 and 315. Therefore, the compiler generates the correct SQLCA. However, if the
SQLCA structure had changed between version 300 and version 315, the compiler
would report an error and would not generate the structure.
For a summary of the changes in SQL data structures between versions, see
Appendix A, Summary of Feature, Catalog, and Data Structure Changes
.
Mixing Data Structure Versions
An SQL compilation module can contain different versions of the three SQL data
structures (SQLCA, SQLSA, and SQLDA). However, different versions of the same
data structure cannot appear in the same compilation module.
For example, suppose you write a segment of SQL code that requires information stored
in the version 315 SQLSA data structure. You do not, however, modify your program to
take advantage of the version 315 SQLDA structure. In this case, you might execute the
following directive:
EXEC SQL
INCLUDE STRUCTURES
SQLCA VERSION 2 SQLSA VERSION 315 SQLDA VERSION 2
sql-terminator
Remember that a compilation module cannot contain two different versions of the same
data structure. If a program requires two versions of the same data structure (for
example, a version 315 SQLDA and a version 2 SQLDA) divide the program into two
compilation modules and use a different SQLDA structure in each module. Then, you
can bind the two modules into a single executable SQL program. If you use this method,
be sure you do not declare the two structures with a single name within the global scope
of your program.
For more information on specifying data-structure versions in SQL programs, see
Section 7, Version Compatibility for SQL Programs
.