[comp.databases] ESQL/C preprocessor bugs/suggestions

fst@mcgp1.UUCP (Skip Tavakkolian) (04/26/88)

I recently found two ``bugs'' with esqlc preprocessor which took a little
time to figure out.

1) The first bug has to do with the esqlc preprocessor changing the
host variables to all lower case. For example:

        $char FooBar[512];

        $select foo_bar from boobaz into $FooBar ;
        if (FooBar[0] == 'x')	do_somthing();  /* c compiler complains about
                                                   FooBar not being defined */

The esqlc preprocessor changes the ``FooBar'' to ``foobar''. Also another
point in the above example is that, you can't use somthing like BUFSIZ instead
of hard coded ``512'' for the size of the array for the same reason (i.e
``bufsiz'' is not ``BUFSIZ'').

2) It seems to me that it would be a required ``feature'' for the preprocessor
to compare the number of data elements in a select statement against the
number of host variables for equality. This is very usefull in long
select statements where the programmer sooner or later will make a mistake.

(NOTE: The Informix-SQL and ESQL/C are release 2.10.00C. Same results were
produced on 3B1 and 3B2 machines.)

Thanks in advance.

Skip Tavakkolian

UUCP	...!uw-beaver!tikal!cti3b1!fst

friedl@vsi.UUCP (Stephen J. Friedl) (04/26/88)

In article <1333@mcgp1.UUCP>, fst@mcgp1.UUCP (Skip Tavakkolian) writes:
> 1) The first bug has to do with the esqlc preprocessor changing the
> host variables to all lower case. For example:
> 
>         $char FooBar[512];
> 
>         $select foo_bar from boobaz into $FooBar ;
>         if (FooBar[0] == 'x')	do_somthing();  /* c compiler complains about
>                                                    FooBar not being defined */
> 
> The esqlc preprocessor changes the ``FooBar'' to ``foobar''. Also another
> point in the above example is that, you can't use somthing like BUFSIZ instead
> of hard coded ``512'' for the size of the array for the same reason (i.e
> ``bufsiz'' is not ``BUFSIZ'').

The preprocessor appears to take neither `BUFSIZ' nor `bufsiz';
array dimensions must be numeric.  This is presumably because
esqlc doesn't process #include and #define directives, so it has
no way of knowing the length without a simple digit string.  This
is a bummer because it requires magic all throughout the code :-(.

As an aside, it's helpful to declare string host variables as:

                $string foobar[512];
rather than
                $char   foobar[512];

The former asks SQL to strip trailing blanks from the fetched
column and insure that a NUL appears at the end.  This is really
handy; we almost never need to use $char host variables.

Does anybody at Informix Corp. read this newsgroup and accept
suggestions and bug reports via email?

-- 
Steve Friedl       V-Systems, Inc.                     3B2 Wizard
friedl@vsi.com   {backbones}!vsi.com!friedl    attmail!vsi!friedl