odbx_column_type man page

odbx_column_type — Returns the SQL data type of a column in the current result set

Synopsis

#include <opendbx/api.h>

intodbx_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 values
·
ODBX_TYPE_SMALLINT: Signed 16 bit integer
·
ODBX_TYPE_INTEGER: Signed 32 bit integer
·
ODBX_TYPE_BIGINT: Signed 64 bit integer
·
ODBX_TYPE_DECIMAL: Exact signed numeric values with user defined precision

Approximate numeric values:

·
ODBX_TYPE_REAL: Approximate numeric values (signed) with 32 bit precision
·
ODBX_TYPE_DOUBLE: Approximate numeric values (signed) with 64 bit precision
·
ODBX_TYPE_FLOAT: Approximate numeric values (signed) with user defined precision

String values:

·
ODBX_TYPE_CHAR: Fixed number of characters
·
ODBX_TYPE_NCHAR: Fixed number of characters using a national character set
·
ODBX_TYPE_VARCHAR: Variable number of characters
·
ODBX_TYPE_NVARCHAR: Variable number of characters using a national character set

Large objects:

·
ODBX_TYPE_CLOB: Large text object
·
ODBX_TYPE_NCLOB: Large text object using a national character set
·
ODBX_TYPE_XML: XML tree in text format
·
ODBX_TYPE_BLOB: Large binary object

Date and time values:

·
ODBX_TYPE_TIME: Time including hours, minutes and seconds
·
ODBX_TYPE_TIME_TZ: Time with timezone information
·
ODBX_TYPE_TIMESTAMP: Date and time
·
ODBX_TYPE_TIMESTAMP_TZ: Date and time with timezone information
·
ODBX_TYPE_DATE: Date including year, month and day
·
ODBX_TYPE_INTERVAL: Date interval

Arrays and sets:

·
ODBX_TYPE_ARRAY: Array of values
·
ODBX_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 of pos is out of range

See Also

odbx_column_count(), odbx_column_name(), odbx_field_value(), odbx_result()

Info

4 February 2016 OpenDBX