Method: Sequel::Dataset#each

Defined in:
lib/sequel/dataset/actions.rb

#eachObject

Iterates over the records in the dataset as they are yielded from the database adapter, and returns self.

DB[:table].each{|row| p row} # SELECT * FROM table

Note that this method is not safe to use on many adapters if you are running additional queries inside the provided block. If you are running queries inside the block, you should use all instead of each for the outer queries, or use a separate thread or shard inside each.



181
182
183
184
185
186
187
188
# File 'lib/sequel/dataset/actions.rb', line 181

def each
  if rp = row_proc
    fetch_rows(select_sql){|r| yield rp.call(r)}
  else
    fetch_rows(select_sql){|r| yield r}
  end
  self
end