Class: Informix::ScrollCursor
- Inherits:
-
SequentialCursor
- Object
- CursorBase
- SequentialCursor
- Informix::ScrollCursor
- Defined in:
- lib/informix/scrollcursor.rb,
ext/informixc.c
Instance Method Summary collapse
-
#current ⇒ Object
Returns the current record of the cursor.
-
#current! ⇒ Object
Returns the current record of the cursor.
-
#current_hash ⇒ Object
Returns the current record of the cursor.
-
#current_hash! ⇒ Object
Returns the current record of the cursor.
-
#first ⇒ Object
Returns the first record of the cursor.
-
#first! ⇒ Object
Returns the first record of the cursor.
-
#first_hash ⇒ Object
Returns the first record of the cursor.
-
#first_hash! ⇒ Object
Returns the first record of the cursor.
-
#last ⇒ Object
Returns the last record of the cursor.
-
#last! ⇒ Object
Returns the last record of the cursor.
-
#last_hash ⇒ Object
Returns the last record of the cursor.
-
#last_hash! ⇒ Object
Returns the last record of the cursor.
-
#next(offset = 1) ⇒ Object
Returns the next offset th record.
-
#next!(offset = 1) ⇒ Object
Returns the next offset th record.
-
#next_hash(offset = 1) ⇒ Object
Returns the next offset th record.
-
#next_hash!(offset = 1) ⇒ Object
Returns the next offset th record.
-
#prev(offset = 1) ⇒ Object
Returns the previous offset th record.
-
#prev!(offset = 1) ⇒ Object
Returns the previous offset th record.
-
#prev_hash(offset = 1) ⇒ Object
Returns the previous offset th record.
-
#prev_hash!(offset = 1) ⇒ Object
Returns the previous offset th record.
-
#slice(*args) ⇒ Object
(also: #[])
Returns the record at index, or returns a subarray starting at start and continuing for length records.
-
#slice!(index) ⇒ Object
Returns the record at index.
-
#slice_hash(*args) ⇒ Object
Returns the record at index, or returns a subarray starting at start and continuing for length records.
-
#slice_hash!(index) ⇒ Object
Returns the record at index.
Methods inherited from SequentialCursor
#each, #each!, #each_by, #each_hash, #each_hash!, #each_hash_by, #fetch, #fetch!, #fetch_all, #fetch_hash, #fetch_hash!, #fetch_hash_all, #fetch_hash_many, #fetch_many
Methods inherited from CursorBase
Instance Method Details
#current ⇒ Object
Returns the current record of the cursor. If the cursor is empty, returns nil.
cursor.current => array or nil
252 253 254 |
# File 'lib/informix/scrollcursor.rb', line 252 def current entry(nil, Array, false) end |
#current! ⇒ Object
Returns the current record of the cursor. If the cursor is empty, returns nil.
Stores the record fetched always in the same Array object.
cursor.current! => array or nil
262 263 264 |
# File 'lib/informix/scrollcursor.rb', line 262 def current! entry(nil, Array, true) end |
#current_hash ⇒ Object
Returns the current record of the cursor. If the cursor is empty, returns nil.
cursor.current_hash => hash or nil
270 271 272 |
# File 'lib/informix/scrollcursor.rb', line 270 def current_hash entry(nil, Hash, false) end |
#current_hash! ⇒ Object
Returns the current record of the cursor. If the cursor is empty, returns nil.
Stores the record fetched always in the same Hash object.
cursor.current_hash! => hash or nil
280 281 282 |
# File 'lib/informix/scrollcursor.rb', line 280 def current_hash! entry(nil, Hash, true) end |
#first ⇒ Object
Returns the first record of the cursor. If the cursor is empty, returns nil.
cursor.first => array or nil
180 181 182 |
# File 'lib/informix/scrollcursor.rb', line 180 def first entry(0, Array, false) end |
#first! ⇒ Object
Returns the first record of the cursor. If the cursor is empty, returns nil.
Stores the record fetched always in the same Array object.
cursor.first! => array or nil
190 191 192 |
# File 'lib/informix/scrollcursor.rb', line 190 def first! entry(0, Array, true) end |
#first_hash ⇒ Object
Returns the first record of the cursor. If the cursor is empty, returns nil.
cursor.first_hash => hash or nil
198 199 200 |
# File 'lib/informix/scrollcursor.rb', line 198 def first_hash entry(0, Hash, false) end |
#first_hash! ⇒ Object
Returns the first record of the cursor. If the cursor is empty, returns nil.
Stores the record fetched always in the same Hash object.
cursor.first_hash! => hash or nil
208 209 210 |
# File 'lib/informix/scrollcursor.rb', line 208 def first_hash! entry(0, Hash, true) end |
#last ⇒ Object
Returns the last record of the cursor. If the cursor is empty, returns nil.
cursor.last => array or nil
216 217 218 |
# File 'lib/informix/scrollcursor.rb', line 216 def last entry(-1, Array, false) end |
#last! ⇒ Object
Returns the last record of the cursor. If the cursor is empty, returns nil.
Stores the record fetched always in the same Array object.
cursor.last! => array or nil
226 227 228 |
# File 'lib/informix/scrollcursor.rb', line 226 def last! entry(-1, Array, true) end |
#last_hash ⇒ Object
Returns the last record of the cursor. If the cursor is empty, returns nil.
cursor.last_hash => hash or nil
234 235 236 |
# File 'lib/informix/scrollcursor.rb', line 234 def last_hash entry(-1, Hash, false) end |
#last_hash! ⇒ Object
Returns the last record of the cursor. If the cursor is empty, returns nil.
Stores the record fetched always in the same Hash object.
cursor.last_hash! => hash or nil
244 245 246 |
# File 'lib/informix/scrollcursor.rb', line 244 def last_hash! entry(-1, Hash, true) end |
#next(offset = 1) ⇒ Object
Returns the next offset th record. Negative indices count backward from the current position. Returns nil if the offset is out of range.
cursor.next(offset = 1) => array or nil
143 144 145 |
# File 'lib/informix/scrollcursor.rb', line 143 def next(offset = 1) rel(offset, Array, false) end |
#next!(offset = 1) ⇒ Object
Returns the next offset th record. Negative indices count backward from the current position. Returns nil if the offset is out of range.
Stores the record fetched always in the same Array object.
cursor.next!(offset = 1) => array or nil
154 155 156 |
# File 'lib/informix/scrollcursor.rb', line 154 def next!(offset = 1) rel(offset, Array, true) end |
#next_hash(offset = 1) ⇒ Object
Returns the next offset th record. Negative indices count backward from the current position. Returns nil if the offset is out of range.
cursor.next_hash(offset = 1) => hash or nil
163 164 165 |
# File 'lib/informix/scrollcursor.rb', line 163 def next_hash(offset = 1) rel(offset, Hash, false) end |
#next_hash!(offset = 1) ⇒ Object
Returns the next offset th record. Negative indices count backward from the current position. Returns nil if the offset is out of range.
cursor.next_hash!(offset = 1) => hash or nil
172 173 174 |
# File 'lib/informix/scrollcursor.rb', line 172 def next_hash!(offset = 1) rel(offset, Hash, true) end |
#prev(offset = 1) ⇒ Object
Returns the previous offset th record. Negative indices count forward from the current position. Returns nil if the offset is out of range.
cursor.prev(offset = 1) => array or nil
103 104 105 |
# File 'lib/informix/scrollcursor.rb', line 103 def prev(offset = 1) rel(-offset, Array, false) end |
#prev!(offset = 1) ⇒ Object
Returns the previous offset th record. Negative indices count forward from the current position. Returns nil if the offset is out of range.
Stores the record fetched always in the same Array object.
cursor.prev!(offset = 1) => array or nil
114 115 116 |
# File 'lib/informix/scrollcursor.rb', line 114 def prev!(offset = 1) rel(-offset, Array, true) end |
#prev_hash(offset = 1) ⇒ Object
Returns the previous offset th record. Negative indices count forward from the current position. Returns nil if the offset is out of range.
cursor.prev_hash(offset = 1) => hash or nil
123 124 125 |
# File 'lib/informix/scrollcursor.rb', line 123 def prev_hash(offset = 1) rel(-offset, Hash, false) end |
#prev_hash!(offset = 1) ⇒ Object
Returns the previous offset th record. Negative indices count forward from the current position. Returns nil if the offset is out of range.
Stores the record fetched always in the same Hash object.
cursor.prev_hash!(offset = 1) => hash or nil
134 135 136 |
# File 'lib/informix/scrollcursor.rb', line 134 def prev_hash!(offset = 1) rel(-offset, Hash, true) end |
#slice(*args) ⇒ Object Also known as: []
Returns the record at index, or returns a subarray starting at start and continuing for length records. Negative indices count backward from the end of the cursor (-1 is the last element). Returns nil if the (starting) index is out of range.
Warning: if the (starting) index is negative and out of range, the position in the cursor is set to the last record. Otherwise the current position in the cursor is preserved.
cursor[index] => array or nil
cursor[start, length] => array or nil
cursor.slice(index) => array or nil
cursor.slice(start, length) => array or nil
47 48 49 |
# File 'lib/informix/scrollcursor.rb', line 47 def slice(*args) slice0(args, Array) end |
#slice!(index) ⇒ Object
Returns the record at index. Negative indices count backward from the end of the cursor (-1 is the last element). Returns nil if the index is out of range.
Stores the record fetched always in the same Array object.
Warning: if the index is negative and out of range, the position in the cursor is set to the last record. Otherwise the current position in the cursor is preserved.
cursor.slice!(index) => array or nil
64 65 66 |
# File 'lib/informix/scrollcursor.rb', line 64 def slice!(index) entry(index, Array, true) end |
#slice_hash(*args) ⇒ Object
Returns the record at index, or returns a subarray starting at start and continuing for length records. Negative indices count backward from the end of the cursor (-1 is the last element). Returns nil if the (starting) index is out of range.
Warning: if the (starting) index is negative and out of range, the position in the cursor is set to the last record. Otherwise the current position in the cursor is preserved.
cursor.slice_hash(index) => hash or nil
cursor.slice_hash(start, length) => array or nil
79 80 81 |
# File 'lib/informix/scrollcursor.rb', line 79 def slice_hash(*args) slice0(args, Hash) end |
#slice_hash!(index) ⇒ Object
Returns the record at index. Negative indices count backward from the end of the cursor (-1 is the last element). Returns nil if the index is out of range.
Stores the record fetched always in the same Hash object.
Warning: if the index is negative and out of range, the position in the cursor is set to the last record. Otherwise the current position in the cursor is preserved.
cursor.slice_hash!(index) => hash or nil
94 95 96 |
# File 'lib/informix/scrollcursor.rb', line 94 def slice_hash!(index) entry(index, Hash, true) end |