-class transaction(object):
- def __init__(self, connection):
- self.connection = connection
+ def __call__(self, procedure, *parameters):
+ with self.execute(statement, 1) as cursor:
+ return cursor.callproc(procedure, *parameters)
+
+ def run(self, statement, locals=None):
+ with self.execute(statement, 1, locals) as cursor:
+ return cursor.rowcount
+
+ @contextmanager
+ def set(self, statement):
+ with self.execute(statement, 1) as cursor:
+ yield cursor