1

Topic: OO API FB3 Clearing of object of transaction after rollback

Whether it is necessary to cause release () after rollback ?
ITransaction has the interface IReferenceCounted , hence needs a call release () after 6 usages.
But, if to look in examples, it is possible notes the following template of usage:

ITransaction* tra = NULL;
...
tra-> commit (&status);
tra = NULL;
...
if (tra)
tra-> release ();

From what it is possible to conclude that after commit to cause release () it is not necessary.
But calls rollback in examples are not present.
Arises thinking, it is necessary what to operate but analogies with commit .
Or I am not right?

2

Re: OO API FB3 Clearing of object of transaction after rollback

Tonal;
commit and rollback reduce the counter of links, release after them it is not necessary to cause.
release it is necessary if
1. The additional reference on object has been received
2. commit\rollback it was completed with an error (for example the connection already died) and it is necessary to clear storage of the client
PS How much I remember, rollback does not give errors
PPS With cursors, requests,  - all as

3

Re: OO API FB3 Clearing of object of transaction after rollback

Tonal wrote:

tra-> commit (&status);
hvlad wrote:

release it is necessary if.... commit\rollback it was completed with an error

It is not necessary to check result of function, there the C ++ exception will be thrown mandatory?

4

Re: OO API FB3 Clearing of object of transaction after rollback

Arioch wrote:

it is not necessary to check Result of function, there the C ++ exception will be thrown mandatory?

There void in the signature - so only an exception.

5

Re: OO API FB3 Clearing of object of transaction after rollback

Arioch wrote:

it is passed...
it is passed...
It is not necessary to check result of function, there the C ++ exception will be thrown mandatory?

Depends on real type status.
On-default there Firebird:: CheckStatusWrapper which does not throw an exception, i.e. it is necessary to check itself status:

if (status-> getState () AND Firebird:: IStatus:: STATE_ERRORS)

6

Re: OO API FB3 Clearing of object of transaction after rollback

hvlad wrote:

on-default there Firebird:: CheckStatusWrapper

I Will specify - there is a choice between ThrowStatusWrapper and CheckStatusWrapper, the first checks the status and throws an exception, the second does not do it.

7

Re: OO API FB3 Clearing of object of transaction after rollback

hvlad;
In examples it is used just ThrowStatusWrapper .
So we will know about choice possibility. smile