summaryrefslogtreecommitdiff
path: root/lib/psycopg1.py
diff options
context:
space:
mode:
authorFederico Di Gregorio <fog@initd.org>2005-04-03 06:16:24 +0000
committerFederico Di Gregorio <fog@initd.org>2005-04-03 06:16:24 +0000
commit728b4788de8b70bf809103e944e84c02d8ba608b (patch)
treef2cf57cdb8777c39507405c1697be8f4d3ff6a6d /lib/psycopg1.py
parentfdb68599c7bce5e5d860383f21d1ae6c8fc12c29 (diff)
downloadpsycopg2-728b4788de8b70bf809103e944e84c02d8ba608b.tar.gz
psycopg1 compatibility module (added autocommit.)
Diffstat (limited to 'lib/psycopg1.py')
-rw-r--r--lib/psycopg1.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/psycopg1.py b/lib/psycopg1.py
index 45a1783..09b6e84 100644
--- a/lib/psycopg1.py
+++ b/lib/psycopg1.py
@@ -41,6 +41,13 @@ class connection(_2connection):
"""cursor() -> new psycopg 1.1.x compatible cursor object"""
return _2connection.cursor(self, cursor_factory=cursor)
+ def autocommit(self, on_off=1):
+ """autocommit(on_off=1) -> switch autocommit on (1) or off (0)"""
+ if on_off > 0:
+ self.set_isolation_level(0)
+ else:
+ self.set_isolation_level(2)
+
class cursor(_2cursor):
"""psycopg 1.1.x cursor.
@@ -73,4 +80,4 @@ class cursor(_2cursor):
for row in rows:
res.append(self.__build_dict(row))
return res
-
+