Transactions, cursors and timestamps

Terry Macdonald <[email protected]> Mon, 27 Mar 2006 14:00:22 +0100
Newsgroups gmane.comp.python.db.pypgsql.user
Message-ID <[email protected]>
Hi,

I don't now if I am implementing the DB-API via pypgsql properly but I 
have a web app that opens a db connection and a couple of cursors at 
application startup and I use the same cursors throughout the life of 
the app.

Doing it this way I have noticed that transactions begin once a commit 
had been done. If an SQL statement acts on a table with a timestamp 
column using the now() function,  as it is in a transaction the time 
used in the update/insert is when the transaction was started which 
means that after my last commit if a significant time has elapsed before 
the cursor is used again to update/insert a row the time stored is that 
of when the transaction began and not when the row was inserted which 
could easily be long after the transaction began.

What is the best practice in using cursors and how do I get the 
timestamp to reflect when the row was created.

Cheers in advance


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642