class Tkrzw::Iterator

Iterator for each record. An iterator is made by the “make_iterator” method of DBM. Every unused iterator object should be destructed explicitly by the “destruct” method to free resources.

Public Class Methods

new(dbm) click to toggle source

Initializes the iterator.

  • @param dbm The database to scan.

# File tkrzw.rb, line 733
def initialize(dbm)
  # (native code)
end

Public Instance Methods

destruct() click to toggle source

Releases the resource explicitly.

# File tkrzw.rb, line 738
def destruct()
  # (native code)
end
first() click to toggle source

Initializes the iterator to indicate the first record.

  • @return The result status.

Even if there's no record, the operation doesn't fail.

# File tkrzw.rb, line 745
def first()
  # (native code)
end
get(status=nil) click to toggle source

Gets the key and the value of the current record of the iterator.

  • @param status A status object to which the result status is assigned. It can be omitted.

  • @return A tuple of The key and the value of the current record. On failure, nil is returned.

# File tkrzw.rb, line 799
def get(status=nil)
  # (native code)
end
get_key(status=nil) click to toggle source

Gets the key of the current record.

  • @param status A status object to which the result status is assigned. It can be omitted.

  • @return The key of the current record or nil on failure.

# File tkrzw.rb, line 806
def get_key(status=nil)
  # (native code)
end
get_value(status=nil) click to toggle source

Gets the value of the current record.

  • @param status A status object to which the result status is assigned. It can be omitted.

  • @return The value of the current record or nil on failure.

# File tkrzw.rb, line 813
def get_value(status=nil)
  # (native code)
end
inspect() click to toggle source

Returns a string representation of the object.

  • @return The string representation of the object.

# File tkrzw.rb, line 845
def inspect()
  # (native code)
end
jump(key) click to toggle source

Initializes the iterator to indicate a specific record.

  • @param key The key of the record to look for.

  • @return The result status.

Ordered databases can support “lower bound” jump; If there's no record with the same key, the iterator refers to the first record whose key is greater than the given key. The operation fails with unordered databases if there's no record with the same key.

# File tkrzw.rb, line 760
def jump(key)
  # (native code)
end
jump_lower(key, inclusive=false) click to toggle source

Initializes the iterator to indicate the last record whose key is lower than a given key.

  • @param key The key to compare with.

  • @param inclusive If true, the considtion is inclusive: equal to or lower than the key.

  • @return The result status.

Even if there's no matching record, the operation doesn't fail. This method is suppoerted only by ordered databases.

# File tkrzw.rb, line 769
def jump_lower(key, inclusive=false)
  # (native code)
end
jump_upper(key, inclusive=false) click to toggle source

Initializes the iterator to indicate the first record whose key is upper than a given key.

  • @param key The key to compare with.

  • @param inclusive If true, the considtion is inclusive: equal to or upper than the key.

  • @return The result status.

Even if there's no matching record, the operation doesn't fail. This method is suppoerted only by ordered databases.

# File tkrzw.rb, line 778
def jump_upper(key, inclusive=false)
  # (native code)
end
last() click to toggle source

Initializes the iterator to indicate the last record.

  • @return The result status.

Even if there's no record, the operation doesn't fail. This method is suppoerted only by ordered databases.

# File tkrzw.rb, line 752
def last()
  # (native code)
end
next() click to toggle source

Moves the iterator to the next record.

  • @return The result status.

If the current record is missing, the operation fails. Even if there's no next record, the operation doesn't fail.

# File tkrzw.rb, line 785
def next()
  # (native code)
end
previous() click to toggle source

Moves the iterator to the previous record.

  • @return The result status.

If the current record is missing, the operation fails. Even if there's no previous record, the operation doesn't fail. This method is suppoerted only by ordered databases.

# File tkrzw.rb, line 792
def previous()
  # (native code)
end
remove() click to toggle source

Removes the current record.

  • @return The result status.

# File tkrzw.rb, line 826
def remove()
  # (native code)
end
set(value) click to toggle source

Sets the value of the current record.

  • @param value The value of the record.

  • @return The result status.

# File tkrzw.rb, line 820
def set(value)
  # (native code)
end
step(status=nil) click to toggle source

Gets the current record and moves the iterator to the next record.

  • @param status A status object to which the result status is assigned. It can be omitted.

  • @return A tuple of The key and the value of the current record. On failure, nil is returned.

# File tkrzw.rb, line 833
def step(status=nil)
  # (native code)
end
to_s() click to toggle source

Returns a string representation of the content.

  • @return The string representation of the content.

# File tkrzw.rb, line 839
def to_s()
  # (native code)
end