From adcf3cecd0071544a855dc72295f0f3fc9aab3cd Mon Sep 17 00:00:00 2001 From: simo Date: Sun, 18 Dec 2005 05:10:04 +0000 Subject: fixed persistent mysql connections in tupkgupdate --- tupkg/update/tupkgupdate | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tupkg/update/tupkgupdate') diff --git a/tupkg/update/tupkgupdate b/tupkg/update/tupkgupdate index 5c20abf..f300024 100755 --- a/tupkg/update/tupkgupdate +++ b/tupkg/update/tupkgupdate @@ -45,7 +45,11 @@ class PackageDatabase: self.dbname = dbname self.connection = MySQLdb.connect(host=host, user=user, passwd=password, db=dbname) def cursor(self): - return self.connection.cursor() + 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) q = self.cursor() -- cgit v1.2.3-70-g09d2