Module: Kiss::SequelMySQLDataset

Defined in:
lib/kiss/ext/sequel_mysql_dataset.rb

Instance Method Summary collapse

Instance Method Details

#all_arrays(opts = nil, &block) ⇒ Object

Returns results from dataset query as array of arrays, instead of array of hashes.



5
6
7
8
9
10
# File 'lib/kiss/ext/sequel_mysql_dataset.rb', line 5

def all_arrays(opts = nil, &block)
  a = []
  fetch_arrays(select_sql()) {|r| a << r}
  a.each(&block) if block
  a
end

#fetch_arrays(sql) ⇒ Object

Fixes bug in Sequel 1.5; shouldn’t be needed for Sequel 2.x (need to double-check, however).



14
15
16
17
18
19
20
21
# File 'lib/kiss/ext/sequel_mysql_dataset.rb', line 14

def fetch_arrays(sql)
  execute(sql) do |r|
    while row = r.fetch_row
      yield row
    end
  end
  self
end