Exemplo n.º 1
0
    def validateMDB(self):

        self.db.dbfile.seek(0)

        i = 0
        while self.db.dbfile.tell() < self.db.dbfilesize:
            buf = self.db.dbfile.read(self.db.dbpagesize)

            type = ord(buf[0])

            if type in MDBValidatorMarkers.DBPAGEINDEX:
                self.updatecount(type)

                if type == MDBValidatorMarkers.DBDATAPAGE:
                    self.mdbDP = MDBDataPageValidator(self.db.dbversion)
                    self.mdbDP.handleMDBDataPage(buf)

                    if self.mdbDP.versionset == True:
                        self.versionno = self.mdbDP.versionno
                        self.buildno = self.mdbDP.buildno

                elif type == MDBValidatorMarkers.DBTABLEDEFINITION:

                    if i == MDBValidatorMarkers.MSYSOBJECTSPAGE:  # want MSysObjects #from design view
                        self.mdbTDEF = MDBTableDefinitionValidator(
                        )  # definitions table 2nd page of DB
                        self.mdbTDEF.handleMDBTableDefinition(buf)

                #TODO:
                #if type == MDBValidatorMarkers.DBDEFINITION:
                #elif type == MDBValidatorMarkers.DBINTERINDEXPAGE:
                #elif type == MDBValidatorMarkers.DBLEAFINDEXPAGE:
                #elif type == MDBValidatorMarkers.DBPAGEUSAGEBMP:
                #elif type == MDBValidatorMarkers.DBPAGENOID:

            else:
                self.updatecount(-1)

            i += 1

        # Write to stdout...
        #self.db.outputObjectData()
        self.outputObjectData()