Supported C data types v16
An ECPGPlus application must deal with two sets of data types: SQL data types (such as
DOUBLE PRECISION, and
CHARACTER VARYING) and C data types (like
varchar[n]). When an application fetches data from the server, ECPGPlus maps each SQL data type to the type of the C variable into which the data is returned.
In general, ECPGPlus can convert most SQL server types into similar C types, but not all combinations are valid. For example, ECPGPlus tries to convert a SQL character value into a C integer value, but the conversion might fail at execution time if the SQL character value contains non-numeric characters.
The reverse is also true. When an application sends a value to the server, ECPGPlus tries to convert the C data type into the required SQL type. Again, the conversion might fail at execution time if the C value can't be converted into the required SQL type.
ECPGPlus can convert any SQL type into C character values (
varchar[n]). Although it's safe to convert any SQL type to or from
varchar[n], it's often convenient to use more natural C types such as
The supported C data types are:
long long int
- Any equivalent created by a
In addition to the numeric and character types supported by C, the
pgtypeslib runtime library offers custom data types, as well as functions to operate on those types, for dealing with date/time and exact numeric values:
To use a data type supplied by
pgtypeslib, you must
#include the proper header file.