473,385 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Trigger on Transaction and Lock !!!!

60
Hi All,

I have a post insert trigger for Table ‘A’ that will insert data into Table ‘B’. My question is once the data being inserted into Table ‘A’ through a transaction from Business layer, Whether the after trigger will get executed once the transaction gets committed or the trigger will get executed once the data get inserted into table ‘A’ (Before the transaction gets committed)? If it is the later case then, what happens if the transaction failed [Rollback]?


If subsequent DML operations are being executed on Table ‘A’ through a transaction from Business layer, E.g. , Update some rows and Insert some new data, are there any chances of dead lock that could happen on Table ‘A’?

Thanks,
Lauren
Nov 10 '09 #1
1 5730
wizardry
201 100+
we need more info.

what type of trigger? before / after ?
if before then the data is captured before its commited.
if after then its after before trigger runs and is commited.

about locks. locks are turned on a per table basis and should be used only with indepth knowledge of use of locks. it can slow down your site. locks are already taken on the database server level for each new client session on the given call or procedure from the form elements.

http://dev.mysql.com/doc/refman/5.0/...l-locking.html

http://dev.mysql.com/doc/refman/5.0/en/lock-tables.html

http://dev.mysql.com/doc/refman/5.0/...e-locking.html

hope this helps
Nov 11 '09 #2

Sign in to post your reply or Sign up for a free account.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.