From a52e07d9047b0f41c16e51e083cc8639eaa88328 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 5 Sep 2011 22:40:46 +0200 Subject: Changed log backend to PostgreSQL --- modules/log.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'modules/log.py') diff --git a/modules/log.py b/modules/log.py index ff8093e..74e813a 100644 --- a/modules/log.py +++ b/modules/log.py @@ -3,27 +3,31 @@ from . import ModuleBase class Module(ModuleBase): def __init__(self, manager): ModuleBase.__init__(self, manager) - self.mysql = manager.get('mysql') + self.pgsql = manager.get('pgsql') def helptexts(self): return ['Chatlogs werden auch erstellt.'] def groupchat(self, room, nick, text, handler): - cursor = self.mysql.cursor() - cursor.execute('INSERT INTO log (`type`, `time`, `room`, `nick`, `text`) VALUES ("message", NOW(), %s, %s, %s)', (room, nick, text)) + cursor = self.pgsql.cursor() + cursor.execute('INSERT INTO log ("type", "time", "room", "nick", "text") VALUES (\'message\', now(), %s, %s, %s)', (room, nick, text)) cursor.close() + self.pgsql.commit() def join(self, room, nick, show, status, handler): - cursor = self.mysql.cursor() - cursor.execute('INSERT INTO log (`type`, `time`, `room`, `nick`, `show`, `text`) VALUES ("join", NOW(), %s, %s, %s, %s)', (room, nick, show, status)) + cursor = self.pgsql.cursor() + cursor.execute('INSERT INTO log ("type", "time", "room", "nick", "show", "text") VALUES (\'join\', now(), %s, %s, %s, %s)', (room, nick, show, status)) cursor.close() + self.pgsql.commit() def leave(self, room, nick, show, status, handler): - cursor = self.mysql.cursor() - cursor.execute('INSERT INTO log (`type`, `time`, `room`, `nick`, `show`, `text`) VALUES ("leave", NOW(), %s, %s, %s, %s)', (room, nick, show, status)) + cursor = self.pgsql.cursor() + cursor.execute('INSERT INTO log ("type", "time", "room", "nick", "show", "text") VALUES (\'leave\', now(), %s, %s, %s, %s)', (room, nick, show, status)) cursor.close() + self.pgsql.commit() def topic(self, room, nick, text, handler): - cursor = self.mysql.cursor() - cursor.execute('INSERT INTO log (`type`, `time`, `room`, `nick`, `text`) VALUES ("topic", NOW(), %s, %s, %s)', (room, nick, text)) + cursor = self.pgsql.cursor() + cursor.execute('INSERT INTO log ("type", "time", "room", "nick", "text") VALUES (\'topic\', now(), %s, %s, %s)', (room, nick, text)) cursor.close() + self.pgsql.commit() -- cgit v1.2.3