]> git.saurik.com Git - cyql.git/blobdiff - __init__.py
Add execute_() and push_() that take a manual locals.
[cyql.git] / __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 (