ArgumentException received when attempting to reuse a savepoint name

Posts   
 
    
Posts: 77
Joined: 05-May-2005
# Posted on: 28-Feb-2017 17:02:23   

I am using an Oracle database with LLBLGen v4.2 Final Feb 12th, 2015

According to the Oracle documentation: If you give two savepoints the same name, the earlier savepoint is erased

However if I attempt to reuse a savepoint name in an open transaction I receive the following error: There is already a savepoint defined with the name <_name_>.

I found the following code in the DataAccessAdapterCore.SaveTransaction method which explains where the exception comes from: if (_savePointNames.ContainsKey(savePointName)) { throw new ArgumentException("There is already a savepoint defined with the name '" + savePointName + "'", "savePointName"); }

What I don't understand is why this exists when the documentation indicates that reuse is supported. Even though I am using an older version of 4.2, I did check the latest source code and this exception would still be generated.

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 28-Feb-2017 17:49:02   

IMHO, That's a check made at the Adapter level, not the DBSpecific code, so it needs to cater for all DBs.

Is there a problem using different names for each new SavePoint?

Posts: 77
Joined: 05-May-2005
# Posted on: 28-Feb-2017 20:11:53   

I was able to override the SaveTransaction method in my adapter and use reflection to conditionally add to the _savepointNames dictionary in the Core. Problem solved, but would have preferred not to have to use reflection to do it. simple_smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39589
Joined: 17-Aug-2003
# Posted on: 01-Mar-2017 16:56:13   

Hmm. Looking into it, it appears that the SQL standard for 'SAVEPOINT' dictates that if a name is re-used the old one is no longer usable, but no error should occur. All major databases follow this rule: when the same name within the same transaction is re-used, the previous save point with the same name simply disappears, and rollbacks will be done to the new savepoint.

So the restriction is indeed useless. We'll make a change in v5.2 to lift this restriction!

Frans Bouma | Lead developer LLBLGen Pro
Posts: 77
Joined: 05-May-2005
# Posted on: 24-Mar-2017 18:11:52   

That would be awesome!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39589
Joined: 17-Aug-2003
# Posted on: 25-Mar-2017 10:20:56   

Is implemented in v5.2

Frans Bouma | Lead developer LLBLGen Pro