params.append(id)
sql = 'update {} set {} where bot_id=? and id=?'.format(table, ', '.join(['{}=?'.format(v) for v in values]))
cursor = self.query(sql, params)
- if cursor.rowcount:
- self.commit()
- ret = True
+ if cursor is not None:
+ if cursor.rowcount:
+ self.commit()
+ ret = True
+ else:
+ log.error('No such entry {} in {} table for {}'.format(id, table, client.user.name))
+ self.rollback()
+ ret = False
else:
- log.error('No such entry {} in {} table for {}'.format(id, table, client.user.name))
- self.rollback()
ret = False
self.close_db()
return ret