Scalable Database Server, HiRDB Version 8 UAP Development Guide
This appendix explains the organization and contents of the areas that are described in the information on I/O variables, determined dynamically at the time of UAP execution.
Figure B-1 shows how the SQL Descriptor Area is organized.
Figure B-1 Organization of the SQL Descriptor Area
Notes
Table B-1 shows the contents of the SQL Descriptor Area; for details about SQL data, see Table B-2 Data codes and data lengths set in the SQL Descriptor Area.
Table B-1 Contents of the SQL Descriptor Area
Level number1 | Data Area name | Data type | Length (bytes) | Source of value | Description |
---|---|---|---|---|---|
1 | SQLDA | 16+16n [24+24n] |
Denotes the overall SQL Descriptor Area. | ||
2 | SQLDAID | char | 8 | HiRDB | Contains the SQLDA ID (SQLDA ), indicating the SQLDA. This parameter is set when the DESCRIBE or DESCRIBE TYPE statement is issued. |
2 | SQLDABC | long | 4 [8]6 | HiRDB | Contains the length of SQLDA. This parameter is set when the DESCRIBE or DESCRIBE TYPE statement is issued. |
2 | SQLN2 | short | 2 | UAP | When an SQLDA area is allocated or SQLDA is used, this parameter specifies the number of SQLVARs (1 to 4000) for the allocated SQLDA area. |
HiRDB | Binary 0 is set in this area if there is not enough SQLDA area (SQLN < SQLD) when the DESCRIBE or DESCRIBE TYPE statement is issued. | ||||
2 | SQLD | short | 2 | UAP | When the OPEN or EXECUTE statement is issued, specifies the number of input ? parameters in SQLD of the SQL Descriptor Area that is specified in the USING clause. When the EXECUTE statement is issued, specifies the number of output ? parameters in SQLDA of the SQL Descriptor Area that is specified in the INTO clause. When the FETCH statement is issued, specifies the number of retrieval items (1-4000). |
HiRDB | Binary 0, the number of retrieval items, or the number of output ? parameters is set when the DESCRIBE [OUTPUT] statement is issued:
The total number of user-defined type configuration elements that the system tried to receive and high-order user-defined type configuration elements being inherited is set when the DESCRIBE TYPE statement is issued. However, if the number of configuration elements exceeds 30,000, 30001 is set. |
||||
2 | SQLVAR | 16n [24n] |
Area composed of the SQLDIM, SQLCOD, SQLXDIM, SQLLEN, SQLSYS, SQLDATA, and SQLIND areas. This set of areas should be defined at least as many times as the value specified in the SQLN area. | ||
3 | SQLDIM | unsigned char | 1 | Not used. | |
3 | SQLCOD | unsigned char | 1 | UAP | A data code3 is specified in this area when an EXECUTE, OPEN, or FETCH statement is issued. |
HiRDB | A data code3 is set in this area after a DESCRIBE or DESCRIBE TYPE statement is issued. | ||||
3 | SQLXDIM | short | 2 | UAP | One of the following values is specified, depending on the structure type of the area for the variable specified by SQLDA when the EXECUTE, OPEN, or FETCH statement is issued. Simple structure: 1 Repetition structure: 2 to 30000 (integer indicating maximum number of elements in the area) For details about data area structures, see E. SQL Data Types and Data Descriptions. |
HiRDB | One of the following values is set depending on the structure type of the retrieval item or ? parameter when the DESCRIBE or DESCRIBE TYPE statement is issued. Simple structure: 1 Repetition structure: 2 to 30000 (integer indicating maximum number of members in the area) |
||||
3 | SQLLEN3, 4 | short | 2 | UAP | A data length3 is set in this area when an EXECUTE, OPEN, or FETCH statement is issued. |
HiRDB | A data length3 is set in this area after a DESCRIBE or DESCRIBE TYPE statement is issued. | ||||
3 | SQLSYS | short | 2 | UAP | The following value is specified when the EXECUTE, OPEN, or FETCH statement is issued:
|
HiRDB | 0 is set when the DESCRIBE or DESCRIBE TYPE statement is issued. | ||||
3 | SQLDATA5 | unsigned char | 4 [8] | UAP | Specifies the address of the data area that stores the value of the ? parameter when either an EXECUTE or an OPEN statement is issued.5 When a FETCH statement is issued, this area specifies the address of the data area that receives the data. |
3 | SQLIND5 | short | 4 [8] | UAP | Specifies the address of the area for receiving the value of the indicator variable only if a data code with an indicator variable is set in SQLCODE when an EXECUTE, OPEN, or FETCH statement is issued. The area for receiving the value of the indicator variable is 2 bytes. For details about indicator variable specification, see Table B-2 Data codes and data lengths set in the SQL Descriptor Area. |
Data area name | Data type | Length (bytes) | Description |
---|---|---|---|
SQLPRCSN | B | 1 | Precision (p) |
SQLSCALE | B | 1 | Decimal scaling position (s) |
Table B-2 Data codes and data lengths set in the SQL Descriptor Area
Decimal data code | Hexadecimal data code | Indicator variable | Data type | Data length | Unit |
---|---|---|---|---|---|
0 | 00 | Data type not available in HiRDB1 | 0 | Bytes | |
48 | 30 | No | C VARCHAR(n)4 | 1 n 320002 | |
49 | 31 | Yes | |||
68 | 44 | No | ROW | Row length L in table to be operated on: 1 L 30,000 |
|
69 | 45 | Yes | |||
100 | 64 | No | INTERVAL YEAR TO DAY | Precision 8 Decimal scaling factor 0 |
Digits |
101 | 65 | Yes | |||
110 | 6E | No | INTERVAL HOUR TO SECOND | Precision 6 Decimal scaling factor 0 |
|
111 | 6F | Yes | |||
112 | 70 | No | DATE | 4 | Bytes |
113 | 71 | Yes | |||
120 | 78 | No | TIME | 3 | |
121 | 79 | Yes | |||
124 | 7C | No | TIMESTAMP[(p)] | 7 p 2 p = 0, 2, 4, or 6 |
|
125 | 7D | Yes | |||
131 | 83 | Abstract data type3 | |||
144 | 90 | No | BINARY(n) | 1 n 21474836472 | Bytes |
145 | 91 | Yes | |||
146 | 92 | No | BLOB[(n)] | 1 n 2147483647 | |
147 | 93 | Yes | |||
154 | 9A | No | BINARY locator | 4 | |
155 | 9B | Yes | |||
158 | 9E | No | BLOB locator | 4 | |
159 | 9F | Yes | |||
160 | A0 | No | MVARCHAR(n) | 1 n 320002 | |
161 | A1 | Yes | |||
164 | A4 | No | MCHAR[(n)] | 1 n 30000 | |
165 | A5 | Yes | |||
176 | B0 | No | NVARCHAR(n) | 1 n 160002 | Characters |
177 | B1 | Yes | |||
180 | B4 | No | NCHAR(n) or NATIONAL CHAR[ACTER](n) | 1 n 15,000 | |
181 | B5 | Yes | |||
192 | C0 | No | VARCHAR(n) | 1 n 32,0002 | Bytes |
193 | C1 | Yes | |||
196 | C4 | No | CHAR[ACTER](n) | 1 n 30,000 | |
197 | C5 | Yes | |||
224 | E0 | No | FLOAT or DOUBLE PRECISION | 8 | |
225 | E1 | Yes | |||
226 | E2 | No | SMALLFLT or REAL | 4 | |
227 | E3 | Yes | |||
228 | E4 | No | [LARGE]DEC[IMAL] [(p [, s])] |
Precision p Decimal scaling factor s 1 p 29, 0 s p |
Digits |
229 | E5 | Yes | |||
234 | EA | No | DISPLAY SIGN LEADING SEPARATE5 | Precision p Decimal scaling factor s 1 p 29, 0 s p |
|
235 | EB | Yes | |||
240 | F0 | No | INT[EGER] | 4 | Bytes |
241 | F1 | Yes | |||
244 | F4 | No | SMALLINT | 2 | |
245 | F5 | Yes |
2 When a variable-length character string of 0 length is set in the UAP, 1 must be set in the SQLLEN area.
3 When the DESCRIBE statement is executed, a data type is returned from the server. The UAP can reference data types. Data type setup and data length setup and referencing are disabled.
Table B-3 Contents of SQLVAR_LOB
Level number1 | Data Area name | Data type | Length (bytes) | Source of value | Description |
---|---|---|---|---|---|
2 | SQLVAR_LOB | 16n [24n] |
Area that consists of SQLDIM, SQLCOD, SQLXDIM, SQLLOBLEN, SQLDATA, SQLDATA, and SQLLOBIND. Define this area in the SQLVAR area, and use it by overwriting the SQLVAR area during the input/out of BLOB- and BINARY-type data. | ||
3 | SQLDIM | unsigned char | 1 | Not used. | |
3 | SQLCOD | unsigned char | 1 | UAP | Specifies a data code2 when the EXECUTE, OPEN, or FETCH statement is issued. |
HiRDB | Contains a data code2 after the DESCRIBE or DESCRIBE TYPE statement has been issued. | ||||
3 | SQLXDIM | short | 2 | UAP | Specifies 1 when the EXECUTE, OPEN, or FETCH statement is issued. For details about the data area structures, see E. SQL Data Types and Data Descriptions. |
HiRDB | Contains the value 1 after the DESCRIBE or DESCRIBE TYPE statement has been issued. | ||||
3 | SQLLOBLEN2 | long [int] | 4 | UAP | Specifies the data length2 when the EXECUTE, OPEN, or FETCH statement is issued. |
HiRDB | Contains the data length2 after the DESCRIBE or DESCRIBE TYPE statement is issued. | ||||
3 | SQLDATA3 | unsigned char * | 4 [8] | UAP | When the EXECUTE or OPEN statement is issued, specifies the address of the data area in which a ? parameter value is stored. When the FETCH statement is issued, specifies the address of the data area that receives the data. |
3 | SQLLOBIND3 | long * [int *] |
4 [8] | UAP | Specifies the address of the area for receiving the value of the indicator variable only if a data code with an indicator variable is set in SQLCODE when an EXECUTE, OPEN, or FETCH statement is issued. The area for receiving the value of the indicator variable is 4 bytes. For details about indicator variable specification, see Table B-2 Data codes and data lengths set in the SQL Descriptor Area. |
: Not applicable.
All Rights Reserved. Copyright (C) 2007, Hitachi, Ltd.