Re: ESQL/C: Using $struct with null fields
Posted in 1998
Randy Galbraith wrote: > > Is there any problems with doing this? [SNIP] > > I'm very new to ESQL/C and this is the first time I've tried to using a > C structure to hold null indicators. It appears to work, but I'm > wondering if there is any caveats I should be aware of. Basically I'm > looking for someone to give my a warm fuzzy feeling about doing this :-) Just one thing though, indicator variables MUST be short integers not int. The only rub to doing it this way is you have to provide an indicator for every column even when the column is declared NOT NULL and is not a CHAR and you are not fetching it into a CHAR so it cannot become truncated. Having said that it is probably a good idea since table declarations can be ALTERed and your code would be ready to go even so. OK, OK two things... Try to use the ANSI ESQL/C syntax rather than the Informix syntax (even most Informix folk don't use their syntax any more). It is far more portable. So replace '$' with 'EXEC SQL ' for statements and surround declarations and struct/union/typedef declarations with: EXEC SQL BEGIN DECLARE SECTION; ... EXEC SQL END DECLARE SECTION; instead of preceding each with a '$'. Art S. Kagel