'Yields connections which might contain data prefixed by path_prefix.'

@utils.Synchronized
def DatabasesByPath(self, path_prefix):

    dir_prefix = utils.JoinPath(self.root_path, path_prefix)
    shortened_path_prefix = path_prefix
    databases_found = set()
    while True:
        shortened_path = utils.JoinPath(self.root_path, shortened_path_prefix)
        if os.path.isdir(shortened_path):
            for db in self.DatabasesInDir(shortened_path):
                if (db in databases_found):
                    continue
                mod_db = db
                if (mod_db == utils.JoinPath(self.root_path, 'aff4')):
                    mod_db = self.root_path
                if (mod_db.startswith(dir_prefix) or dir_prefix.startswith(mod_db)):
                    databases_found.add(db)
                    (yield SqliteConnection((db + SQLITE_EXTENSION)))
        if (not shortened_path_prefix):
            break
        components = shortened_path_prefix.split(os.path.sep)
        shortened_path_prefix = utils.JoinPath(*components[:(-1)])
        if (shortened_path_prefix == '/'):
            shortened_path_prefix = ''
