SQL Programming Manual for Pascal
NonStop SQL Version Issues
HP NonStop SQL Programming Manual for Pascal—528614-001
D-7
Migrating an Application to Access Version 2 Objects
To use a C10 SQLDA, you can specify the SQL directive release option for the
Pascal compiler or specify the RELEASE1 option in the INCLUDE SQLDA
directive.
Migrating an Application to Access Version 2
Objects
If a program developed on C10 needs to access Version 2 objects or catalogs,
consider the issues in the following discussion.
Dynamic SQL and the SQLDA
Dynamic SQL programs use the SQLDA to obtain data descriptions for input
parameters and output variables used in dynamic SQL statements.
The C30 (RELEASE2) SQLDA has a new field called PRECISION that supplies
precision information when a column of FLOAT, REAL, DOUBLE PRECISION,
DATETIME, DATE, TIME, TIMESTAMP, or INTERVAL data type is accessed. If the
program accesses columns of these data types, the program must provide a
RELEASE2 SQLDA structure. When the RELEASE2 structure is provided, precision
information is also returned when columns of other data types are accessed.
In addition to the PRECISION field, two other significant changes have been made to
the RELEASE2 SQLDA for null support.
•
The NULL-INFO SQLDA field, unused in the RELEASE1 SQLDA, is now set to -1
if the value returned in the corresponding SELECT column is allowed to be null.
The value is allowed to be null only if the column definition permits null values.
•
The RESERVED field has been renamed IND-PTR. The IND-PTR field is similar to
the VAR-PTR field, but is for the extended address of a NULL indicator variable.
The extended address is not returned by SQL; the program must initialize INDPTR
to point to the input and output indicator variables that it has declared and
allocated.
Dynamic SQL programs accessing null values or Version 2 data types can either use
the INCLUDE SQLDA directive to generate an SQLDA structure or include the SQLDA
declaration code in the source file. Existing programs that include the SQLDA
declaration code must use the RELEASE2 SQLDA structure to access columns with
Version 2 data types. A RELEASE2 SQLDA data structure is the default when you
Pascal compile and SQL compile a run unit using C30 software.
If program code initializes the SQLDA structure, the code must set the correct version
value in the SQLDA EYE-CATCHER field to match the SQLDA version. The value “DA”
indicates a C10 (RELEASE1) SQLDA; the value “D1” indicates a C30 (RELEASE2)
SQLDA.
If the dynamic SQL program expects to handle null values, the program must allocate
indicator variables and initialize the IND-PTR field in addition to the VAR-PTR field. To