From 8273298747a548b628e57539b74fe70521cac9ca Mon Sep 17 00:00:00 2001 From: gsmselftest Date: Thu, 27 Oct 2011 18:49:14 +0200 Subject: finally --- For Weekly Test/tricode/DbClass.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'For Weekly Test/tricode/DbClass.py') diff --git a/For Weekly Test/tricode/DbClass.py b/For Weekly Test/tricode/DbClass.py index f8e75f5..00a6f1b 100755 --- a/For Weekly Test/tricode/DbClass.py +++ b/For Weekly Test/tricode/DbClass.py @@ -144,6 +144,30 @@ class DBMySQLConnection: print 'not conn' return 0 #I am not connected + def GSMPrefix(self): + if self.connectionCreated == 1: + try: + successful = self.cur.execute("SELECT * FROM GSMPrefix") + output = self.cur.fetchall() #get the mysql response + GSMListPrefix = list() + for record in output: + columns = list() + for entry in record: + columns.append(str(entry)) + GSMListPrefix.append(columns) + + return GSMListPrefix + + except MySQLdb.Error, e: + error = str(e) + if error[1:5] == '1146': + return 2 #the table doesn't exist + if debugMode == 1: + print str(e) + return 3 #some error happened + else: + return 0 #I am not connected + def updateGSMDevice(self, deviceName, newPortName, newNumber): if self.connectionCreated == 1: try: -- cgit v1.2.3-55-g7522