SQL Programming Manual for Pascal

NonStop SQL Version Issues
HP NonStop SQL Programming Manual for Pascal528614-001
D-15
Using the Single-Code Thread Design
are represented as string text assigned to host variables in PREPARE statements
and, therefore, are not processed at explicit SQL compilation time.
If the program uses dynamic SQL, include multiple SQLDA structures. The
program must declare both RELEASE1 format and RELEASE2 format SQLDAs
and contain code to initialize both types of SQLDAs. Before executing a query, the
program must check the SQL software version on the system where the program is
executing. This check can be made just once, at program startup. Depending on
the SQL software version, the program must initialize and use the appropriate
SQLDA.
Ensure that the PREPARE statement for a dynamic SQL statement that uses
Version 2 features executes only within a code branch for Version 2. The following
pseudocode illustrates this technique:
IF SOFTWAREVERSION = VERSION_2 THEN
H := 'SELECT * FROM T UNION SELECT * FROM T2"'
ELSE H := 'SELECT * FROM T';
EXEC SQL PREPARE S FROM :H ;
Develop, code, Pascal compile, and bind the program.
For the C30 production environment, SQL compile and test the program on the
development node; then distribute the program object file to other C30 nodes for
installation and use.
For the C10 production environment, move the program object file to a C10 node
for SQL compilation and testing; then distribute the program object file to other C10
nodes for installation and use. Developing and installing a generic release program
is illustrated in Figure D-1 on page D-15. The RELEASE1 option used in the
program enables code generation for the C10 environment.
Figure D-1. Developing and Installing a Generic Application
SQL compile, test, and
install the application on the
C10 production node.
C30 SQL system
C30 COBOL85
compiler (Release 1)
Node \DEVEL
C30 SQL system
C30 SQL compiler
Node \PRODR2
C10 SQL system
C10 SQL compiler
Node \PRODR1
C30 SQL compiler SQL
compile and install the
application on the C30
production node.
VSTD01.vsd