Retrieve data
Each HCL Informix® data type can fit in a .NET Framework data type.
The following table shows each HCL Informix data type, the recommended type to store that data type in, and the .NET Framework data type that it best fits in. The recommended type should be used when accessing data through an IfxDataReader. The best-fit .NET type is the type that an IfxDataAdapter object will use when it fills a DataSet object.
You can use types other than those shown, for example you can use the IfxDataReader.GetString method to get any data type that can be stored in the Informix database. The types recommended are the most efficient and least likely to change the value.
Informix data type | Recommended type | Best-fit native .NET data type |
---|---|---|
BIGINT | Int64 | Int64 |
BIGSERIAL | Int64 | Int64 |
BLOB | IfxBlob | Byte[] |
BOOLEAN | Boolean | Boolean |
BYTE | Byte[] | Byte[] |
CHAR | String | String |
CHAR(1) | String | String |
CLOB | IfxClob | Byte[] |
DATE | IfxDateTime | DateTime |
DATETIME | IfxDateTime | DateTime |
DECIMAL(p<=28) fixed scale | IfxDecimal | Decimal |
DECIMAL (p<=28) floating point | IfxDecimal | Double |
DECIMAL (p>28) | IfxDecimal | String |
DOUBLE | Double | Double |
FLOAT | Double | Double |
IDSSECURITYLABEL | Int64[] | Int64[] |
INTEGER | Int32 | Int32 |
INT8 | Int64 | Int64 |
INTERVAL, year-month | IfxMonthSpan | String |
INTERVAL, day-fraction | IfxTimeSpan | TimeSpan |
LVARCHAR | String | String |
MONEY | IfxDecimal | As for Decimal with same precision |
NCHAR | String | String |
REAL | Float | Float |
SERIAL | nt32 | Int32 |
SERIAL8 | Int64 | Int64 |
SMALLFLOAT | Float | Float |
TEXT | String | String |
VARCHAR | String | String |
For the format of Informix data types, DECIMAL, MONEY, DATETIME, and INTERVAL returned using IfxDataReader.GetString method see the section about the Literal Row segment in HCL Informix Guide to SQL: Syntax.
The ROW and TEXT types and the collection types, LIST, MULTISET, SET, can be mapped to a string literal .NET Framework type and accessed with the IfxDataReader.GetString method. The format for the string is documented in the HCL Informix Guide to SQL: Syntax, in the section about the Literal Row segment.
In order to make the expression of any nested string literals simpler, a leading quotation mark is not returned in the string. A single-quotation mark, rather than a double-quotation mark, is used to begin and end any string literals embedded in the ROW type. This is to avoid confusion if a double-quotation mark might be used as a delimited identifier.