Architecture of RuleGen

Here is a bird eye's overview of the code generated by RuleGen to enforce data quality.

It all starts with a transaction: that's to say, with an insert, an update or a delete statement. When such a statement modifiies a table's contents, a row trigger records exactly what has been changed. This is called the transition effect (TE) of that statement: a dml-statement causes a table to transition from one state to another state. The TE describes exactly which rows were inserted, updated or deleted.

The row-trigger maintaining the TE does this in a global temporary table (GTT). On top of this GTT, three views are defined: inserted_rows, updated_rows, and deleted_rows. When specifying a rule you write queries against these three views to tell rulegen when the rule should be validated. The goal of these queries is to detect whether the dml-statement is such that the rule could potentially be violated. We call these the insert TE-query (ITE), the update TE-query (UTE), and the delete TE-query (DTE). These queries, and code surrounding them, are generated into a package for the rule at hand.

This package is invoked by the after statement trigger that RuleGen generates. The package code will execute the TE-query and when rows are retrieved from it, will continue to actually validate the rule. Rule validation is done by executing yet another query that was provided by you when specifying the rule in RuleGen: this query specifies exactly how the rule is to be validated.

When this rule validation fails, the package generated by RuleGen will raise an application error, which then causes the dml statement to be rolled back.

Resources

News & Events

Check out our new blog on triggers here.

Or follow us:

RuleGen 3.0 released

With the open architecture of release 3.0, RuleGen has set the path for the future. Improved code generation, transparent code deployment, and separation of design and runtime, are some of the key highlights of this new release.

Available now: AM4DP

Click to see book on Amazon

A great textbook about data integrity constraints in relational databases. This book describes the key concepts on which RuleGen is based. Click image to see reviews at Amazon, or here for quotes found on internet.