From 08f5adf362a89d5794131f2e62d414f7c59771a9 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Wed, 29 Oct 2003 08:38:15 +0000 Subject: [PATCH] Ew, ugly SQL!plugins/Quotes.py --- plugins/Quotes.py | 8 +++----- plugins/Relay.py | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/Quotes.py b/plugins/Quotes.py index 992a7af95..e4c77fbc8 100644 --- a/plugins/Quotes.py +++ b/plugins/Quotes.py @@ -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)) diff --git a/plugins/Relay.py b/plugins/Relay.py index 7c0648836..9bb514f35 100644 --- a/plugins/Relay.py +++ b/plugins/Relay.py @@ -42,6 +42,7 @@ import time import conf import debug import utils +import world import irclib import drivers import ircmsgs