Re: Transactions, cursors and timestamps
"Billy G. Allie" <[email protected]> Sun, 02 Apr 2006 23:21:26 -0400
| Newsgroups | gmane.comp.python.db.pypgsql.user |
|---|---|
| Message-ID | <[email protected]> |
--=-nyPHkYogS0lg418OhbK0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Sun, 2006-04-02 at 19:25 +0100, Terry Macdonald wrote:
> Billy G. Allie wrote:
> > On Mon, 2006-03-27 at 13:52 +0100, Terry Macdonald wrote:
> >> Hi,
[ . . . ]
> >
> If I have understood you then If I have a single cursor on a connection
> I would need to do a commit after every select so that a subsequent
> insert or update would have a correct timestamp.
> Or...
> I could have two connections each with a cursor; one connection/cursor
> pair would be used for non-select statements and the other
> connection/cursor pair would be used for selects
>
> Yes?
>
Either would work (providing that the connection/cursor pair used for
inserts and updates is commited frequently enough to make the timestamps
reflect the current time.
Note that the restrictions of one active transaction per connection is a
PostgreSQL restriction, not a DB-API 2.0 compilant module restriction.
--=-nyPHkYogS0lg418OhbK0
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.3.2">
</HEAD>
<BODY>
On Sun, 2006-04-02 at 19:25 +0100, Terry Macdonald wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">Billy G. Allie wrote:</FONT>
<FONT COLOR="#000000">> On Mon, 2006-03-27 at 13:52 +0100, Terry Macdonald wrote:</FONT>
<FONT COLOR="#000000">>> Hi,</FONT>
</PRE>
</BLOCKQUOTE>
[ . . . ]
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">></FONT>
<FONT COLOR="#000000">If I have understood you then If I have a single cursor on a connection </FONT>
<FONT COLOR="#000000">I would need to do a commit after every select so that a subsequent </FONT>
<FONT COLOR="#000000">insert or update would have a correct timestamp.</FONT>
<FONT COLOR="#000000">Or...</FONT>
<FONT COLOR="#000000">I could have two connections each with a cursor; one connection/cursor </FONT>
<FONT COLOR="#000000">pair would be used for non-select statements and the other </FONT>
<FONT COLOR="#000000">connection/cursor pair would be used for selects</FONT>
<FONT COLOR="#000000">Yes?</FONT>
</PRE>
</BLOCKQUOTE>
Either would work (providing that the connection/cursor pair used for inserts and updates is commited frequently enough to make the timestamps reflect the current time.<BR>
<BR>
<I>Note that the restrictions of one active transaction per connection is a PostgreSQL restriction, not a DB-API 2.0 compilant module restriction.</I>
</BODY>
</HTML>
--=-nyPHkYogS0lg418OhbK0--
-------------------------------------------------------
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