Triggers capabilities to abort transactions

Use this forum to request new features or suggest modifications to existing features

Triggers capabilities to abort transactions

Postby perencia » Sun Sep 01, 2013 11:23 am

Hi,

as i saw in the source code, there's no possibility for a trigger to rollback and abort the transaction, am i correct ?

I wouldn't mind to implement that and submit a patch but I suppose that is a feature that requires some thought... are there any plans to support it ?

By the way, great work :)
perencia
 
Posts: 1
Joined: Sun Sep 01, 2013 11:15 am

Re: Triggers capabilities to abort transactions

Postby qxorm » Mon Sep 02, 2013 7:50 am

Hi,

In a trigger, you have the parameter : qx::dao::detail::IxDao_Helper * dao.
This parameter is useful for 2 things :
1- get the current connection (if you want to commit/rollback this is important) : dao->database() ;
2- and if an error occured in the trigger, you can write : dao->updateError(myError) (and this error will be returned to the caller).

Then, when you want to use transactions (commit/rollback), there is the class qx::QxSession :
- more details about this class in the FAQ here : http://www.qxorm.com/qxorm_en/faq.html#faq_170 ;
- and the class documentation : http://www.qxorm.com/doxygen/html/class ... ssion.html

Another possibility could be to throw an exception in your trigger using the class : qx::dao::sql_error.
qxorm
Site Admin
 
Posts: 481
Joined: Mon Apr 12, 2010 7:45 am


Return to QxOrm - Feature request

Who is online

Users browsing this forum: No registered users and 2 guests

cron