# File lib/aws/simple_db/item_collection.rb, line 422
      def perform_select(options = {})

        next_token = options[:next_token]
        batch_size = options[:batch_size] ? Integer(options[:batch_size]) : nil
        total = 0
        
        begin

          # if the user provided a batch size we need to rewrite the
          # select expression's LIMIT clause.  
          if batch_size
            max = limit ? [limit - total, batch_size].min : batch_size
          else
            max = nil
          end

          response = select_request(options, next_token, max)

          yield(response)

          next_token = response.next_token

          total += response.items.size

        end while next_token && (limit.nil? || total < limit)
      end