コード例 #1
0
 def initFromDbWithId(self, oDb, idBuild, tsNow=None, sPeriodBack=None):
     """
     Initialize from the database, given the ID of a row.
     """
     oDb.execute(
         self.formatSimpleNowAndPeriodQuery(
             oDb, 'SELECT *\n'
             'FROM   Builds\n'
             'WHERE  idBuild = %s\n', (idBuild, ), tsNow, sPeriodBack))
     aoRow = oDb.fetchOne()
     if aoRow is None:
         raise TMRowNotFound(
             'idBuild=%s not found (tsNow=%s sPeriodBack=%s)' % (
                 idBuild,
                 tsNow,
                 sPeriodBack,
             ))
     return self.initFromDbRow(aoRow)
コード例 #2
0
 def initFromDbWithId(self, oDb, uid, tsNow=None, sPeriodBack=None):
     """
     Initialize the object from the database.
     """
     oDb.execute(
         self.formatSimpleNowAndPeriodQuery(
             oDb, 'SELECT *\n'
             'FROM   Users\n'
             'WHERE  uid = %s\n', (uid, ), tsNow, sPeriodBack))
     aoRow = oDb.fetchOne()
     if aoRow is None:
         raise TMRowNotFound('uid=%s not found (tsNow=%s sPeriodBack=%s)' %
                             (
                                 uid,
                                 tsNow,
                                 sPeriodBack,
                             ))
     return self.initFromDbRow(aoRow)
コード例 #3
0
    def initFromDbRow(self, aoRow):
        """
        Re-initializes the data with a row from a SELECT * FROM FailureCategoryes.

        Returns self. Raises exception if the row is None or otherwise invalid.
        """

        if aoRow is None:
            raise TMRowNotFound('Failure Category not found.')

        self.idFailureCategory = aoRow[0]
        self.tsEffective = aoRow[1]
        self.tsExpire = aoRow[2]
        self.uidAuthor = aoRow[3]
        self.sShort = aoRow[4]
        self.sFull = aoRow[5]

        return self
コード例 #4
0
    def initFromDbRow(self, aoRow):
        """
        Init from database table row
        Returns self. Raises exception of the row is None.
        """
        if aoRow is None:
            raise TMRowNotFound('User not found.')

        self.uid = aoRow[0]
        self.tsEffective = aoRow[1]
        self.tsExpire = aoRow[2]
        self.uidAuthor = aoRow[3]
        self.sUsername = aoRow[4]
        self.sEmail = aoRow[5]
        self.sFullName = aoRow[6]
        self.sLoginName = aoRow[7]
        self.fReadOnly = aoRow[8]
        return self
コード例 #5
0
    def getById(self, idGlobalRsrc):
        """
        Get global resource record by its id
        """
        self._oDb.execute(
            'SELECT   *\n'
            'FROM     GlobalResources\n'
            'WHERE    tsExpire = \'infinity\'::timestamp\n'
            '  AND    idGlobalRsrc=%s;', (idGlobalRsrc, ))

        aRows = self._oDb.fetchAll()
        if len(aRows) not in (0, 1):
            raise self._oDb.integrityException(
                'Duplicate global resource entry with ID %u (current)' %
                (idGlobalRsrc, ))
        try:
            return GlobalResourceData().initFromDbRow(aRows[0])
        except IndexError:
            raise TMRowNotFound('Global resource not found.')
コード例 #6
0
 def initFromDbWithId(self, oDb, idTestBox, tsNow=None, sPeriodBack=None):
     """
     Initialize the object from the database.
     """
     oDb.execute(
         self.formatSimpleNowAndPeriodQuery(
             oDb, 'SELECT TestBoxesWithStrings.*\n'
             'FROM   TestBoxesWithStrings\n'
             'WHERE  idTestBox    = %s\n', (idTestBox, ), tsNow,
             sPeriodBack))
     aoRow = oDb.fetchOne()
     if aoRow is None:
         raise TMRowNotFound(
             'idTestBox=%s not found (tsNow=%s sPeriodBack=%s)' % (
                 idTestBox,
                 tsNow,
                 sPeriodBack,
             ))
     return self.initFromDbRow(aoRow)
コード例 #7
0
ファイル: schedgroup.py プロジェクト: flamenca/virtualbox
    def initFromDbRow(self, aoRow):
        """
        Re-initializes the data with a row from a SELECT * FROM SchedGroupMembers.

        Returns self. Raises exception if the row is None or otherwise invalid.
        """

        if aoRow is None:
            raise TMRowNotFound('SchedGroupMember not found.');

        self.idSchedGroup        = aoRow[0];
        self.idTestGroup         = aoRow[1];
        self.tsEffective         = aoRow[2];
        self.tsExpire            = aoRow[3];
        self.uidAuthor           = aoRow[4];
        self.iSchedPriority      = aoRow[5];
        self.bmHourlySchedule    = aoRow[6]; ## @todo figure out how bitmaps are returned...
        self.idTestGroupPreReq   = aoRow[7];
        return self;
コード例 #8
0
    def initFromDbRow(self, aoRow):
        """
        Re-initializes the object from a SELECT * FROM Builds row.
        Returns self.  Raises exception if aoRow is None.
        """
        if aoRow is None:
            raise TMRowNotFound('Build not found.')

        self.idBuild = aoRow[0]
        self.tsCreated = aoRow[1]
        self.tsEffective = aoRow[2]
        self.tsExpire = aoRow[3]
        self.uidAuthor = aoRow[4]
        self.idBuildCategory = aoRow[5]
        self.iRevision = aoRow[6]
        self.sVersion = aoRow[7]
        self.sLogUrl = aoRow[8]
        self.sBinaries = aoRow[9]
        self.fBinariesDeleted = aoRow[10]
        return self
コード例 #9
0
    def initFromDbRow(self, aoRow):
        """
        Re-initializes the object from a SELECT * FROM TestCaseArgs row.
        Returns self.  Raises exception if aoRow is None.
        """
        if aoRow is None:
            raise TMRowNotFound('TestBoxStatus not found.')

        self.idTestCase = aoRow[0]
        self.idTestCaseArgs = aoRow[1]
        self.tsEffective = aoRow[2]
        self.tsExpire = aoRow[3]
        self.uidAuthor = aoRow[4]
        self.idGenTestCaseArgs = aoRow[5]
        self.sArgs = aoRow[6]
        self.cSecTimeout = aoRow[7]
        self.sTestBoxReqExpr = aoRow[8]
        self.sBuildReqExpr = aoRow[9]
        self.cGangMembers = aoRow[10]
        self.sSubName = aoRow[11]
        return self
コード例 #10
0
 def initFromDbWithId(self, oDb, idBuild, tsNow=None, sPeriodBack=None):
     """
     Reinitialize from database given a row ID.
     Returns self.  Raises exception on database error or if the ID is invalid.
     """
     oDb.execute(
         self.formatSimpleNowAndPeriodQuery(
             oDb, 'SELECT Builds.*, BuildCategories.*\n'
             'FROM   Builds, BuildCategories\n'
             'WHERE  idBuild = %s\n'
             '   AND Builds.idBuildCategory = BuildCategories.idBuildCategory\n',
             (idBuild, ), tsNow, sPeriodBack, 'Builds.'))
     aoRow = oDb.fetchOne()
     if aoRow is None:
         raise TMRowNotFound(
             'idBuild=%s not found (tsNow=%s sPeriodBack=%s)' % (
                 idBuild,
                 tsNow,
                 sPeriodBack,
             ))
     return self.initFromDbRow(aoRow)
コード例 #11
0
 def initFromDbWithId(self,
                      oDb,
                      idTestResult,
                      tsNow=None,
                      sPeriodBack=None):
     """
     Initialize the object from the database.
     """
     oDb.execute(
         self.formatSimpleNowAndPeriodQuery(
             oDb, 'SELECT *\n'
             'FROM   TestResultFailures\n'
             'WHERE  idTestResult = %s\n', (idTestResult, ), tsNow,
             sPeriodBack))
     aoRow = oDb.fetchOne()
     if aoRow is None:
         raise TMRowNotFound(
             'idTestResult=%s not found (tsNow=%s, sPeriodBack=%s)' %
             (idTestResult, tsNow, sPeriodBack))
     assert len(aoRow) == self.kcDbColumns
     return self.initFromDbRow(aoRow)
コード例 #12
0
    def initFromDbRow(self, aoRow):
        """
        Re-initializes the data with a row from a SELECT * FROM SchedGroups.

        Returns self. Raises exception if the row is None or otherwise invalid.
        """

        if aoRow is None:
            raise TMRowNotFound('SchedGroup not found.')

        self.idSchedGroup = aoRow[0]
        self.tsEffective = aoRow[1]
        self.tsExpire = aoRow[2]
        self.uidAuthor = aoRow[3]
        self.sName = aoRow[4]
        self.sDescription = aoRow[5]
        self.fEnabled = aoRow[6]
        self.enmScheduler = aoRow[7]
        self.idBuildSrc = aoRow[8]
        self.idBuildSrcTestSuite = aoRow[9]
        self.sComment = aoRow[10]
        return self
コード例 #13
0
    def initFromDbRow(self, aoRow):
        """
        Re-initializes the object from a SELECT * FROM BuildSources row.
        Returns self.  Raises exception if aoRow is None.
        """
        if aoRow is None:
            raise TMRowNotFound('Build source not found.')

        self.idBuildSrc = aoRow[0]
        self.tsEffective = aoRow[1]
        self.tsExpire = aoRow[2]
        self.uidAuthor = aoRow[3]
        self.sName = aoRow[4]
        self.sDescription = aoRow[5]
        self.sProduct = aoRow[6]
        self.sBranch = aoRow[7]
        self.asTypes = aoRow[8]
        self.asOsArches = aoRow[9]
        self.iFirstRevision = aoRow[10]
        self.iLastRevision = aoRow[11]
        self.cSecMaxAge = aoRow[12]
        return self
コード例 #14
0
    def initFromDbRow(self, aoRow):
        """
        Re-initializes the data with a row from a SELECT * FROM BuildBlacklist.

        Returns self. Raises exception if the row is None or otherwise invalid.
        """

        if aoRow is None:
            raise TMRowNotFound('Build Blacklist item not found.')

        self.idBlacklisting  = aoRow[0]
        self.tsEffective     = aoRow[1]
        self.tsExpire        = aoRow[2]
        self.uidAuthor       = aoRow[3]
        self.idFailureReason = aoRow[4]
        self.sProduct        = aoRow[5]
        self.sBranch         = aoRow[6]
        self.asTypes         = aoRow[7]
        self.asOsArches      = aoRow[8]
        self.iFirstRevision  = aoRow[9]
        self.iLastRevision   = aoRow[10]

        return self;