Re: E/SQL host arrays with defined sizes
Posted in 1998
Tim Friest wrote: > jcnsoft@my-dejanews.com wrote: > > In article <36140893.9B804D99@saic.alaska.net>, > > Tim Friest <friest@saic.alaska.net> wrote: > > > I would like to use defines for the sizes of some of the arrays in my > > > E/SQL C code... > > > i.e. > > > #define COLUMN_WIDTH 18 > > I think this will work > > EXEC SQL define COLUMN_WIDTH 18; > > > EXEC SQL BEGIN DECLARE; > > > char column[COLUMN_WIDTH+1]; > > > EXEC SQL END DECLARE; > That sounds like what I'm looking for... However, I have the define in a > header and it is used > by other files besides the E/SQL-C stuff.... [SNIP] > or can someone think of a better way? Yes. Put the declarations in a separate include which is then included in both a C specific and an ESQL specific include file where the DEFINES are. Vis: ---------------------------lvl2.h------------------------------------- # File lvl2.h char column[COLUMN_WIDTH+1]; ---------------------------c_lvl1.h----------------------------------- # File c_lvl1.h #define COLUMN_WIDTH 18 #include lvl2_h ---------------------------e_lvl1.h----------------------------------- # File e_lvl1.h EXEC SQL DEFINE COLUMN_WIDTH 18; EXEC SQL BEGIN DECLARE SECTION; EXEC SQL INCLUDE lvl2.h; EXEC SQL END DECLARE SECTION; Art S. Kagel