def _transaction(self):
     connection = Connection(self.dsn)
     try:
         yield connection.cursor()
     except Connection.Error as e:
         connection.rollback()
         raise e
     else:
         connection.commit()
     finally:
         connection.close()
 def __init__(self, dsn):
     self.dsn = dsn
     self.connection = Connection(dsn)
Exemplo n.º 3
0
def connect( dsn ):
    return Connection( dsn )