OASQLIP_get_colval
- Last Updated: May 12, 2026
- 4 minute read
- OpenAccess SDK
- Version 8.1
- Documentation
This function returns the value of the specified column for the current row.
You must return the data in the OASQLIP_get_colval function in the same format as the definition of the column. For example, if you return the description of the first column as XO_TYPE_INTEGER in the OASQLIP_get_numcols call, then return the data in OASQLIP_get_colval as XO_TYPE_INTEGER.
int OASQLIP_get_colval(
SQLIP_HSTMT pStmtDA,
OADS_INTEGER iColNum,
OADS_INTEGER iElementIndex,
OADS_SMALLINT * iXODataType,
OADS_SMALLINT * piIndicator,
OADS_POINTER * ppVal,
OADS_LEN * piLen)
Parameters for OASQLIP_get_colval
| Parameter | Type | Description |
| INPUT | ||
| pStmtDA | SQLIP_HSTMT | Statement handle |
| iColNum | OADS_INTEGER | Column number – first column starts at zero. |
| iElementIndex | OADS_INTEGER | Used only for array column types. If this value is set to –1, then return in ppVal an integer value indicating the number of elements in this value. If >= 0, then return the value at the array element specified by this index. |
| OUTPUT | ||
| iXODataType | OADS_SMALLINT * | Data type of the column. This information describes how the value is stored at the pointer returned in ppVal for data type definitions. |
| piIndicator | OADS_SMALLINT * | Whether the column value is null or not. NULL_INDICATOR – the value is null and therefore ppVal will not contain a valid pointer. ~NULL_INDICATOR – the column has a value and a pointer to it is returned in the ppVal. |
| ppVal | OADS_POINTER * | Return a pointer to data of iXODataType. The calling function reads this data and stores it in its own buffer. The memory used to hold to row in the IP can be freed when next fetch is called on that statement. All string values are assumed NULL terminated. See Table OpenAccess SDK Data Types and the Corresponding C Type. |
| piLen | OADS_LEN * | Length of the data in bytes. |
| RETURN | ||
| int | OADS_SUCCESS – data returned OADS_ERROR - error returning data OADS_NO_DATA – the specified array element iElementIndex is greater than the number of values available (only for ARRAY types of columns) |
OpenAccess SDK Data Types and the Corresponding C Type
| SQL Type | OpenAccess SDK Data Type1 | C/C++ Data Type |
| BIGINT | XO_TYPE_BIGINT | int64 |
| BINARY | XO_TYPE_BINARY | void * – sequence of bytes |
| BIT | XO_TYPE_BIT | char |
| CHAR | XO_TYPE_CHAR | char – string of characters |
| DATE | XO_TYPE_DATE XO_DATE_TYPE |
Note: xo_tm is not the same as the ANSI C tm structure. typedef struct _xo_tm { |
| DOUBLE | XO_TYPE_DOUBLE | double |
| FLOAT | XO_TYPE_FLOAT | double |
| INTEGER | XO_TYPE_INTEGER | long |
| LONGVARBINARY | XO_TYPE_ LONGVARBINARY | DataChainList containing binary data. |
| LONGVARCHAR | XO_TYPE_ LONGVARCHAR | DataChainList containing char data. |
| NUMERIC | XO_TYPE_NUMERIC XO_TYPE_DECIMAL |
char – a string with a decimal point. Does not have to be padded for exact precision and scale specifications. |
| REAL | XO_TYPE_REAL | float |
| SMALLINT | XO_TYPE_SMALLINT | short int |
| TIME | XO_TYPE_TIME XO_TYPE_TIME_TYPE |
Note: xo_tm is not the same as the ANSI C tm structure. typedef struct _xo_tm { |
| TIMESTAMP | XO_TYPE_ TIMESTAMP XO_TYPE_TIMESTAMP_TYPE |
Note: xo_tm is not the same as the ANSI C tm structure. typedef struct _xo_tm { |
| TINYINT | XO_TYPE_TINYINT | unsigned char |
| VARBINARY | XO_TYPE_VARBINARY | void * – sequence of bytes |
| VARCHAR | XO_TYPE_VARCHAR | char – string of characters |
| WCHAR | XO_TYPE_WCHAR | OAWCHAR string. |
| WLONGVARCHAR | XO_TYPE_WLONGVARCHAR | DataChainList containing OAWCHAR characters. |
| WVARCHAR | XO_TYPE_WVARCHAR | OAWCHAR string. |
1 Use with API calls.