Changeset 61472 in vbox for trunk/src/VBox/ValidationKit/testmanager/core/schedgroup.py
- Timestamp:
- Jun 5, 2016 5:46:15 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testmanager/core/schedgroup.py
r61468 r61472 65 65 kiMax_iSchedPriority = 32; 66 66 67 kcDbColumns = 8 67 68 68 69 def __init__(self): … … 125 126 """ 126 127 SchedGroupMemberData.initFromDbRow(self, aoRow); 127 self.oTestGroup = TestGroupData().initFromDbRow(aoRow[ 8:]);128 self.oTestGroup = TestGroupData().initFromDbRow(aoRow[SchedGroupMemberData.kcDbColumns:]); 128 129 return self; 129 130 … … 170 171 ksParam_idBuildSrc = 'SchedGroup_idBuildSrc'; 171 172 ksParam_idBuildSrcTestSuite = 'SchedGroup_idBuildSrcTestSuite'; 173 ksParam_sComment = 'SchedGroup_sComment'; 172 174 173 175 kasAllowNullAttributes = ['idSchedGroup', 'tsEffective', 'tsExpire', 'uidAuthor', 'sDescription', 174 'idBuildSrc', 'idBuildSrcTestSuite' ];176 'idBuildSrc', 'idBuildSrcTestSuite', 'sComment' ]; 175 177 kasValidValues_enmScheduler = [ksScheduler_BestEffortContinousItegration, ]; 178 179 kcDbColumns = 11; 176 180 177 181 # Scheduler types … … 197 201 self.enmScheduler = SchedGroupData.ksScheduler_BestEffortContinousItegration; 198 202 self.idBuildSrc = None; 199 self.idBuildSrcTestSuite = None; 203 self.idBuildSrcTestSuite = None; 204 self.sComment = None; 200 205 201 206 def initFromDbRow(self, aoRow): … … 218 223 self.enmScheduler = aoRow[7]; 219 224 self.idBuildSrc = aoRow[8]; 220 self.idBuildSrcTestSuite = aoRow[9]; 225 self.idBuildSrcTestSuite = aoRow[9]; 226 self.sComment = aoRow[10]; 221 227 return self; 222 228 … … 496 502 ' enmScheduler,\n' 497 503 ' idBuildSrc,\n' 498 ' idBuildSrcTestSuite)\n' 499 'VALUES (%s, %s, %s, %s, %s, %s, %s)\n' 504 ' idBuildSrcTestSuite,\n' 505 ' sComment)\n' 506 'VALUES (%s, %s, %s, %s, %s, %s, %s, %s)\n' 500 507 'RETURNING idSchedGroup\n' 501 , (uidAuthor, 502 oData.sName, 503 oData.sDescription, 504 oData.fEnabled, 505 oData.enmScheduler, 506 oData.idBuildSrc, 507 oData.idBuildSrcTestSuite)); 508 , ( uidAuthor, 509 oData.sName, 510 oData.sDescription, 511 oData.fEnabled, 512 oData.enmScheduler, 513 oData.idBuildSrc, 514 oData.idBuildSrcTestSuite, 515 oData.sComment )); 508 516 idSchedGroup = self._oDb.fetchOne()[0]; 509 517 oData.idSchedGroup = idSchedGroup; … … 803 811 def exists(self, sName): 804 812 """Checks if a group with the given name exists.""" 805 self._oDb.execute('SELECT *\n'813 self._oDb.execute('SELECT idSchedGroup\n' 806 814 'FROM SchedGroups\n' 807 815 'WHERE tsExpire = \'infinity\'::TIMESTAMP\n' 808 ' AND sName = %s\n' 816 ' AND sName = %s\n' 817 'LIMIT 1\n' 809 818 , (sName,)); 810 819 return self._oDb.getRowCount() > 0; … … 814 823 self._oDb.execute('SELECT *\n' 815 824 'FROM SchedGroups\n' 816 'WHERE tsExpire = \'infinity\'::timestamp\n'825 'WHERE tsExpire = \'infinity\'::timestamp\n' 817 826 ' AND idSchedGroup = %s;', (idSchedGroup,)) 818 827 aRows = self._oDb.fetchAll() … … 825 834 return None 826 835 827 def remove(self, uidAuthor, idScedGroup, fNeedCommit=True):828 """Historize Scheduling Group record"""829 self._oDb.execute('UPDATE SchedGroups\n'830 'SET tsExpire = CURRENT_TIMESTAMP,\n'831 ' uidAuthor = %s\n'832 'WHERE idSchedGroup = %s\n'833 ' AND tsExpire = \'infinity\'::TIMESTAMP\n',834 (uidAuthor, idScedGroup))835 if fNeedCommit:836 self._oDb.commit()837 return True838 836 839 837 # … … 878 876 ' enmScheduler,\n' 879 877 ' idBuildSrc,\n' 880 ' idBuildSrcTestSuite )\n' 881 'VALUES ( %s, %s, %s, %s, %s, %s, %s, %s, %s )\n' 878 ' idBuildSrcTestSuite,\n' 879 ' sComment )\n' 880 'VALUES ( %s, %s, %s, %s, %s, %s, %s, %s, %s, %s )\n' 882 881 , ( uidAuthor, 883 882 tsEffective, … … 888 887 oData.enmScheduler, 889 888 oData.idBuildSrc, 890 oData.idBuildSrcTestSuite, )); 889 oData.idBuildSrcTestSuite, 890 oData.sComment, )); 891 891 return True; 892 892
Note:
See TracChangeset
for help on using the changeset viewer.