Fetch VARCHAR data

The following table shows the conversion of VARCHAR data when an application fetches it into host variables of char, fixchar, lvarchar, and string character data types.
Table 1. Converting the VARCHAR data type to ESQL/C character data types
Source type Destination type Result
VARCHAR char If the source is longer, truncate and null terminate the value, and set any indicator variable. If the destination is longer, pad the value with trailing spaces and null terminate it.
VARCHAR fixchar If the source is longer, truncate the value and set any indicator variable. If the destination is longer, pad the value with trailing spaces.
VARCHAR string If the source is longer, truncate and null terminate the value, and set any indicator variable. If the destination is longer, null terminate the value.
VARCHAR lvarchar If the source is longer, truncate and set any indicator variable. If the destination is longer, null terminate it.
The following table shows examples of conversions from VARCHAR column data to character host variables that Informix® ESQL/C might perform during a fetch. In this figure, a plus (+) symbol represents a space character and the value in the Length column includes any null terminators.
Table 2. Examples of VARCHAR conversion during a fetch
Source type Contents Length Destination type Contents Indicator
VARCHAR(9) Fairfield 9 char(5) Fair\0 9
VARCHAR(9) Fairfield 9 char(12) Fairfield++\0 0
VARCHAR(12) Fairfield+++ 12 char(10) Fairfield\0 12
VARCHAR(10) Fairfield+ 10 char(4) Fai\0 10
VARCHAR(11) Fairfield++ 11 char(14) Fairfield++++\0 0
VARCHAR(9) Fairfield 9 fixchar(5) Fairf 9
VARCHAR(9) Fairfield 9 fixchar(10) Fairfield+ 0
VARCHAR(10) Fairfield+ 10 fixchar(9) Fairfield 10
VARCHAR(10) Fairfield+ 10 fixchar(6) Fairfi 10
VARCHAR(10) Fairfield+ 10 fixchar(11) Fairfield++ 0
VARCHAR(9) Fairfield 9 string(4) Fai\0 9
VARCHAR(9) Fairfield 9 string(12) Fairfield\0 0
VARCHAR(12) Fairfield+++ 12 string(10) Fairfield\0 12
VARCHAR(11) Fairfield++ 11 string(6) Fairf\0 11
VARCHAR(10) Fairfield++ 10 string(11) Fairfield\0 0
VARCHAR(10) Fairfield+ 10 lvarchar(11) Fairfield+ 0
VARCHAR(9) Fairfield 9 lvarchar(5) Fair\0 9