def record(offset)
return nil unless offset
return infimum if offset == pos_infimum
return supremum if offset == pos_supremum
cursor(offset).forward.name("record[#{offset}]") do |c|
header = c.peek { record_header(c) }
this_record = {
:format => page_header[:format],
:offset => offset,
:header => header,
:next => header[:next] == 0 ? nil : (header[:next]),
}
if record_format
this_record[:type] = record_format[:type]
fmap = [:key, :row, :sys].inject({}) do |h, k|
this_record[k] = []
record_format[k].each { |f| h[f.position] = k }
h
end
record_fields.each do |f|
p = fmap[f.position]
c.name("#{p.to_s}[#{f.name}]") do
this_record[p] << {
:name => f.name,
:type => f.data_type.name,
:value => f.value(c, this_record),
:extern => f.extern(c, this_record),
}.reject { |k, v| v.nil? }
end
end
if level > 0
this_record[:child_page_number] =
c.name("child_page_number") { c.get_uint32 }
end
this_record[:length] = c.position - offset
this_record[:sys].each do |f|
case f[:name]
when "DB_TRX_ID"
this_record[:transaction_id] = f[:value]
when "DB_ROLL_PTR"
this_record[:roll_pointer] = f[:value]
end
end
end
Innodb::Record.new(self, this_record)
end
end