This appendix describes the Ingres data types used by OpenAPI.
Ingres data types are described by the information conveyed in the IIAPI_DESCRIPTOR structure. This structure describes the data type, length, and precision of OpenAPI data.
The following table provides the data type, length, and precision value for each Ingres data type and maps the data type to its corresponding C type and SQL type. The following symbols are used in the table:
Specifies the length of the specific data value. This value varies, but is limited by the maximum length supported by the DBMS, typically between 2 KB and 32 KB.
Specifies the precision for the specific data value. This value varies, but is limited by the maximum precision allowed by the length of the data.
Specifies the scale for the specific data value. This value varies, but is limited by the precision value.
Lengths, precisions, or scales that are not required are shown as 0 in the table.
If the C type is shown as none, a character buffer of the appropriate length can be used to store the data value and IIapi_convertData() or IIapi_formatData() can be used to convert the data value to a type that has a corresponding C type.
The following table lists the Ingres data types:
Data Type |
Length |
Precision/ |
C Type |
SQL Type |
BLOB? |
|---|---|---|---|---|---|
IIAPI_BYTE_TYPE |
n |
0/0 |
char* |
byte(n) |
no |
IIAPI_CHA_TYPE |
n |
0/0 |
char* |
char(n) |
no |
IIAPI_CHR_TYPE |
n |
0/0 |
char* |
c(n) |
no |
IIAPI_HNDL_TYPE |
4 |
0/0 |
void* |
n/a |
no |
IIAPI_DATE_TYPE |
4 |
0/0 |
none |
ansidate |
no |
IIAPI_DEC_TYPE |
1-16 (dep. on precision) |
p/s |
none |
decimal(p,s) |
no |
IIAPI_INTDS_TYPE |
12 |
p/0 |
none |
interval day to second |
no |
IIAPI_DTE_TYPE |
12 |
0/0 |
none |
ingresdate |
no |
IIAPI_FLT_TYPE |
4 |
p/0 |
float |
float4/real |
no |
IIAPI_INT_TYPE |
1 |
0/0 |
char |
integer1 |
no |
IIAPI_INTYM_TYPE |
3 |
p/0 |
none |
interval year to month |
no |
IIAPI_LOGKEY_TYPE |
16 |
0/0 |
char* |
object_key |
no |
IIAPI_LBYTE_TYPE |
(max 2 GB) |
0/0 |
char* |
long byte |
yes |
IIAPI_LNVCH_TYPE |
(max 2 GB) |
0/0 |
short* |
long nvarchar |
yes |
IIAPI_LVCH_TYPE |
(max 2 GB) |
0/0 |
char* |
long varchar |
yes |
IIAPI_LTXT_TYPE |
n |
0/0 |
char* |
null |
no |
IIAPI_MNY_TYPE |
8 |
p/0 |
none |
money |
no |
IIAPI_NCHA_TYPE |
n |
0/0 |
short* |
nchar(n) |
no |
IIAPI_NVCH_TYPE |
n |
0/0 |
short* |
nvarchar(n) |
no |
IIAPI_TABKEY_TYPE |
8 |
0/0 |
char* |
table_key |
no |
IIAPI_TIME_TYPE |
10 |
p/0 |
none |
time with local time zone |
no |
IIAPI_TMWO_TYPE |
10 |
p/0 |
none |
time without time zone |
no |
IIAPI_TMTZ_TYPE |
10 |
p/0 |
none |
time with time zone |
no |
IIAPI_TSWO_TYPE |
14 |
p/0 |
none |
timestamp without time zone |
no |
IIAPI_TSTZ_TYPE |
14 |
p/0 |
none |
timestamp with time zone |
no |
IIAPI_TS_TYPE |
14 |
p/0 |
none |
timestamp with local time zone |
no |
IIAPI_TXT_TYPE |
n |
0/0 |
char* |
text(n) |
no |
IIAPI_VBYTE_TYPE |
n |
0/0 |
char* |
varbyte(n) |
no |
IIAPI_VCH_TYPE |
n |
0/0 |
char* |
varchar(n) |
no |
Ingres data types are described as follows.
Specifies a fixed-length binary string containing data with the declared length. The declared length is stored as the ds_length parameter in the corresponding data descriptor.
Limits: Length is 1 to DBMS maximum bytes.
Specifies a fixed-length character string that is stored blank-padded to the declared length. The declared length is stored as the ds_length parameter in the corresponding data descriptor. Embedded blanks are significant. Valid characters for this data type include printing, non-printing, and NULL characters.
Limits: Length is 1 to DBMS maximum characters.
Specifies a fixed-length character string that is stored blank-padded to the declared length. The declared length is stored as the ds_length parameter in the corresponding data descriptor. Embedded blanks are insignificant. Valid characters for this data type include printing characters only. This data type is supported for previous Ingres versions; when possible, use IIAPI_CHA_TYPE.
Limits: Length is 1 to DBMS maximum characters.
Specifies a data type used only by OpenAPI and the application. This data type describes a handle, which is a pointer to one of the control blocks created by OpenAPI. OpenAPI translates the information in the control block into data acceptable by the data source. This data type does not appear in queries.
Specifies an ANSI date data type that is stored in 4 bytes. IIapi_convertData() or IIapi_formatData() can be used to convert to character string representation.
Specifies a packed-decimal data type stored in 1 to 16 bytes depending on the precision of the value as follows: len = (precision)/2 + 1. IIapi_convertData() or IIapi_formatData() can be used to convert to character string or floating point representation.
Specifies an Ingres internal date data type that is stored in 12 bytes. IIapi_convertData() or IIapi_formatData() can be used to convert to character string or floating point representation.
Specifies a floating-point data type.
Limits: Data value range is 1.0e+38 to +1.0e+38.
Specifies a data type supporting varying data value ranges. It is dependent on the ds_length of the data value.
Limits:
If the length is 1, the range is -128 to +127.
If the length is 2, the range is -32,768 to +32,767.
If the length is 4, the range is -2,147,483,648 to +2,147,483,647.
If the length is 8, the range is 9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
Specifies an ANSI day to second interval data type that is stored in 12 bytes. IIapi_convertData() or IIapi_formatData() can be used to convert to character string representation.
Specifies an ANSI year to date interval data type that is stored in 3 bytes. IIapi_convertData() or IIapi_formatData() can be used to convert to character string representation.
Specifies a data type with values unique within the data source. An application should not attempt to update a column containing a system-maintained object key.
Specifies a variable-length binary string. The actual length of the large byte segment is stored in the first two bytes of the data buffer, followed by the large byte data.
Limits: Length is 0 to 2,000,000,000 bytes.
Specifies a variable-length National Character Set string. Each character in the string is represented by an unsigned two-byte integer holding a UTF-16-encoded character. The actual length in characters of the large nvarchar segment is stored in the first two bytes of the data buffer, followed by the large nvarchar data.
Limits: Length is 0 to 1,000,000,000 NCS characters.
Specifies a variable-length character string. The actual length of the large varchar segment is stored in the first two bytes of the data buffer, followed by the large varchar data. Valid characters for this data type include printing, non-printing, and NULL characters. Trailing blanks are insignificant in a varchar data type.
Limits: Length is 0 to 2,000,000,000 characters.
Specifies a variable-length character string. The maximum size for this data type is stored as the ds_length parameter in the corresponding descriptor. The actual length of the text data is stored in the first two bytes of the data buffer, followed by the text data.
Valid characters for this data type include printing and nonprinting characters. All blanks are significant in a text data buffer. This type is supported for typeless NULL values. A NULL value of this type can be coerced into any other data type. Otherwise, use IIAPI_VCH_TYPE.
Limits: Length is 1 to DBMS maximum characters.
Specifies the Ingres money data type stored in 8 bytes with two fixed decimal places. IIapi_convertData() or IIapi_formatData() can be used to convert to character string or floating point representation.
Specifies a fixed length National Character Set string that is stored blank-padded to the declared length. Each character in the string is represented by an unsigned two-byte integer holding a UTF-16 encoded character. The full byte length (twice the declared character length) is stored as the ds_length parameter in the corresponding data descriptor.
Limits: Length is 1 to DBMS maximum NCS characters.
Specifies a variable-length National Character Set string. Each character in the string is represented by an unsigned two-byte integer holding a UTF-16 encoded character. The maximum size in bytes for nvarchar data is stored as the ds_length parameter in the corresponding descriptor. The actual length in characters of the varchar data is stored in the first two bytes of the data buffer, followed by the nvarchar data.
Limits: Length is 0 to DBMS maximum NCS characters.
Specifies a data type with a value that is unique within the table where the table key is stored. An application should not attempt to update a column containing a system-maintained table key.
Specifies an Ingres time data type with local time zone that is stored in 10 bytes. IIapi_convertData() or IIapi_formatData() can be used to convert to character string representation.
Specifies an ANSI time data type with timezone that is stored in 10 bytes. IIapi_convertData() or IIapi_formatData() can be used to convert to character string representation.
Specifies an ANSI time data type without time zone that is stored in 10 bytes. IIapi_convertData() or IIapi_formatData() can be used to convert to character string representation.
Specifies an Ingres timestamp data type with local timezone that is stored in 14 bytes. IIapi_convertData() or IIapi_formatData() can be used to convert to character string representation.
ANSI timestamp data type with timezone that is stored in 14 bytes. IIapi_convertData() or IIapi_formatData() can be used to convert to character string representation.
Specifies an ANSI timestamp data type without time zone that is stored in 14 bytes. IIapi_convertData() or IIapi_formatData() can be used to convert to character string representation.
Specifies a variable-length character string. The maximum size for this data type is stored as the ds_length parameter in the corresponding descriptor. The actual length of the text data is stored in the first two bytes of the data buffer, followed by the text data. Valid characters for this data type include printing and non-printing characters. All blanks are significant in a text data buffer. This type is supported for previous Ingres versions; when possible, use IIAPI_VCH_TYPE.
Limits: Length is 1 to DBMS maximum characters.
Specifies a variable-length binary string. The maximum size for varbyte data is stored as the ds_length parameter in the corresponding descriptor. The actual length of the varbyte data is stored in the first two bytes of the data buffer, followed by the varbyte data.
Limits: Length is 0 to 2,000 bytes.
Specifies a variable-length character string. The maximum size for varchar data is stored as the ds_length parameter in the corresponding descriptor. The actual length of the varchar data is stored in the first two bytes of the data buffer, followed by the varchar data. Trailing blanks are insignificant in a varchar data type.
Limits: Length is 0 to 2,000 characters.