示例#1
0
 def commit(self, *args, **kwargs):
     ses = self.session()
     try:
        xid = ses.query(func.txid_current()).first()
        logger.info("Transaction id: %s" % xid)
        logger.debug("Commit")
     except Exception as e:
         logger.exception(e)
     return ses.commit(*args, **kwargs)
示例#2
0
 def commit(self, *args, **kwargs):
     ses = self.session()
     try:
         xid = ses.query(func.txid_current()).first()
         logger.info("Transaction id: %s" % xid)
         logger.debug("Commit")
     except Exception as e:
         logger.exception(e)
     return ses.commit(*args, **kwargs)
示例#3
0
def rollback():
    """
    Do database rollback
    """
    sessio = connection.session.session()
    if sessio.transaction.is_active:
        try:
            xid = sessio.query(func.txid_current()).first()
            logger.info("Transaction id: %s" % xid)
        except:
            pass
    logger.debug("Rollback due to error")
    sessio.rollback()
示例#4
0
def rollback():
    """
    Do database rollback
    """
    sessio = connection.session.session()
    if sessio.transaction.is_active:
        try:
            xid = sessio.query(func.txid_current()).first()
            logger.info("Transaction id: %s" % xid)
        except:
            pass
    logger.debug("Rollback due to error")
    sessio.rollback()