async def remove_from_db(self): """Remove a quote from the database""" if (self.author == None or self.quoter == None or self.message == None): log('ERROR: Tried to call remove_from_db() on a blank Quote') return log('Member {} is trying to delete a quote:'.format(self.quoter.name)) log(' Author :{}'.format(self.author.name)) log(' Channel :#{}'.format(self.message.channel.name)) log(' Message :{}'.format(self.message.content)) try: retval = db.delete(CONN, QUOTES_TABLE, 'message_id={}'.format(self.message.id)) except: reset_sql_conn() retval = db.delete(CONN, QUOTES_TABLE, 'message_id={}'.format(self.message.id)) if retval != 0: log(' Error: Unable to delete message') else: # Acknowledge deletee with removing check mark emoji await self.message.clear_reaction(EMOJI_DELQUOTE) await self.message.clear_reaction(EMOJI_BOT_CONFIRM)
def delete(self, params={}, fields=[], session={}): if '_id' not in params: return {"code": 301, "err": "The params is error."} return dbhelper.delete(self.table, params)
def delete_data(): print('TEST: Delete data...') delete_sql = 'DELETE FROM student WHERE NAME = ? AND ID = ? ' data = [('HongtenAA', 1), ('HongtenCC', 3)] conn = dbhelper.get_conn(DB_FILE_PATH) dbhelper.delete(conn, delete_sql, data)
def remove(): if request.method == 'POST': id = request.form['id'] return dbhelper.delete(id)