JDBaccess API 1.0

com.jdbaccess.da
Interface Result


public interface Result

A result is returned by execution of a select object. There is a one to one relationship between select and result. If you end a select also the result is closed and if you close a result also its select is ended. Normally a result is of type Row which means that all elements are of type Row. A result automatically fetches result set meta data such as sql type, precision and scale and uses it to fill the result elements (row objects or data access objects) accordingly.


Method Summary
 void close()
          You close a result automatically when you end the select of this result.
 java.util.ArrayList getAllElements()
          Get all the elements of the result.
 java.util.ArrayList getFields()
          This method delivers all fields (with type, sqlType, scale, precision etc.) as an Arraylist for that select.
 TransferObject getFirstElement()
          Get the first elements of the result.
 TransferObject getNextElement()
          Get the next element of the result from actual position forward.
 java.util.ArrayList getNextElements()
          Get the next elements of the result from actual position forward as the page size is defined.
 java.util.ArrayList getNextElements(long count)
          Get the next "count" elements of the result from actual position forward.
 long getPosition()
          Get the actual position of the result
 java.util.ArrayList getPreviousElements()
          Get the previous elements of the result from actual position backward as the page size is defined.
 java.lang.Long getSize()
          You call this method here or on the select which belongs to this result.
 boolean isEmpty()
           
 void setPageSize(int pageSize)
          Set the page size of the result.
 void setPosition(long pos)
          Set the actual position of the result
 void setReadLobsFull(boolean readLobsFull)
          if true, all lob fields are read completely from the database tables, else lob fields are read only to a default size because of performance reasons
 

Method Detail

close

void close()
           throws ApplicationException
You close a result automatically when you end the select of this result. Then the underlying open cursor in database will be closed. In database systems there is normally a maximum size of open cursors for one database connection (e.g. 1000). But you can call this method explicitly if you are not sure if you end that select.

Throws:
ApplicationException

getNextElement

TransferObject getNextElement()
                              throws ApplicationException
Get the next element of the result from actual position forward.

Returns:
the next element from position forward, null if there is no more element
Throws:
ApplicationException

getNextElements

java.util.ArrayList getNextElements()
                                    throws ApplicationException
Get the next elements of the result from actual position forward as the page size is defined.

Returns:
next elements from actual position forward as page size is defined (default page size is 100). E.g. if page size is 100 and position is 200 it get the elements from position 200 to 300
Throws:
ApplicationException

getNextElements

java.util.ArrayList getNextElements(long count)
                                    throws ApplicationException
Get the next "count" elements of the result from actual position forward.

Parameters:
count - number of elements which should be fetched
Returns:
next "count" elements from actual position forward.
Throws:
ApplicationException

getPreviousElements

java.util.ArrayList getPreviousElements()
                                        throws ApplicationException
Get the previous elements of the result from actual position backward as the page size is defined.

Returns:
previous elements from actual position backward as page size is defined (default page size is 100). E.g. if page size is 100 and position is 200 it get the elements from position 0 to 100
Throws:
ApplicationException

getAllElements

java.util.ArrayList getAllElements()
                                   throws ApplicationException
Get all the elements of the result. After this operation the size of the result is calculated so that a later call of getSize() is more performant. Be carefull: Do not call this method if the result size is very big because of performance and RAM consumption. After this operation the position of this result is at last position.

Returns:
all elements from first position to last position.
Throws:
ApplicationException

getFirstElement

TransferObject getFirstElement()
                               throws ApplicationException
Get the first elements of the result.

Returns:
first element of the result, null if result contains no element
Throws:
ApplicationException

getSize

java.lang.Long getSize()
                       throws ApplicationException
You call this method here or on the select which belongs to this result. This method is performance optimized: A "select count(*)" for the select of this result is done. Too gain further performance you can define countSelects on your select with setSqlCount. If this is set, this count sql string is executed.

Returns:
size of this result
Throws:
ApplicationException

isEmpty

boolean isEmpty()
                throws ApplicationException
Returns:
true if result contains no elements else false
Throws:
ApplicationException

setPosition

void setPosition(long pos)
                 throws ApplicationException
Set the actual position of the result

Parameters:
pos - position in result (0 == beforeFirst, 1 == first, 2 == second, ..., size == last)
Throws:
ApplicationException

getPosition

long getPosition()
Get the actual position of the result

Returns:
position in result (0 == beforeFirst, 1 == first, 2 == second, ..., size == last)

setPageSize

void setPageSize(int pageSize)
Set the page size of the result. The page size is used in "getNextElements()" and "getPreviousElements()". If no page size is set the default the page size is used.

Parameters:
pageSize - page size of the result

setReadLobsFull

void setReadLobsFull(boolean readLobsFull)
if true, all lob fields are read completely from the database tables, else lob fields are read only to a default size because of performance reasons

Parameters:
readLobsFull -

getFields

java.util.ArrayList getFields()
This method delivers all fields (with type, sqlType, scale, precision etc.) as an Arraylist for that select.

Returns:
ArrayList of fields of type Field

JDBaccess API 1.0

Copyright © 2005-2006 JDBaccess.com, Königsweg 210, D-14129 Berlin, Germany. All Rights Reserved.