Results 1 to 3 of 3

Thread: QDatabase::transaction()

  1. #1
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default QDatabase::transaction()

    How do we know that the trasaction function is called ?
    And is there any side effects if It's called more than once as shown below
    Qt Code:
    1. QSqlDatabase* db = QSqlDatabase::database();
    2. db->transaction();
    3. // ......
    4. // ......
    5. db->transaction();
    6. // ......
    7. // ......
    8. db->rollback();
    To copy to clipboard, switch view to plain text mode 
    We can't solve problems by using the same kind of thinking we used when we created them

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    99
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QDatabase::transaction()

    Hello ,

    How do we know that the trasaction function is called ?
    You could use something like this :
    Qt Code:
    1. bool transactionIsActive;
    2. transactionIsActive =db->transaction();
    3.  
    4. if transactionIsActive {
    5. ...
    6. }
    To copy to clipboard, switch view to plain text mode 

    And is there any side effects if It's called more than once as shown below
    IMO it will rollback to the first transaction. As if the second will be ignored.
    You could test this in your code.

    Cheers

  3. #3
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QDatabase::transaction()

    Quote Originally Posted by Everall
    IMO it will rollback to the first transaction. As if the second will be ignored.
    You could test this in your code.
    Yes it's ignoring all calls to transaction() untill a commit()/ rollback is called.

    Thanks
    We can't solve problems by using the same kind of thinking we used when we created them

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.