Bugs item #3307531, was opened at 2011-05-25 14:35
Message generated for change (Tracker Item Submitted) made by nobody
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=462816&aid=3307531&group_id=51305

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: wxSQLite3Transaction doesn't report error if Commit failed

Initial Comment:
First I would like to congratulate for your great job with wxSQLite3.

I'm starting using it and with exception  and wxWidgets supports, SQLite3 is 
really simple to use.
I'm lookinbg for transaction and I found your wxSQLite3Transaction that make 
the job even an exception is raised, my function use it like :

bool CMyDatabase::ExecuteUpdateWithTransaction(wxString _strSQL) 
throw(wxSQLite3Exception)
{
    bool bRet = false;

    if (IsOpened())
    {
        wxSQLite3Transaction transaction(m_pDatabase);
        m_pDatabase->ExecuteUpdate(_strSQL);
        transaction.Commit();
        bRet = true;
    }

    return bRet;
}

But I have a question : why Commit function doesn't return a boolean or throw 
another exception ? Because if the commit failed no error and the transaction 
is roolback and the programmer think it is good.

Why don't do ?

void wxSQLite3Transaction::Commit()
{
  try
  {
    m_database->Commit();
  }
  catch (wxSQLite3Exception &_rException)
  { // Propagate exception, destructor will make rollback
    throw;
  }
  catch (...)
  { // Throw unknown exception (strange to catch ...), destructor will make 
rollback
    throw wxSQLite3Exception(-1, wxT("Unknown error while execute commit"));
  }
  m_database = NULL;
}

What do you think about this evolution ?
Best regards,
Stphane Chteau / Feneck91 (French). 

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=462816&aid=3307531&group_id=51305

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
wxCode-users mailing list
wxCode-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxcode-users

Reply via email to