Stored Procedures, Triggers, and Transactions - Firebird

Stored Procedures

Stored procedures execute in the context of the transaction that calls them. Work done, including any tasks fulfilled in embedded and recursive calls, will only take effect if everything completes without error, with exceptions handled, and is committed. If the resolution to an exception condition in a single operation is to roll back the transaction, then all work in the transaction is rolled back.

Triggers

Triggers fire inside the context of the DML statement that prompts them. Work done, including any tasks fulfilled in embedded procedure calls, updates, inserts, or deletes to other tables or through internal referential integrity or other triggers belonging to any of the tables, will be committed in its entirety or returned to the client in an unresolved state. Unhandled exceptions in one operation will abort the operation where the error occurred and leave the transaction in a state where the application can decide to roll back or to attempt to fix the error and resubmit the request. Rollback will undo all of the operations executed in the transaction up to the point where the exception occurred.

“Savepoints” in PSQL

The introduction of user savepoints in Firebird 1.5 allows the scope of rollbacks to be controlled from the application. PSQL has always had this capability: exceptions.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Firebird Topics