Re: How to get and set "\\0 3 \\0 3 \\0 3" from a char(6) field using esql-C?
Posted in 1994
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
In article <Cz0DuC.CxE@Newbridge.COM> psingh@Newbridge.COM (Pawan Singh) writes: >I have a char(6) field into which I want to write 6 bytes >irrespective of the values for each byte. The problem is >that if the first byte is zero, informix assigns a null >value to the field and sets the null indicator variable. >For example: I would like to write: > >char(1) = 0x00 >char(2) = 0xff >char(3) = 0x00 >char(4) = 0xff >char(5) = 0x00 >char(6) = 0xff > >to the field and retrieve it using esql-C. Informix server >sees that first character is 0x00 and therefore sets the field >to null. Even using FIXCHAR does not solve the problem. > Write a set of wrapper functions to perform all "gets" and "sets" to this table. The "set" functions would prepend some fixed character to the beginning of every field. The "get" functions would strip the first character from every field. Of course this means you have to increase the size of the field by 1. If the prepended character was 'a', the above would then look like: char(1) = 'a' char(2) = 0x00 char(3) = 0xff char(4) = 0x00 char(5) = 0xff char(6) = 0x00 char(7) = 0xff ------------------------------------------------------------------- Frank Weil weil@ttd.teradyne.com -------------------------------------------------------------------