Пример #1
0
 def saveTable(self,table='',multiRow=[]):
     conn,cursor = self.connectToServer()
     headerLabels =''
     if table == u'project':
         headerLabels = self.proTabHeader
     elif table == u'subproject':
         headerLabels = self.subproTabHeader
     else:
         headerLabels = self.taskTabHeader
     for row in multiRow:
         varsList = zip(headerLabels,row)
         conditionList= varsList[0]
         statement = mysql_utility.sqlUpdateState(table, varsList, [conditionList])
         cursor.execute(statement)
         conn.commit()
         #for key,value in varsList:
             #if key.find(u'时间')>=0:
                 #temp = value.split('-')
                 #value = datetime.date(int(temp[0]),int(temp[1]),int(temp[2]))
             #if table == u'project':
                 #self.projectDict[varsList[0][1]][key]=value
             #elif table == u'subproject':
                 #self.subprojectDict[varsList[0][1]][key]=value
             #else:
                 #self.taskDict[varsList[0][1]][key]=value
     cursor.close()
     conn.close()
     if table == u'project':
         self.getProjectsFromServer()
     elif table == u'subproject':
         self.getSubprojectFromServer()
     else:
         self.getTaskFromeServer()
     self.buildTreeHierarchy()
Пример #2
0
 def updateDaily(self,varsList=[],conditionList=[]):
     conn,cursor = self.connectToServer()
     statement = mysql_utility.sqlUpdateState(table='daily', varsList=varsList,conditionList=conditionList)
     cursor.execute(statement)
     conn.commit()
     cursor.close()
     conn.close()
     return 1         
Пример #3
0
 def updateServer(self,table='',varsList=[],conditionsList=[]): 
     conn,cursor = self.connectToServer()
     update_statement = mysql_utility.sqlUpdateState(table, varsList,conditionsList)
     cursor.execute(update_statement)
     conn.commit()
     cursor.close()
     conn.close()
     return 1
Пример #4
0
 def updateServer(self, table, curTable=[]):
     conn, cursor = self.connectToServer()
     cursor = conn.cursor()
     for row in curTable:
         varsList = zip(overtimeTableList[2:], row[2:])
         conditionsList = zip(overtimeTableList[:2], row[:2])
         updatestatement = mysql_utility.sqlUpdateState(
             table, varsList, conditionsList)
         print updatestatement
         cursor.execute(updatestatement)
         conn.commit()
     cursor.close()
     conn.close()
     return 1