SQL/MX 3.2.1 Programming Manual for C and COBOL (H06.26+, J06.15+)

Static Rowsets
HP NonStop SQL/MX Release 3.2.1 Programming Manual for C and COBOL663854-005
7-4
Rowset Host Variable Pointers
Rowset Host Variable Pointers
A rowset host variable cannot be declared as a pointer. If you need to access a rowset
host variable through a pointer, you must make the rowset host variable a structure
field.
Example
The following example shows an improper usage of rowset host variable where the
rowset host variable is declared as a pointer type:
EXEC SQL BEGIN DECLARE SECTION;
/* cannot declare a rowset pointer as host variable */
ROWSET [100] int * rowsetPtr;
...
The following example shows the correct use of rowsets in a structure:
EXEC SQL BEGIN DECLARE SECTION;
struct ptrType
{
/* rowsets are allowed as structure fields */
ROWSET [100] int rowsetField;
...
};
struct ptrType * structPtr;
...
Considerations for Rowset Size
The total rowset size (that is, the size of the row times the number of rows) should
not produce fragmentation in the network or process communication.
The total rowset size should not exceed the physical memory of the client
computer to avoid fragmentation while accessing a rowset array.
The rowset size should not be less than the number of rows that need to be
accessed simultaneously. For example, a screen-based application should use a
rowset size that is a multiple of the number of rows displayed on the screen.
Specifying Rowset Arrays
After you declare a host variable array that is a part of a rowset, use this syntax to
specify it within an embedded SQL statement.
array-name
is the host variable array name. It can be any valid host language identifier with a
data type that corresponds to an SQL data type. You must precede array-name
with a colon (:) within an SQL statement.
:array-name [[INDICATOR] :indicator-array-name]