SQL/MP Version Management Guide

Version Compatibility for SQL Programs
Compaq NonStop™ SQL/MP Version Management Guide429833-001
7-3
Developing Version Independent SQL Programs
Developing Version Independent SQL Programs
Version independent programs are programs that can be executed successfully by more
than one version of the SQL/MP software and are expected to be supported in future
versions of the software. To develop version independent programs, observe these rules:
Replace any procedures and directives in existing programs that are expected to
become obsolete in future versions of SQL/MP. For example, avoid using the
RELEASE1 and RELEASE2 directives and the SQLGETSYSTEMVERSION,
SQLGETCATALOGVERSION, and SQLGETOBJECTVERSION procedures in
TAL.
Host-compile your source program with a host language compiler whose SQL
version is the same as the version of the oldest SQL/MP software on the node on
which the program will execute. Alternatively, you can host-compile the program
separately on each node on which it is to run.
Also, to take advantage of changes to new versions of the SQL data structures, follow
the guidelines outlined under Version Independent SQL Data Structures
on page 7-4.
Version Independent Statements and Directives
In version 2 of the SQL software and newer versions of the SQL software, programs can
retrieve the version of the software that is currently running and can obtain the version
numbers of the SQL objects and catalogs being used.
Additionally, programs running under version 2 and newer of the software can specify
the versions of the SQL data structures that are to be used. However, as noted
previously, all these features are expected to be phased out in future releases of SQL/MP
software. Therefore, you should not make use of them in the source code of any
programs you want to make version independent.
If you are developing new SQL programs that you plan to run under version 300 or
newer SQL/MP software, these precautions can also help make your programs version
independent:
Use the GET VERSION statement rather than the SQLGETVERSION procedure to
determine the version of SQL objects, catalogs, and software.
Place the INCLUDE STRUCTURES directive in your source code before you use
the INCLUDE SQLCA, INCLUDE SQLSA, or INCLUDE SQLDA directives.
These two precautions are explained in more detail following.
Version Independence and Existing SQL Programs
To ensure that your existing version 2 SQL programs are version independent, replace
any SQLGETVERSION procedures in your programs with GET VERSION OF
statements:
Replace SQLGETOBJECTVERSION procedures with GET VERSION OF object
statements.