# File lib/rubyrep/proxy_connection.rb, line 39
    def next?
      unless self.rows
        # Try to load some records
        
        if options[:query] and last_row != nil
          # A query was directly specified and all it's rows were returned
          # ==> Finished.
          return false
        end

        if options[:query]
          # If a query has been directly specified, just directly execute it
          query = options[:query]
        else
          # Otherwise build the query
          if last_row
            # There was a previous batch.
            # Next batch will start after the last returned row
            options.merge! :from => last_row, :exclude_starting_row => true
          end

          query = connection.table_select_query(options[:table], options)

          if options[:row_buffer_size]
            # Set the batch size
            query += " limit #{options[:row_buffer_size]}"
          end
        end

        self.rows = connection.select_all query
        self.current_row_index = 0
      end
      self.current_row_index < self.rows.size
    end