Cron triggers

We have here the preview version of cron-like triggers.

Usage:

1. Add the following to databases.conf.

 cron = /your/path/to.fdb
 {
     Cron = yes
 }

2. Create database and trigger.

 CREATE DATABASE 'cron';
 create table l (m timestamp);
 set term ^;
 create trigger logSrvActive at '* * * 6 *' as begin insert into l 
 values(current_timestamp); end^

You see - we want that trigger to run every minute in June.

3. Keep server running for a few minutes.

4. Watch activity log table.

 select * from l;

                M
 =========================
 2018-06-06 19:45:00.7920
 2018-06-06 19:46:00.9480
 2018-06-06 19:47:01.1200
 2018-06-06 19:48:01.2800

This is preview version - just to take a look at syntax and may be find some bugs. The following changes are known to be needed: - make sure gbak works with such triggers - fix isql SHOW command - and the most important - run triggers in correct thread, currently is used timer thread but that's wrong if triggers are getting bigger.

Performance is not tuned at all, and triggers may get late running a few seconds, etc.

back to top of page
<< | Firebird Special Edition by IBExpert | >>