Hi everybody,

i am busy in writing an application for Informix using multiple database connections with concurrent transactions and optimized message transfer (OPTMSG) feature of ESQL/C library.

Currently no flush of chained statements will be done in case a new connection will be started or a switch to another connection will be done.
In my opinion it is okay that ESQL/C don't do a automatic flush because we are using concurrent transactions. However i need to flush all chained statements before a new connection will be set and
i would like to continue to use of OPTMSG feature for performance reasons.

Here is an simplified ESQL/C program to explain my problem

main()
{
EXEC SQL BEGIN DECLARE SECTION;
char dbname[] = "db";
char userid[] = "informix";
char passwd[] = "informix";
char query[512];
char sqlcmd[512];
EXEC SQL END DECLARE SECTION;

EXEC SQL WHENEVER ERROR STOP;

ifx_putenv( "OPTMSG=1" );

EXEC SQL connect to :dbname AS 'con1' USER :userid USING asswd with concurrent transaction;
EXEC SQL BEGIN WORK;
sprintf(query,"SELECT * FROM t1");
EXEC SQL PREPARE s_1 FROM :query;
EXEC SQL DECLARE c_1 CURSOR FOR s_1;
EXEC SQL OPEN c_1;

OptMsg = 1;
EXEC SQL CLOSE c_1;
OptMsg = 0; // close statement will be chained

EXEC SQL connect to :dbname AS 'con2' USER :userid USING asswd with concurrent transaction;
EXEC SQL BEGIN WORK;
sprintf(sqlcmd,"drop table t1");
EXEC SQL EXECUTE IMMEDIATE :sqlcmd; // error -214 appears because the close to to cursor c_1 is not flushed yet
EXEC SQL COMMIT WORK;
}

I have two questions :

1.) is it possible to get informations about if something is currently chained for a connection ?
2.) in case something is chained i would like to force a flush. How to do ?

Maybe somebody can help me in this issue.

Regards ...