Subject Re: [firebird-support] Triggers/Stored procs and Locks
Author Martijn Tonies
Hello Johannes,

> I have 2 topics with questions
> ---------------------------
> A) Does triggers on the database only get triggers when the transaction is
commited ? Or can I assume that it
> gets run inside of the transaction also.

Triggers run in the transaction as well, at the exact moment you're
the table DML operation, the trigger get's "triggered".

> If this is the case and if I call stored procedures inside those triggers
> to perform certain function that will define the next step in logic in
my program code. Does these stored procedures
> that is called via the databases before of after insert or update also
exist inside my transaction ?

See above. Everything is inside your transaction.

> B) Locking of records. As previously explained with transaction and data
stored on pages and then commited to database if all is fine etc.
> i) When a record is locked thanks to my transaction. Is it a row
level (record) or page level (all active ones on the cache page) lock ?


> ii) What will lock the record ? only updates , inserts and deletes or
does normal selects also lock records ?

Selects don't lock normally. This is where "multi versioning" comes into

> iii) If I only start a transaction and then commit it immediately
afterwards with absolutely nothing between it. Does a database lock appear
at all ?


Martijn Tonies
Database Workbench - development tool for Firebird and more!
Upscene Productions
My thoughts:
Database development questions? Check the forum!