Two questions about triggers

Forum for posting problems using QxOrm library

Two questions about triggers

Postby remico » Tue Feb 26, 2013 9:26 am

Hello.
1) Is it possible to get the OLD value and the NEW value simultaneously into "update" triggers (like into natural triggers of any DBMS)?
And if no way to do this, how to make the right something like a "cascading update of a non-foreign-key field into a table according to an updated field into another table"?
2) Is it correct to open and use transactions into triggers or it is more correct to open transactions before invoking qx::dao::* functions?
Thanks in advance.
remico
 
Posts: 13
Joined: Tue Jul 24, 2012 6:30 pm
Location: Ukraine

Re: Two questions about triggers

Postby qxorm » Tue Feb 26, 2013 3:18 pm

Hi,

1) Is it possible to get the OLD value and the NEW value simultaneously into "update" triggers (like into natural triggers of any DBMS)?
And if no way to do this, how to make the right something like a "cascading update of a non-foreign-key field into a table according to an updated field into another table"?

Yes you can have old and new values using qx::dao::ptr<T> smart pointer.
Here is a FAQ about qx::dao::ptr<T> smart pointer : http://www.qxorm.com/qxorm_en/faq.html#faq_81
And here is the documentation : http://www.qxorm.com/doxygen/html/class ... _1ptr.html

2) Is it correct to open and use transactions into triggers or it is more correct to open transactions before invoking qx::dao::* functions?

I think you should always open a transaction before using qx::dao::* functions.
For transactions, you can also use session concept : http://www.qxorm.com/qxorm_en/faq.html#faq_170
qxorm
Site Admin
 
Posts: 481
Joined: Mon Apr 12, 2010 7:45 am


Return to QxOrm - Help

Who is online

Users browsing this forum: No registered users and 7 guests

cron