odbx_column_type - Man Page
Returns the SQL data type of a column in the current result set
Synopsis
#include <opendbx/api.h>
int
odbx_column_type (odbx_result_t*
result, unsigned long pos);
Description
odbx_column_type() returns the data type of the requested column within the current result set returned by odbx_result(). The column type applies to all fields at the same position of the rows fetched via odbx_row_fetch(). The definitions are based on the SQL2003 standard and the data types of the database server have to comply to the specification of the standard. Data types provided by database implementations which are not covered by the SQL2003 standard are subsumed as ODBX_TYPE_UNKNOWN
.
The result
parameter required by this function must be a valid result set returned by odbx_result() and must not has been feed to odbx_result_finish() before.
Valid column indices for the requested column provided via pos
start with zero and end with the value returned by odbx_column_count() minus one.
Return Value
If a values less than zero is returned, an error occurred. Possible error codes are listed in the error section and the application can retrieve a textual message of the error by calling odbx_error().
A positive return value including zero indicates one of the SQL2003 compliant data types listed below. Before release 1.1.5 of the OpenDBX library, types were defined as ODBX_* instead of ODBX_TYPE_*. The old definitions are kept for backward compatibility but shouldn't be used any more. They will be removed at some point in the future.
Exact numeric values:
ODBX_TYPE_BOOLEAN
: True/false valuesODBX_TYPE_SMALLINT
: Signed 16 bit integerODBX_TYPE_INTEGER
: Signed 32 bit integerODBX_TYPE_BIGINT
: Signed 64 bit integerODBX_TYPE_DECIMAL
: Exact signed numeric values with user defined precision
Approximate numeric values:
ODBX_TYPE_REAL
: Approximate numeric values (signed) with 32 bit precisionODBX_TYPE_DOUBLE
: Approximate numeric values (signed) with 64 bit precisionODBX_TYPE_FLOAT
: Approximate numeric values (signed) with user defined precision
String values:
ODBX_TYPE_CHAR
: Fixed number of charactersODBX_TYPE_NCHAR
: Fixed number of characters using a national character setODBX_TYPE_VARCHAR
: Variable number of charactersODBX_TYPE_NVARCHAR
: Variable number of characters using a national character set
Large objects:
ODBX_TYPE_CLOB
: Large text objectODBX_TYPE_NCLOB
: Large text object using a national character setODBX_TYPE_XML
: XML tree in text formatODBX_TYPE_BLOB
: Large binary object
Date and time values:
ODBX_TYPE_TIME
: Time including hours, minutes and secondsODBX_TYPE_TIME_TZ
: Time with timezone informationODBX_TYPE_TIMESTAMP
: Date and timeODBX_TYPE_TIMESTAMP_TZ
: Date and time with timezone informationODBX_TYPE_DATE
: Date including year, month and dayODBX_TYPE_INTERVAL
: Date interval
Arrays and sets:
ODBX_TYPE_ARRAY
: Array of valuesODBX_TYPE_MULTISET
: Associative arrays
External links:
ODBX_TYPE_DATALINK
: URI locators like URL links
Vendor specific:
ODBX_TYPE_UNKNOWN
: Vendor specific data type without representation in SQL2003
Errors
- -ODBX_ERR_BACKEND
The native database library returned an error
- -ODBX_ERR_PARAM
Either the
result
parameter is NULL respectively is invalid or the value ofpos
is out of range
See Also
odbx_column_count(), odbx_column_name(), odbx_field_value(), odbx_result()
Referenced By
odbx_column_count(3), odbx_column_name(3), odbx_field_value(3), odbx_result(3), odbx_row_fetch(3).