Host structures in C and C++
A C host structure contains an ordered group of data fields.
Host structures
The following diagram shows the syntax for declaring host structures.
VARCHAR structures
The following diagram shows the syntax for VARCHAR structures that are used within declarations of host structures.
VARGRAPHIC structures
The following diagram shows the syntax for VARGRAPHIC structures that are used within declarations of host structures.
Binary structures
The following diagram shows the syntax for binary structures that are used within declarations of host structures.
LOB data types
The following diagram shows the syntax for LOB data types that are used within declarations of host structures.
LOB data types for XML data
The following diagram shows the syntax for LOB data types that are used within declarations of host structures for XML data.
Example
In the following example, the host structure is named target, and it contains the fields c1, c2, and c3. c1 and c3 are character arrays, and c2 is a host variable that is equivalent to the SQL VARCHAR data type. The target host structure can be part of another host structure but must be the deepest level of the nested structure.struct {char c1[3];
struct {short len;
char data[5];
}c2;
char c3[2];
}target;