'Get a list of containers sorted by name starting at marker onward, up
to limit entries. Entries will begin with the prefix and will not have
the delimiter after the prefix.
:param limit: maximum number of entries to get
:param marker: marker query
:param end_marker: end marker query
:param prefix: prefix query
:param delimiter: delimiter for query
:param reverse: reverse the result order.
:returns: list of tuples of (name, object_count, bytes_used,
put_timestamp, 0)'

def list_containers_iter(self, limit, marker, end_marker, prefix, delimiter, reverse=False):

    delim_force_gte = False
    (marker, end_marker, prefix, delimiter) = utf8encode(marker, end_marker, prefix, delimiter)
    if reverse:
        (marker, end_marker) = (end_marker, marker)
    self._commit_puts_stale_ok()
    if (delimiter and (not prefix)):
        prefix = ''
    if prefix:
        end_prefix = (prefix[:(-1)] + chr((ord(prefix[(-1)]) + 1)))
    orig_marker = marker
    with self.get() as conn:
        results = []
        while (len(results) < limit):
            query = '\n                                                                                SELECT    name,    object_count,    bytes_used,    put_timestamp,    0\n                                                                                FROM    container\n                                                                                WHERE    '
            query_args = []
            if (end_marker and ((not prefix) or (end_marker < end_prefix))):
                query += '    name    <    ?    AND'
                query_args.append(end_marker)
            elif prefix:
                query += '    name    <    ?    AND'
                query_args.append(end_prefix)
            if delim_force_gte:
                query += '    name    >=    ?    AND'
                query_args.append(marker)
                delim_force_gte = False
            elif (marker and (marker >= prefix)):
                query += '    name    >    ?    AND'
                query_args.append(marker)
            elif prefix:
                query += '    name    >=    ?    AND'
                query_args.append(prefix)
            if (self.get_db_version(conn) < 1):
                query += '    +deleted    =    0'
            else:
                query += '    deleted    =    0'
            query += ('    ORDER    BY    name    %s    LIMIT    ?' % ('DESC' if reverse else ''))
            query_args.append((limit - len(results)))
            curs = conn.execute(query, query_args)
            curs.row_factory = None
            if ((prefix is None) or (not delimiter)):
                return [r for r in curs]
            rowcount = 0
            for row in curs:
                rowcount += 1
                name = row[0]
                if reverse:
                    end_marker = name
                else:
                    marker = name
                if (len(results) >= limit):
                    curs.close()
                    return results
                end = name.find(delimiter, len(prefix))
                if (end > 0):
                    if reverse:
                        end_marker = name[:(end + 1)]
                    else:
                        marker = (name[:end] + chr((ord(delimiter) + 1)))
                        delim_force_gte = True
                    dir_name = name[:(end + 1)]
                    if (dir_name != orig_marker):
                        results.append([dir_name, 0, 0, '0', 1])
                    curs.close()
                    break
                results.append(row)
            if (not rowcount):
                break
        return results
