Subject Re: [firebird-support] waiting for eventholds OIT
Author Martijn Tonies
Hi Nick,

> I got too enthusistic in my snipping, it should be as below.
>
> Are you saying that I just need to add a commit just before the EVENT
> WAIT below so that there isn't an open transaction when the program is
> waiting for the event?

I guess so, yes. What's the point of keeping the transaction open?

> EXEC SQL CONNECT :db_filename USER :db_username PASSWORD
:db_password;
>
> /* Go with read committed to see updates */
> EXEC SQL SET TRANSACTION READ COMMITTED;
>
> EXEC SQL SELECT basecontrolident INTO :basecontrolident FROM
> TBLBASECONTROLLER; /* for filename */

I don't see you using the value in "basecontrolident" below.

> EXEC SQL EVENT INIT ALERT_WAIT ('amsalert');
>
> while (0 == 0) /* until killed */
> {
> rowcount = 0;
> EXEC SQL SELECT COUNT (*) INTO :rowcount FROM TBLALERT;
> if (rowcount == 0)
> {
> LOG("DS", LGREF "23","","waiting for alert");
> EXEC SQL EVENT WAIT ALERT_WAIT;
> if (SQLCODE != 0)
> {
> isc_print_sqlerror((short)SQLCODE,
gds__status);
> goto fatal_error;
> }
> LOG("DS", LGREF "24","","received alert");
> }
> handle event
> commit
> end while

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com