X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=MySQL.py;h=03969f78c5add49964e417498a6d56bc11dcb637;hb=refs%2Fheads%2Fmaster;hp=98365b4d50d22629584ae39db071cd33cf8e7ae2;hpb=8893f5128b8e8790f186c8bf354a3bb721d69bcb;p=mojodb.git diff --git a/MySQL.py b/MySQL.py index 98365b4..03969f7 100644 --- a/MySQL.py +++ b/MySQL.py @@ -84,7 +84,7 @@ class Connection(connection.Connection): Constraint = Constraint Literal = Literal - def __init__(self, host="localhost", user=None, passwd=None, *args, **kwargs): + def __init__(self, host="localhost", user="", passwd="", *args, **kwargs): self._db_con = MySQLdb.connect(host=host, user=user, passwd=passwd) self._db_con_autocommit = MySQLdb.connect(host=host, user=user, passwd=passwd) super(Connection, self).__init__(*args, **kwargs) @@ -171,3 +171,15 @@ class Connection(connection.Connection): def rollback(self): self._db_con.rollback() + + def savepoint(self, name): + self.execute("SAVEPOINT %s" % name) + return True + + def commit_savepoint(self, name): + self.execute("RELEASE SAVEPOINT %s" % name) + return True + + def rollback_savepoint(self, name): + self.execute("ROLLBACK TO %s" % name) + return True