def fetch_all
rows = []
@state.fetch_all.each do |raw_row|
row = {}
raw_row.each_with_index do |value, index|
column = @state.column_names[index]
attr = nil
@attributes_to_fetch.each do |_attr|
if _attr.column_name == column then
attr = _attr
end
end
model = @adapter_context.adapter.model
if model and attr then
encoding = model.connection['encoding']
row[attr.name] = attr.new_value(value, encoding)
elsif attr then
row[attr.name] = attr.new_value(value)
else
row[column] = value
end
end
rows << row
end
rows
end