From 7d11917e79db64a1ac4a26747874b6ac61c17b4a Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Wed, 12 May 2010 12:52:31 +0000 Subject: [PATCH 1/1] Add global cyq.transact() helper to make single transaction connections simpler. --- __init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/__init__.py b/__init__.py index 00a4573..0c29a58 100644 --- a/__init__.py +++ b/__init__.py @@ -80,6 +80,12 @@ def connect(dsn): finally: driver.close() +@contextmanager +def transact(dsn, **args): + with connect(dsn) as connection: + with connection.transact(**args) as cursor: + yield cursor + """ def slap_(sql, table, keys, values, path): csr = sql.cursor() -- 2.47.2