Changeset 65040 in vbox for trunk/src/VBox/ValidationKit/testmanager/core/buildsource.py
- Timestamp:
- Dec 31, 2016 2:29:50 AM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 112535
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testmanager/core/buildsource.py
r62484 r65040 154 154 Build source database logic. 155 155 """ 156 157 def __init__(self, oDb): 158 ModelLogicBase.__init__(self, oDb) 159 self.dCache = None; 156 160 157 161 # … … 325 329 return True; 326 330 331 def cachedLookup(self, idBuildSrc): 332 """ 333 Looks up the most recent BuildSourceData object for idBuildSrc 334 via an object cache. 335 336 Returns a shared BuildSourceData object. None if not found. 337 Raises exception on DB error. 338 """ 339 if self.dCache is None: 340 self.dCache = self._oDb.getCache('BuildSourceData'); 341 oEntry = self.dCache.get(idBuildSrc, None); 342 if oEntry is None: 343 self._oDb.execute('SELECT *\n' 344 'FROM BuildSources\n' 345 'WHERE idBuildSrc = %s\n' 346 ' AND tsExpire = \'infinity\'::TIMESTAMP\n' 347 , (idBuildSrc, )); 348 if self._oDb.getRowCount() == 0: 349 # Maybe it was deleted, try get the last entry. 350 self._oDb.execute('SELECT *\n' 351 'FROM BuildSources\n' 352 'WHERE idBuildSrc = %s\n' 353 'ORDER BY tsExpire DESC\n' 354 'LIMIT 1\n' 355 , (idBuildSrc, )); 356 elif self._oDb.getRowCount() > 1: 357 raise self._oDb.integrityException('%s infinity rows for %s' % (self._oDb.getRowCount(), idBuildSrc)); 358 359 if self._oDb.getRowCount() == 1: 360 aaoRow = self._oDb.fetchOne(); 361 oEntry = BuildSourceData(); 362 oEntry.initFromDbRow(aaoRow); 363 self.dCache[idBuildSrc] = oEntry; 364 return oEntry; 327 365 328 366 #
Note:
See TracChangeset
for help on using the changeset viewer.