Friday, September 10, 2010

A conflicting scenario in header file sqltypes.h of Timesten and Informix

This article is originally posted in my csdn.net blog on 7 May 2009.


Oracle is usually used as the phisycal database when TimesTen is working as in-memory database, because the data synchronization is very easy by using cache connect in such situation. But we had to use Informix as the physical database in some projects and we encountered problems just at the compilation stage.

In our product, the database access component which was based on esql includes the header file $INFORMIXDIR/incl/esql/sqltypes.h, and the component for accessing TimesTen was ODBC-oriented and includes the header file $TIMESTEN_HOME/include/sqltypes.h.

These two files are identical in file name but not in content. What's more, there are some identical macro names which differ either in data type or value. For example, SQLCHAR is one of the macros defined as follows:

//definition in Informix

#define SQLCHAR 0

//definition in TT

typedef unsigned char UCHAR;
typedef UCHAR SQLCHAR;

These components were compiled in a big project with the above two header file directories included by -I option. So errors occurred in the compilation process.

If the directory of Informix is included prior to that of TT, errors occur when compiling the component for TT, and vice versa.

The solution is to change the directory inclusion sequence according to which component is compiling.

No comments:

Post a Comment