fixed persistent mysql connections in tupkgupdate

This commit is contained in:
simo 2005-12-18 05:10:04 +00:00
parent 2d59d0d873
commit adcf3cecd0
2 changed files with 6 additions and 2 deletions

View file

@ -132,7 +132,7 @@ class ClientSocket(threading.Thread):
MySQLdb.escape_string(encpw)+
"'")
dbconn.close()
except MySQLdb.OperationalError:
except :
self.sendMsg("result=SQLERR")
return 0
if q.rowcount == 0:

View file

@ -45,6 +45,10 @@ class PackageDatabase:
self.dbname = dbname
self.connection = MySQLdb.connect(host=host, user=user, passwd=password, db=dbname)
def cursor(self):
try:
self.connection.ping()
except MySQLdb.OperationalError:
self.connection = MySQLdb.connect(host=self.host, user=self.user, passwd=self.password, db=self.dbname)
return self.connection.cursor()
def lookup(self, packagename):
warning("DB: Looking up package: " + packagename)