Results 1 to 3 of 3

Thread: Postgresql transaction

  1. #1
    Join Date
    Dec 2011
    Posts
    19
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Postgresql transaction

    I use dbms postgresql. I start a transaction

    ...
    (!sqlQuery.exec("BEGIN;SELECT * FROM machineheadtable WHERE (machinetable_sn=10) FOR UPDATE NOWAIT"))
    ...

    After the transaction stars is it possible to get the id of this transaction to verify afterward if is it active?

    Thanks
    Teo

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Postgresql transaction

    In this case, the BEGIN is unnecessary. FOR UPDATE will automatically begin a transaction. To release the selected rows must perform ROLLBACK or COMMIT

  3. #3
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Postgresql transaction

    Of course I wrote nonsense. BEGIN is necessary.

Similar Threads

  1. Replies: 2
    Last Post: 11th February 2011, 17:53
  2. Slow insert with Transaction?!
    By codeman in forum Qt Programming
    Replies: 4
    Last Post: 20th October 2010, 10:38
  3. Unable to commit transaction
    By cydside in forum Qt Programming
    Replies: 6
    Last Post: 23rd July 2009, 07:47
  4. SQLite - QSqlDatabase::transaction()
    By whitefurrows in forum Qt Programming
    Replies: 6
    Last Post: 5th May 2009, 16:06
  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.