summaryrefslogtreecommitdiffstats
path: root/Under-Testing/Server-Code-New/DbClass.py
diff options
context:
space:
mode:
authorTriatmoko2011-11-17 04:24:51 +0100
committerTriatmoko2011-11-17 04:24:51 +0100
commit25128f34cdfae5318d1a38441bf09781ef91a2ba (patch)
tree004e2ee7c744b10acf024e945008d472dc8f03d0 /Under-Testing/Server-Code-New/DbClass.py
parentdelete unused files (diff)
downloadgsm-selftest-25128f34cdfae5318d1a38441bf09781ef91a2ba.tar.gz
gsm-selftest-25128f34cdfae5318d1a38441bf09781ef91a2ba.tar.xz
gsm-selftest-25128f34cdfae5318d1a38441bf09781ef91a2ba.zip
update loging files for every handler and fic device configuration function
Diffstat (limited to 'Under-Testing/Server-Code-New/DbClass.py')
-rw-r--r--Under-Testing/Server-Code-New/DbClass.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Under-Testing/Server-Code-New/DbClass.py b/Under-Testing/Server-Code-New/DbClass.py
index e3b2b5c..d937eb1 100644
--- a/Under-Testing/Server-Code-New/DbClass.py
+++ b/Under-Testing/Server-Code-New/DbClass.py
@@ -19,7 +19,7 @@ class DBMySQLConnection:
def connectDB(self):
try:
- #try the connection
+ #try to connect
self.datBaseConn=MySQLdb.connect(self.host,self.usern, self.passw,self.db)
self.datBaseConn.paramstyle = 'format'
self.cur = self.datBaseConn.cursor() #make the cursor, used for sending queries
@@ -171,6 +171,13 @@ class DBMySQLConnection:
def updateGSMDevice(self, deviceName, newPortName, newNumber):
if self.connectionCreated == 1:
try:
+ try:
+ #delete old device portName which assign to this port, to prevent double port address in the table.
+ stmt = "UPDATE DeviceAddressTable SET portName = 'missing' WHERE portName = '"+newPortName+"'"
+ self.cur.execute(stmt)
+ except ValueError:
+ print "Error execute query"
+
stmt = "UPDATE DeviceAddressTable SET portName = '"+ newPortName + "', number = '"+ newNumber+ "' WHERE deviceName = '" + deviceName+ "'"
self.cur.execute(stmt)
return 1