B. Data Types
 
Share this page                  
Data Types
Ingres Data Types
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:
n
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.
p
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.
s
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/
Scale
C Type
SQL Type
IIAPI_BOOL_TYPE
1
0/0
U_char
boolean
IIAPI_BYTE_TYPE
n
0/0
char*
byte(n)
IIAPI_CHA_TYPE
n
0/0
char*
char(n)
IIAPI_CHR_TYPE
n
0/0
char*
c(n)
IIAPI_HNDL_TYPE
4
0/0
void*
n/a
IIAPI_DATE_TYPE
4
0/0
none
ansidate
IIAPI_DEC_TYPE
1-16 (dep. on precision)
p/s
none
decimal(p,s)
IIAPI_INTDS_TYPE
12
p/0
none
interval day to second
IIAPI_DTE_TYPE
12
0/0
none
ingresdate
IIAPI_FLT_TYPE
4
8
p/0
float
double
float4/real
float8/float
IIAPI_INT_TYPE
1
2
4
8
0/0
char
short
long
long long
integer1
integer2/smallint
integer4/integer
integer8/bigint
IIAPI_INTYM_TYPE
3
p/0
none
interval year to month
IIAPI_IPV4_TYPE
4
0/0
char*
ipv4
IIAPI_IPV6_TYPE
16
0/0
char*
ipv6
IIAPI_LOGKEY_TYPE
16
0/0
char*
object_key
IIAPI_LBYTE_TYPE
(max 2 GB)
0/0
char*
long byte
IIAPI_NBLOC_TYPE
4
0/0
long
long byte locator
IIAPI_NCLOC_TYPE
4
0/0
long
long varchar locator
IIAPI_LNLOC_TYPE
4
0/0
long
long nvarchar locator
IIAPI_LNVCH_TYPE
(max 2 GB)
0/0
short*
long nvarchar
IIAPI_LVCH_TYPE
(max 2 GB)
0/0
char*
long varchar
IIAPI_LTXT_TYPE
n
0/0
char*
null
IIAPI_MNY_TYPE
8
p/0
none
money
IIAPI_NCHA_TYPE
n
0/0
short*
nchar(n)
IIAPI_NVCH_TYPE
n
0/0
short*
nvarchar(n)
IIAPI_TABKEY_TYPE
8
0/0
char*
table_key
IIAPI_TIME_TYPE
10
p/0
none
time with local time zone
IIAPI_TMWO_TYPE
10
p/0
none
time without time zone
IIAPI_TMTZ_TYPE
10
p/0
none
time with time zone
IIAPI_TSWO_TYPE
14
p/0
none
timestamp without time zone
IIAPI_TSTZ_TYPE
14
p/0
none
timestamp with time zone
IIAPI_TS_TYPE
14
p/0
none
timestamp with local time zone
IIAPI_TXT_TYPE
n
0/0
char*
text(n)
IIAPI_UUID_TYPE
16
0/0
char*
uuid
IIAPI_VBTYE_TYPE
n
0/0
char*
varbyte(n)
IIAPI_VCH_TYPE
n
0/0
char*
varchar(n)
The following symbols are defined for the values in the Length column of the table:
IIAPI_I1_LEN
IIAPI_I2_LEN
IIAPI_I4_LEN
IIAPI_I8_LEN
IIAPI_F4_LEN
IIAPI_F8_LEN
IIAPI_MNY_LEN
IIAPI_BOOL_LEN
IIAPI_UUID_LEN
IIAPI_IPV4_LEN
IIAPI_IPV6_LEN
IIAPI_DTE_LEN (Synonym: IIAPI_IDATE_LEN)
IIAPI_TIME_LEN
IIAPI_DATE_LEN (Synonym: IIAPI_ADATE_LEN)
IIAPI_TS_LEN
IIAPI_INTYM_LEN
IIAPI_INTDS_LEN
IIAPI_LOGKEY_LEN
IIAPI_TABKEY_LEN
IIAPI_LOCATOR_LEN