Commit 13bfe945 authored by Svetlana Tkachenko's avatar Svetlana Tkachenko
Browse files

Do not reuse cursor

parent d39d993b
......@@ -61,13 +61,16 @@ class Seen(object):
# print("Message '{0}' from '{1}' in '{2}'".format(message, nick, channel))
# add to db
# nick, timestamp, network, channel message
self.cursor.execute('INSERT OR REPLACE INTO seen VALUES (?, ?, ?, ?, ?)', (nick.lower(), time.time(), self.network, channel, message))
self.connection.commit()
connection = sqlite3.connect(self.db)
cursor = connection.cursor()
cursor.execute('INSERT OR REPLACE INTO seen VALUES (?, ?, ?, ?, ?)', (nick.lower(), time.time(), self.network, channel, message))
connection.commit()
def handle_command(self, channel, user, cmd, args):
if cmd == "seen":
nick = args[0].lower()
self.cursor.execute('SELECT * FROM seen WHERE nick = ? and network = ?', (nick, self.network))
cursor = sqlite3.connect(self.db).cursor()
cursor.execute('SELECT * FROM seen WHERE nick = ? and network = ?', (nick, self.network))
info = self.cursor.fetchone()
if info:
# ('gry', '2013-01-31 14:50:02.419198', 'gnu', '#guppy', '-seen gry')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment