def iterAllTroves(self, withPins = False):
        cu = self.db.cursor()
        cu.execute("""
            SELECT troveName, version, timeStamps, flavor, pinned
                FROM Instances NATURAL JOIN Versions
                INNER JOIN Flavors
                    ON Instances.flavorid = Flavors.flavorid
            WHERE isPresent=1""")
        versionCache = VersionCache()
        flavorCache = FlavorCache()
        for (troveName, version, timeStamps, flavor, pinned) in cu:
            version = versionCache.get(version, timeStamps)
            flavor = flavorCache.get(flavor)
            nvf = TroveTuple(troveName, version, flavor)
            if withPins:
                yield nvf, (pinned != 0)
            else:
                yield nvf