Type Mapping
When ecpg applications exchange values between the GaussDB Kernel server and the C program, such as when retrieving query results from the server or executing SQL statements with input parameters, the values need to be converted between GaussDB Kernel data types and host language variable types (C language data types, concretely). There are two data types available: Simple GaussDB Kernel data types, such as integer and text, can be directly read and written by applications. Other GaussDB Kernel data types, such as timestamp and numeric, can be accessed only by using special library functions. For details, see ECPG API Reference.
GaussDB Kernel Data Type |
Host Variable Type |
---|---|
smallint |
short |
integer |
int |
bigint |
long long int |
boolean |
boolean |
character(n), varchar(n), text |
char[n+1], VARCHAR[n+1] |
double precision |
double |
real |
float |
smallserial |
short |
serial |
int |
bigserial |
long long int |
oid |
unsigned int |
name |
char[NAMEDATALEN] |
date |
date [a] |
timestamp |
timestamp [a] |
interval |
interval [a] |
decimal |
decimal [a] |
numeric |
numeric [a] |
[a] This type can be accessed through Accessing Special Data Types.
- Currently, only basic data types of the C language can be used or combined. The string data type in the C++ language cannot be used as the host variable type.
- Currently, ecpg maps only common data types of GaussDB Kernel SQL. For details about the supported data types, see Table 1.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot