def __init__(self, connection):
self.connection = connection
+ def __call__(self, statement, locals=None):
+ with self.connection.execute(statement, 1, locals) as cursor:
+ pass
+
+ @contextmanager
+ def set(self, statement):
+ with self.connection.execute(statement, 1) as cursor:
+ yield cursor
+
+ def all(self, statement):
+ with self.connection.execute(statement, 1) as cursor:
+ return cursor.fetchall()
+
+ def one(self, statement):
+ with self.connection.execute(statement, 1) as cursor:
+ one = cursor.fetchone()
+ if one == None:
+ return None
+ assert cursor.fetchone() == None
+ return one
+
def pull(self, statement):
with self.connection.execute(statement, 1) as cursor:
return cursor.fetchall()