def markUserReplacedFiles(self, userReplaced):
        cu = self.db.cursor()
        cu.execute("""CREATE TEMPORARY TABLE UserReplaced(
                        name STRING, version STRING, flavor STRING,
                        pathId BLOB)""")
        for (name, version, flavor), fileList in userReplaced.iteritems():
            for pathId, content, fileObj in fileList:
                flavorStr = flavor.freeze()
                if not flavorStr:
                    flavorStr = None

                cu.execute("""
                    INSERT INTO UserReplaced(name, version, flavor, pathId)
                        VALUES (?, ?, ?, ?)
                """, name, version.asString(), flavorStr, pathId)

        cu.execute("""
            UPDATE DBTroveFiles SET isPresent = 0 WHERE
                rowId IN (SELECT DBTroveFiles.rowId FROM UserReplaced
                    JOIN Versions ON
                        UserReplaced.version = Versions.version
                    JOIN Flavors ON
                        UserReplaced.flavor = Flavors.flavor OR
                        (UserReplaced.flavor IS NULL AND
                         Flavors.flavor IS NULL)
                    JOIN Instances ON
                        Instances.troveName = UserReplaced.name AND
                        Instances.versionId = versions.versionId AND
                        Instances.flavorId = flavors.flavorId
                    JOIN DBTroveFiles ON
                        DBTroveFiles.instanceId = Instances.instanceId AND
                        DBTroveFiles.pathId = UserReplaced.pathId)
        """)

        cu.execute("DROP TABLE UserReplaced")