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
performing
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 ?

Row.

> 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
play.

> 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 ?
>

no.


Martijn Tonies
Database Workbench - development tool for Firebird and more!
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com