Menu

#17 StatementImpl::StatementImpl is not exception safe

open
None
2
2012-10-17
2006-10-19
Ilya_M
No

.....
AttachDatabaseImpl(database);
if (transaction != 0) AttachTransactionImpl
(transaction);
if (! sql.empty()) Prepare(sql);
.....

If Prepare throws, the database and transaction are
not detached. Proposing:

.....
AttachDatabaseImpl(database);
if (transaction != 0) AttachTransactionImpl
(transaction);
try
{
if (! sql.empty()) Prepare(sql);
} catch(...) {
DetachTransactionImpl();
DetachDatabaseImpl();
throw;
}
.....

Discussion

  • Olivier Mascia

    Olivier Mascia - 2006-11-07

    Logged In: YES
    user_id=12177

    This will be reviewed later. Are there real world known deficiencies if the internal link between the database object and the statement object and the transaction object are
    not detached? I don't think so, but will review this more carefully later.

     
  • Olivier Mascia

    Olivier Mascia - 2006-11-07

    Logged In: YES
    user_id=12177

    Just changed the title of the report. It is a matter of exception safety / exception correct behaviour. Nothing related to threads.

     

Log in to post a comment.