Mercurial > p > mysql-python > mysqldb-2
diff MySQLdb/connections.py @ 9:0e37ee00beb7 MySQLdb
Merge changes from 1.2 branch (r470:483): Mostly build-related.
author | adustman |
---|---|
date | Mon, 26 Feb 2007 00:55:29 +0000 |
parents | b70cce9bd065 |
children | 7773efbe9b30 |
line wrap: on
line diff
--- a/MySQLdb/connections.py Sun Feb 11 21:36:29 2007 +0000 +++ b/MySQLdb/connections.py Mon Feb 26 00:55:29 2007 +0000 @@ -225,6 +225,14 @@ """ return (cursorclass or self.cursorclass)(self) + def __enter__(self): return self.cursor() + + def __exit__(self, exc, value, tb): + if exc: + self.rollback() + else: + self.commit() + def literal(self, o): """