Re: Informix Host variables
Posted in 1992
Path: emory!swrinde!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!spool.mu.edu!munnari.oz.au!uunet!halexii!halexv!greg From: greg@halexv.uucp (Gregory F. Hogg) Newsgroups: comp.databases.informix Message-ID: <1992Jan24.135551.987@halexv.uucp> Date: 24 Jan 92 13:55:51 GMT References: <1992Jan23.184337.81505@evolving.com> Reply-To: greg@halexv.UUCP (Gregory F. Hogg) Organization: HOGG'S SOFTWARE; Abingdon, MD In article <1992Jan23.184337.81505@evolving.com> gst@evolving.com writes: > > Guys: > > One of the fields in a table I have is a 1 char field and use > ESQL/C. When I insert a row into this table I use a host > variable which is "$char xyz" which works just fine. But when > I select it back from the table I cannot use "char xyz" but need > to use "$char xyz[2]" to accomadate for the NULL byte. > > - For a 1 char field do I need to declare the host variable > always as "$char xyz[2]"? > > When I use Informix 4gl "DEFINE xyz LIKE table.field", it declares > the variable as "char xyz[2]" in the C code. Sounds to me like ESQL treats chars as strings, i.e. space for the NULL is required. So a 1 char field is really a 1 char string and must be defined to be char xyz[2] to include space for the NULL +++++++++++++++++ +++++++++++++++++++ Greg Hogg +++ +++ ++ ++ HOGG'S SOFTWARE +++ +++ +++++++++++++++++++ +++++++++++++++++ voice : 410-538-7241 ++++ ++++ ++++ ++++ fax : 410-538-6130 ++++ +++++ +++++ ++++ uucp : uunet!halexii!greg ++++ ++++++ ++++++ ++++ cis : 74176,1320 -- +++++++++++++++++ +++++++++++++++++++ Greg Hogg +++ +++