skip to main content
IP API Reference for C/C++ : IP API for C/C++ : OASQLIP_get_colval
 

OASQLIP_get_colval

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)
 
Table 27: 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 28.
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)
 
 
Table 28: 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 {
int tm_sec; /* NA */
int tm_min; /* NA */
int tm_hour; /* NA */
int tm_mday; /* day of the month */
/* [1,31] */
int tm_mon; /* months since January
/* [0,11] */
int tm_year; /* years after 0 A.D */
int tm_wday; /* Reserved for future*/
/* use */
int tm_yday; /* Reserved for future*/
/* use */
int tm_isdst; /* Reserved for */
/* future use */
} 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 {
int tm_sec; /* seconds after */
/* the minute - [0,59] */
int tm_min; /* minutes after */
/* the hour - [0,59] */
int tm_hour; /* hours since */
/* midnight - [0,23] */
int tm_mday; /* NA */
int tm_mon; /* NA */
int tm_year; /* NA */
int tm_wday; /* Reserved for */
/*future use */
int tm_yday; /* Reserved for */
/* future use */
int tm_isdst; /* Reserved for */
/* future use */
} 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 {
int tm_sec; /* seconds after the */
/* minute - [0,59] */
int tm_min; /* minutes after the */
/* hour - [0,59] */
int tm_hour; /* hours since */
/* midnight - [0,23] */
int tm_mday; /* day of the month -*/
/* [1,31] */
int tm_mon; /* months since */
/* January - [0,11] */
int tm_year; /* years after 0 A.D */
int tm_wday; /* Reserved for future */
/* use */
int tm_yday; /* Reserved for future*/
/* use */
int tm_isdst; /* Reserved for future */
/* use */
int tm_frac; /* billionths of a */
/* second and ranges from 0 */
/* to 999999999. If your */
/* column has a scale of */
/* 3 (thousandths of a */
/* second format), to */
/* return 0.005, set the */
/* tm_frac=5000000 */
} 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.

See also 

OASQLIP_get_colval
OASQLIP_get_numcols