]> git.saurik.com Git - cyql.git/commitdiff
Add features to support database.py.
authorJay Freeman (saurik) <saurik@saurik.com>
Mon, 28 Nov 2011 10:35:34 +0000 (10:35 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Mon, 28 Nov 2011 10:35:34 +0000 (10:35 +0000)
__init__.py

index 2123108be94ca098a7b8ce6d776625b146965a2f..6ce111ef57ecef011ce497a5ab55bfe5d007f7c5 100644 (file)
@@ -49,6 +49,15 @@ class connect(object):
     def __exit__(self, type, value, traceback):
         self.close()
 
+    def begin(self):
+        self.driver.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_READ_COMMITTED)
+
+    def commit(self):
+        self.driver.commit()
+
+    def rollback(self):
+        self.driver.rollback()
+
     @contextmanager
     def cursor(self):
         cursor = self.driver.cursor(cursor_factory=psycopg2.extras.DictCursor)
@@ -144,8 +153,8 @@ class connect(object):
         with self.execute(statement, 1) as cursor:
             yield cursor
 
-    def all(self, statement):
-        with self.execute(statement, 1) as cursor:
+    def all(self, statement, context=None):
+        with self.execute(statement, 1, context) as cursor:
             return cursor.fetchall()
 
     def one(self, statement, context=None):