[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nufw-devel] bug+patch
From: |
Philippe Pujas |
Subject: |
[Nufw-devel] bug+patch |
Date: |
Thu, 02 Apr 2009 00:37:21 +0200 |
User-agent: |
Thunderbird 2.0.0.21 (Windows/20090302) |
Bonjour,
visiblement il y a un bug dans ulog_rotate. Si les tables users_1 ou
ulog_1 n'existent pas le script s'arrête avec une erreur.
J'ai cru voir un bug SQL dans la fonction __table_exists. J'ai un petit
patch qui résout ce problème et crée la table qui manque. Le patch est
attaché à ce mail
Philippe (mc2)
----------------------
Hi,
This patch is for ulog_rotate.py in nulog package. When starting users_1
and ulog_1 SQL tables don't exist and the script crashes.
Philippe (mc2)
--
---------------------------------------
Philippe PUJAS,
Directeur adjoint
IUT de Béziers
Université Montpellier 2
17, quai du Port Neuf, 34500 Béziers
Téléphone : +33/0 467 111 800
Télécopie : +33/0 467 111 801
Web : http://www.iutbeziers.fr
--- ulog_rotate.py.org 2009-03-25 18:22:54.000000000 +0100
+++ ulog_rotate.py 2009-03-25 18:32:47.000000000 +0100
@@ -108,17 +108,24 @@
print >>stderr, '*** ERROR *** ', err
def __table_exists(self, table):
+ try:
+ self.cursor.execute("""SHOW TABLES LIKE '%s'""" % table)
+ return self.cursor.fetchone()!=None
+ except _mysql_exceptions.ProgrammingError, e:
+ self.debug(e)
+ return False
+ def __table_creates(self, table, pattern):
try:
- self.cursor.execute('select id from %s_1 limit 1' % self.ulog)
+ self.cursor.execute("CREATE TABLE IF NOT EXISTS `%s` LIKE `%s`" %
(table, pattern))
return True
except _mysql_exceptions.ProgrammingError, e:
self.debug(e)
return False
-
+
def daily_rotate(self, table, timestamp):
- if not self.__table_exists(table):
+ if not self.__table_exists(table+"_1") and not
self.__table_creates(table+"_1",table):
return
self.cursor.execute("""INSERT INTO %s_1
SELECT * FROM %s
Philippe_Pujas.vcf
Description: Vcard
- [Nufw-devel] bug+patch,
Philippe Pujas <=