summaryrefslogtreecommitdiffstats
path: root/For Weekly Test/tricode/DbClass.py
diff options
context:
space:
mode:
authorTriatmoko2011-11-01 23:03:55 +0100
committerTriatmoko2011-11-01 23:03:55 +0100
commit21e85152c15204fdac0047d025fba4da2a6a086b (patch)
treed28de433d23442db96652713b29a0c0ca28f88a4 /For Weekly Test/tricode/DbClass.py
parentsmart (diff)
downloadgsm-selftest-21e85152c15204fdac0047d025fba4da2a6a086b.tar.gz
gsm-selftest-21e85152c15204fdac0047d025fba4da2a6a086b.tar.xz
gsm-selftest-21e85152c15204fdac0047d025fba4da2a6a086b.zip
search the bug on dbclass
Diffstat (limited to 'For Weekly Test/tricode/DbClass.py')
-rwxr-xr-xFor Weekly Test/tricode/DbClass.py59
1 files changed, 30 insertions, 29 deletions
diff --git a/For Weekly Test/tricode/DbClass.py b/For Weekly Test/tricode/DbClass.py
index a3bf486..8733ec9 100755
--- a/For Weekly Test/tricode/DbClass.py
+++ b/For Weekly Test/tricode/DbClass.py
@@ -266,42 +266,43 @@ class DBMySQLConnection:
else:
return 0 #I am not connected
- def lockMutex(self, seconds):
- if self.connectionCreated == 1:
- try:
- successful = self.cur.execute("SELECT IS_FREE_LOCK('SoftwareStarted')")
- output = self.cur.fetchone()
+ def lockMutex(self, seconds):
+ if self.connectionCreated == 1:
+ try:
+ successful = self.cur.execute("SELECT IS_FREE_LOCK('SoftwareStarted')")
+ output = self.cur.fetchone()
if output[0] == 1:
- #resource is free which means software is not started yet
- successful = self.cur.execute("SELECT GET_LOCK('SoftwareStarted', %i)"%(int(seconds)))
+ #resource is free which means software is not started yet
+ successful = self.cur.execute("SELECT GET_LOCK('SoftwareStarted', %i)"%(int(seconds)))
- output1 = self.cur.fetchone()
- if output1[0] == 1:
- #I got the lock now
- self.lockSet = 1
- return 1
- elif output1[0] == 0:
- return 7 #if the attempt timed out (for example, because another client has previously locked the name)
- else:
- return 6 # if an error occurred (such as running out of memory or the thread was killed with
- elif output[0] ==0:
- return 4 #software is already running and somebody has allocated the mutex
- else:
- #means some not so good bug
- return 5 # if an error occurs (such as an incorrect argument).
+ output1 = self.cur.fetchone()
+ if output1[0] == 1:
+ #I got the lock now
+ self.lockSet = 1
+ return 1
+ elif output1[0] == 0:
+ return 7 #if the attempt timed out (for example, because another client has previously locked the name)
+ else:
+ return 6 # if an error occurred (such as running out of memory or the thread was killed with
+ elif output[0] ==0:
+ return 4 #software is already running and somebody has allocated the mutex
+ else:
+ #means some not so good bug
+ return 5 # if an error occurs (such as an incorrect argument).
except MySQLdb.Error, e:
- error = str(e)
- if error[1:5] == '1062':
- return 2 #duplicate entry for the key
- if debugMode == 1:
- print str(e)
+ error = str(e)
+ if error[1:5] == '1062':
+ return 2 #duplicate entry for the key
+ if debugMode == 1:
+ print str(e)
return 3
- else:
- return 0
+ else:
+ return 0
+
def maxTaskNo(self):
if self.connectionCreated == 1:
try:
- succ = self.cur.execute("SELECT taskNo FROM TaskTable")
+ succ = self.cur.execute("SELECT max(taskNo) FROM TaskTable")
taskNo = self.cur.fetchone()
self.taskNo = taskNo[0]
if self.taskNo == None or self.taskNo == '0' or self.taskNo == '' or self.taskNo == 0: