PDA

View Full Version : Postgresql transaction



matteo.ceruti
11th May 2012, 10:28
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

Lesiok
11th May 2012, 15:12
In this case, the BEGIN is unnecessary. FOR UPDATE will automatically begin a transaction. To release the selected rows must perform ROLLBACK or COMMIT

Lesiok
13th May 2012, 17:24
Of course I wrote nonsense. BEGIN is necessary.