]> git.saurik.com Git - cyql.git/commitdiff
Add execute_() and push_() that take a manual locals.
authorJay Freeman (saurik) <saurik@saurik.com>
Tue, 11 Jan 2011 02:27:20 +0000 (02:27 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Tue, 11 Jan 2011 02:27:20 +0000 (02:27 +0000)
__init__.py

index 10383d3c320ec5fe1f1c62c15e61adb753d789af..944869580e1161cdc91ea15d9e39a72e875b860e 100644 (file)
@@ -24,6 +24,12 @@ class connection(object):
         finally:
             cursor.close()
 
+    @contextmanager
+    def execute_(self, statement, locals):
+        with self.cursor() as cursor:
+            cursor.execute(statement.format(**locals), locals)
+            yield cursor
+
     @contextmanager
     def execute(self, statement, depth=0):
         with self.cursor() as cursor:
@@ -65,6 +71,10 @@ class transaction(object):
         with self.connection.execute(statement, 1) as cursor:
             pass
 
+    def push_(self, statement, locals):
+        with self.connection.execute_(statement, locals) as cursor:
+            pass
+
     def exists(self, statement):
         return self.yank('''
             select exists (