VirtualBox

Ignore:
Timestamp:
Dec 31, 2016 2:29:50 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
112535
Message:

testmanager: More details in the system wide changelog.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testmanager/core/buildsource.py

    r62484 r65040  
    154154    Build source database logic.
    155155    """
     156
     157    def __init__(self, oDb):
     158        ModelLogicBase.__init__(self, oDb)
     159        self.dCache = None;
    156160
    157161    #
     
    325329        return True;
    326330
     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;
    327365
    328366    #
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette