jnicli
Interface Cursor

All Known Implementing Classes:
PrefetchedCursor

public interface Cursor

Iterator through result set returned by Database.select. There are two types of cursors: incremental and prefetched. Incremental cursor fetch records on demand (one record at each iteration). And prefetched cursor loads all selected records. Prefetched cursor is used in case of remote database connections and when AUTOCOMMIT flag is set in select


Method Summary
 long getOid()
          Get OID of the current object.
 boolean hasMoreElements()
          Tests if this enumeration contains more elements.
 java.lang.Object nextElement()
          Returns the next element of this enumeration if this enumeration object has at least one more element to provide.
 int size()
          Get number of selected records
 void update()
          Update current object.
 

Method Detail

hasMoreElements

public boolean hasMoreElements()
Tests if this enumeration contains more elements.

Returns:
true if and only if this enumeration object contains at least one more element to provide; false otherwise.

nextElement

public java.lang.Object nextElement()
Returns the next element of this enumeration if this enumeration object has at least one more element to provide.

Returns:
the next element of this enumeration.
Throws:
NoSuchElementException - if no more elements exist.

getOid

public long getOid()
Get OID of the current object. This method should be used only after Enumeration.nextElement() method and its result is OID of the object returned by nextElement().

Throws:
java.util.NoSuchElementException - if there is no current element

update

public void update()
Update current object. This method should be invoked after Enumeration.nextElement() and store updated object, returned by nextElement(). This method is not supported for prefetched cursor (which is returned for remote database or when AUTOCOMMIT flag is set in select). In this case you should use Database.update method specifying OID of updated object. This OID can be obtained using Cursor.getOid() method.

Throws:
java.util.NoSuchElementException - if there is no current element

size

public int size()
Get number of selected records