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/testgroup.py

    r62484 r65040  
    372372    """
    373373
     374    def __init__(self, oDb):
     375        ModelLogicBase.__init__(self, oDb)
     376        self.dCache = None;
     377
    374378    #
    375379    # Standard methods.
     
    550554        return True;
    551555
     556    def cachedLookup(self, idTestGroup):
     557        """
     558        Looks up the most recent TestGroupDataEx object for idTestGroup
     559        via an object cache.
     560
     561        Returns a shared TestGroupDataEx object.  None if not found.
     562        Raises exception on DB error.
     563        """
     564        if self.dCache is None:
     565            self.dCache = self._oDb.getCache('TestGroupDataEx');
     566        oEntry = self.dCache.get(idTestGroup, None);
     567        if oEntry is None:
     568            fNeedTsNow = False;
     569            self._oDb.execute('SELECT   *\n'
     570                              'FROM     TestGroups\n'
     571                              'WHERE    idTestGroup = %s\n'
     572                              '     AND tsExpire    = \'infinity\'::TIMESTAMP\n'
     573                              , (idTestGroup, ));
     574            if self._oDb.getRowCount() == 0:
     575                # Maybe it was deleted, try get the last entry.
     576                self._oDb.execute('SELECT   *\n'
     577                                  'FROM     TestGroups\n'
     578                                  'WHERE    idTestGroup = %s\n'
     579                                  'ORDER BY tsExpire DESC\n'
     580                                  'LIMIT 1\n'
     581                                  , (idTestGroup, ));
     582                fNeedTsNow = True;
     583            elif self._oDb.getRowCount() > 1:
     584                raise self._oDb.integrityException('%s infinity rows for %s' % (self._oDb.getRowCount(), idTestGroup));
     585
     586            if self._oDb.getRowCount() == 1:
     587                aaoRow = self._oDb.fetchOne();
     588                oEntry = TestGroupDataEx();
     589                tsNow  = oEntry.initFromDbRow(aaoRow).tsEffective if fNeedTsNow else None;
     590                oEntry.initFromDbRowEx(aaoRow, self._oDb, tsNow);
     591                self.dCache[idTestGroup] = oEntry;
     592        return oEntry;
     593
    552594
    553595    #
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