def update_many_rowcount(self, query, args=None): try: return self.executemany_rowcount(query, args) except Exception as e: error(15006, 'execute_update', query, sequence_to_string(args), get_string(e)) return 0
def commit(self): try: self.conn.commit() return True except Exception as e: error(15002, 'commit_execute', get_string(e), '', format_exc()) return False
def insert_many(self, query, args=None): try: return self.executemany_rowcount(query, args) except Exception as e: error(15005, 'execute_insert', query, sequence_to_string(args), get_string(e)) return 0
def delete(self, query, args=None): try: self.execute(query, args) return self.cursor.rowcount except Exception as e: error(15007, 'execute_delete', query, sequence_to_string(args), get_string(e)) return 0
def update_many(self, query, args=None): try: self.executemany(query, args) return True except Exception as e: error(15006, 'execute_update', query, sequence_to_string(args), get_string(e)) return False
def execute_fetchone(self, query, args=None): try: self.execute(query, args) return self.fetchone() except Exception as e: error(15000, 'execute_fetchone', query, sequence_to_string(args), get_string(e)) return None
def close(self): try: if getattr(self, 'cursor', None) is not None: self.cursor.close() self.cursor = None if getattr(self, 'conn', None) is not None: self.conn.close() self.conn = None except Exception as e: error(15004, 'close_db_connection', get_string(e), '', format_exc())
def rollback(self): try: self.conn.rollback() except Exception as e: print e error(15003, 'rollback_execute', get_string(e), '', format_exc())