Ew, ugly SQL!plugins/Quotes.py

This commit is contained in:
Jeremy Fincher 2003-10-29 08:38:15 +00:00
parent bfdbda625a
commit 08f5adf362
2 changed files with 4 additions and 5 deletions

View File

@ -90,11 +90,9 @@ class Quotes(plugins.ChannelDBHandler, callbacks.Privmsg):
VALUES(NULL, %s, %s, %s)""",
msg.nick, quotetime, quote)
db.commit()
criteria = ['added_by="%s"' % msg.nick]
criteria.append('added_at=%s' % quotetime)
criteria.append('quote="%s"' % quote)
sql = """SELECT id FROM quotes WHERE %s""" % ' AND '.join(criteria)
cursor.execute(sql)
sql = """SELECT id FROM quotes
WHERE added_by=%s AND added_at=%s AND quote=%s"""
cursor.execute(sql, msg.nick, quotetime, quote)
quoteid = cursor.fetchone()[0]
irc.reply(msg, '%s (Quote #%s added)' % (conf.replySuccess, quoteid))

View File

@ -42,6 +42,7 @@ import time
import conf
import debug
import utils
import world
import irclib
import drivers
import ircmsgs