Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » UppHub » Firebird
Re: Firebird [message #33038 is a reply to message #33010] Mon, 04 July 2011 06:50 Go to previous messageGo to previous message
Novo is currently offline  Novo
Messages: 1430
Registered: December 2006
Ultimate Contributor
unodgs wrote on Thu, 30 June 2011 02:44

TRANSACTION macro looks good. I like it. The only problem is how to add custom code to handle rollback situation? And does your macro breaks immediately after first error or run queries to the last and then do rollback? Normally I use try/catch scenario.
Sql q;
try {
   q.Begin()
   ...
   q.Commit()
}
catch(SqlExc e)
{
   q.Rollback();
   ...
}




Well, there is no way to add custom rollback code using this macro. But because this macro is very simple, you can implement a similar one using the same pattern. You can take a look at implementation of TRANSACTION_RETAIN in implementation of firebird driver.

B.t.w., your code will look like below.
Sql q;

TRANSACTION(q) {
    ...
}


You still need to catch exception ...
But what will happen with your code if exception is not of type SqlExc? TRANSACTION will take care of this.


Regards,
Novo
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: MediaPlayer crash under UBUNTU 11.04
Next Topic: Getting compile on Docking in bazaar
Goto Forum:
  


Current Time: Mon Jul 07 13:43:10 CEST 2025

Total time taken to generate the page: 0.03341 seconds