Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved


Chapter 6 Invoking Stored Procedures with TIBCO Service Gateway for ODBC : Coding Event Rules

Coding Event Rules
Using the event rule feature, you can associate business rules and policies with your stored procedure mapping. Based on defined accesses, these rules are run whenever data in your SLK table is manipulated. You can code ProcEvnt event rules (Type=P) for stored procedures.
Coding Considerations
Consider the following when coding your event rules:
Some DBMSs do not notify the caller when an event activated by a row count returned (update, insert, or delete) occurs or they require special configuration for this kind of notification. If no notification is carried out by the target DBMS, these event rules are not called.
The event rules are executed as part of the transaction that spans the stored procedure execution. They cannot change the flow of control within the procedure.
For most target DBMSs, the event rule is not aware of whether the respective event was fired after the actual procedure completed or during its execution. The ODBC standard does not prohibit these events from being fired at procedure runtime so, theoretically, the parameters can contain relevant intermediate values. To provide for this case, TIBCO Service Gateway for ODBC makes available to the caller the current parameter values as set by the procedure.
Event rules fired off by a cursor returned, fetch the currently pending result set by means of a FORALL or GET statement against the TIBCO Object Service Broker mapping of this result set. If none is issued, the result set is considered discarded; if a GET is issued, a row, if any, is returned and the result set is discarded. The FORALL or GET statement must be qualified with the clause WHERE @HANDLE@ = <handle> & <actual-where>. In this clause, <handle> stands for the value of the second parameter passed to the event rule and <actual-where> stands for a WHERE clause, possibly empty (if it is empty no ampersand (&) should be specified). Alternatively, the data parameter notation can be used. Refer to Sample Event Rule.
Passed Parameters
The following parameters are passed to the stored procedure event rules:
For row-count-returned rules, if the result count (parameter 3) is zero, the number of rows affected is indeterminate; otherwise, it represents the number of rows affected.
For cursor-returned event rules, the result count (parameter 3) represents the number of columns in the result set.
The event count (parameter 4) denotes the actual sequential number of the event being processed within its group (row-count-returned or cursor-returned).

Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved