On Friday 22 April 2005 08:01, Federico Di Gregorio wrote:
> Il giorno ven, 22/04/2005 alle 08.42 +0000, Dick Kniep ha scritto:
> > Hi list,
> >
> > Probably I am asking a question that has been asked before, so if it has
> > my apologies.
> >
> > What is the difference between setting autocommit(0) on the connection
> > and begin work on the cursor?
------
cursor = connection.cursor()
cursor.execute('begin work')
...sql queries
...more queries
..and even more queries
cursor.execute('commit work')
-------
## This code could also be written as:
------
connection.autocommit(0)
...sql queries
...more queries
..and even more queries
connection.commit()
connection.autocommit(1)
-------
>
> autocommit will set the session in autocommit mode, i.e., every query is
> implicitly wrapped in a begin/commit/abort by postgresql. Only, I don't
> understand what you mean by "begin work on the cursor".
|