Results 1 to 3 of 3

Thread: MYSQL transaction gets automited

  1. #1
    Join Date
    Jul 2008
    Location
    EU , Poland, Zabrze
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default MYSQL transaction gets automited

    Hi,
    I'm using mariaDB, and wanted to experiment with rollback

    I have started db.transaction() -> returns true;

    Then I declared a query and issues a query.prepare that should INSERT certain values to a table

    I never called db.commit (removed all references to db.commit() from the code) but still the values from INSERT query get inserted when I execute query.exec()

    and ideas?

    adding db.rollback(); makes no change

  2. #2
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: MYSQL transaction gets automited

    Read the section regarding autocommit: https://mariadb.com/kb/en/mariadb/start-transaction/
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

  3. #3
    Join Date
    Jul 2008
    Location
    EU , Poland, Zabrze
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: MYSQL transaction gets automited

    solved

    the table has to be InnoDB - transactions wont run with MyISAM

Similar Threads

  1. QT 5.1 Mysql Transaction
    By Anenja in forum Qt Programming
    Replies: 4
    Last Post: 10th October 2013, 08:07
  2. QIBASE and problem with transaction
    By Hostel in forum Qt Programming
    Replies: 0
    Last Post: 21st May 2013, 12:01
  3. Postgresql transaction
    By matteo.ceruti in forum Qt Programming
    Replies: 2
    Last Post: 13th May 2012, 17:24
  4. Replies: 1
    Last Post: 11th March 2010, 17:42
  5. QDatabase::transaction()
    By sunil.thaha in forum Qt Programming
    Replies: 2
    Last Post: 3rd February 2006, 13:15

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.