[comp.databases] Word on warning on SQL/C and RDB 4.0

sommar@enea.se (Erland Sommarskog) (05/14/91)

If you have an SQL/C program with something like

     char x
     ...
     EXEC SQL INSERT INTO Some_table (x) USING :x;
     /* Damn it, what was the syntax now? */

and where the column Some_table.x is declared as char every-
thing will work fine until you recompile under RDB 4.0. With
the additions of TINYINT to SQL takes char as a byte integer
and converts it to a string which it then truncates. So if the
C variable x has the value 'A', Some_table.x will get the
value '6'.

This has bitten us twice now. The workaround is simple. Change
the C declaration to x[2] and handle a thereafter.

This implcit conversion from/to strings to/from binary types
that SQL$PRE does is disgusting. I want an RDML-like preprocessor
which gives a damn in my host language code.
-- 
Erland Sommarskog - ENEA Data, Stockholm - sommar@enea.se
WORLD CHAMPIONS IN ICE HOCKEY 1991 - S W E D E N!