Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Sqlite commit fails - "cannot commit - no transaction is active Unable to commit transaction"
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 3.0k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Abin
    wrote on 9 Apr 2015, 07:44 last edited by
    #1

    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...

    C 1 Reply Last reply 9 Apr 2015, 08:53
    0
    • A Abin
      9 Apr 2015, 07:44

      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...

      C Offline
      C Offline
      clochydd
      wrote on 9 Apr 2015, 08:53 last edited by
      #2

      @Abin

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

      1 Reply Last reply
      0

      1/2

      9 Apr 2015, 07:44

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved