Weed out the last of the floating point COUNT bugs

This commit is contained in:
James Vega 2004-04-19 15:16:31 +00:00
parent 42f279cb6e
commit ca9f696c8c
2 changed files with 4 additions and 3 deletions

View File

@ -171,9 +171,9 @@ class Infobot(callbacks.PrivmsgRegexp):
r"^info$" r"^info$"
cursor = self.db.cursor() cursor = self.db.cursor()
cursor.execute("SELECT COUNT(*) FROM is_factoids") cursor.execute("SELECT COUNT(*) FROM is_factoids")
numIs = cursor.fetchone()[0] numIs = int(cursor.fetchone()[0])
cursor.execute("SELECT COUNT(*) FROM are_factoids") cursor.execute("SELECT COUNT(*) FROM are_factoids")
numAre = cursor.fetchone()[0] numAre = int(cursor.fetchone()[0])
s = 'I have %s is factoids and %s are factoids' % (numIs, numAre) s = 'I have %s is factoids and %s are factoids' % (numIs, numAre)
irc.reply(s) irc.reply(s)

View File

@ -309,8 +309,9 @@ class URL(callbacks.PrivmsgCommandAndRegexp,
cursor = db.cursor() cursor = db.cursor()
cursor.execute("""SELECT COUNT(*) FROM urls""") cursor.execute("""SELECT COUNT(*) FROM urls""")
(count,) = cursor.fetchone() (count,) = cursor.fetchone()
count = int(count)
irc.reply('I have %s %s in my database.' % irc.reply('I have %s %s in my database.' %
(count, int(count) == 1 and 'URL' or 'URLs')) (count, count == 1 and 'URL' or 'URLs'))
def last(self, irc, msg, args): def last(self, irc, msg, args):
"""[<channel>] [--{from,with,at,proto,near}=<value>] --{nolimit,fancy} """[<channel>] [--{from,with,at,proto,near}=<value>] --{nolimit,fancy}