Home » Developing U++ » UppHub » Firebird
Re: Firebird [message #33038 is a reply to message #33010] |
Mon, 04 July 2011 06:50   |
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
|
|
|
 |
|
Firebird
By: Novo on Thu, 30 June 2011 06:16
|
 |
|
Re: Firebird
By: mirek on Thu, 30 June 2011 08:20
|
 |
|
Re: Firebird
By: unodgs on Thu, 30 June 2011 08:44
|
 |
|
Re: Firebird
By: Novo on Mon, 04 July 2011 06:50
|
 |
|
Re: Firebird
By: Novo on Sat, 09 July 2011 06:49
|
 |
|
Re: Firebird
By: Novo on Sat, 23 July 2011 06:22
|
 |
|
Re: Firebird
By: Novo on Mon, 04 July 2011 06:44
|
 |
|
Re: Firebird
By: Novo on Tue, 05 July 2011 06:15
|
 |
|
Re: Firebird
By: Novo on Wed, 06 July 2011 06:07
|
 |
|
Re: Firebird
By: Novo on Thu, 07 July 2011 06:40
|
 |
|
Re: Firebird
By: Novo on Sun, 31 July 2011 19:02
|
 |
|
Re: Firebird
By: Novo on Tue, 30 August 2011 05:40
|
Goto Forum:
Current Time: Mon Jul 07 13:43:10 CEST 2025
Total time taken to generate the page: 0.03341 seconds
|