Sqlite commit fails - "cannot commit - no transaction is active Unable to commit transaction"



  • I am doing sql transaction in qt.

    bool X::save()
    {
      mDatabase.transaction();
    
      if (!saveHeader())
      {
           mDatabase.rollback();
           return false;
      }
      
      if (!saveBody())
      {
           mDatabase.rollback();
           return false;
      }
    
      mDatabase.commit();     
      return true;
    }
    

    My commit returns fails an returns "cannot commit - no transaction is active Unable to commit transaction"

    I have SELECT and DELETE query in the functions. But I do query.clear(); after execution.

    Still I get this error. Someone knows why...



  • @Abin

    Hi, IMO you should not use query.clear(). Did you try to run without this?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.