Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Get the rows, handling any offset and/or limit stipulated
- if scrollableCursor then
- rRows = nil
- # scrollableCursor == true => offset > 0
- if stmt.fetch_scroll(ODBC::SQL_FETCH_ABSOLUTE, offset)
- rRows = limit > 0 ? stmt.fetch_many(limit) : stmt.fetch_all
- end
- else
- rRows = limit > 0 ? stmt.fetch_many(offset + limit) : stmt.fetch_all
- # Enforce OFFSET
- if offset > 0 then
- if rRows && rRows.length > offset then
- rRows.slice!(0, offset)
- else
- rRows = nil
- end
- end
- # Enforce LIMIT
- if limit > 0 && rRows && rRows.length > limit then
- rRows.slice!(limit..(rRows.length-1))
- end
- end
Add Comment
Please, Sign In to add comment