def fetch_scroll(direction, offset=1)
fetch_row = case direction
when DBI::SQL_FETCH_NEXT then @row_index
when DBI::SQL_FETCH_PRIOR then @row_index-2
when DBI::SQL_FETCH_FIRST then 0
when DBI::SQL_FETCH_LAST then @row_count-1
when DBI::SQL_FETCH_ABSOLUTE then offset
when DBI::SQL_FETCH_RELATIVE then @row_index+offset-1
end
row = nil
if fetch_row > -1 and fetch_row < @row_count
row = @handle.getRow(fetch_row)
end
@row_index = fetch_row + 1
if @row_index < 0 then
@row_index = 0
elsif @row_index > @row_count
@row_index = @row_count
end
return row
end