org.dbforms.config
Class ResultSetVector

java.lang.Object
  extended by org.dbforms.config.ResultSetVector
All Implemented Interfaces:
Serializable

public class ResultSetVector
extends Object
implements Serializable

In version 0.5, this class held the actual data of a ResultSet (SELECT from a table). The main weakness of this class was that it used too much memory and processor time:

since version 0.7 DbForms queries only those record from the database the user really wants to see. this way you can query from a table with millions of records and you will still have no memory problems, [exception: you choose count="" in DbForms-tag :=) -> see org.dbforms.taglib.DbFormTag]

Author:
Joe Peer
See Also:
Serialized Form

Constructor Summary
ResultSetVector()
          Creates a new, empty ResultSetVector object.
ResultSetVector(Table table)
          Creates a new ResultSetVector object with the given FieldList
ResultSetVector(Table table, Vector selectedFields)
          Creates a new ResultSetVector object.
 
Method Summary
 void addResultSet(DbEventInterceptorData interceptorData, ResultSet rs)
          DOCUMENT ME!
 void addRow(DbEventInterceptorData interceptorData, Object[] objectRow)
          adds a row to the ResultSetVector
 void flip()
          DOCUMENT ME!
 Object getAttribute(String key)
          reads a value from the attributes list
 Map getAttributes()
          DOCUMENT ME!
 String[] getCurrentRow()
          DOCUMENT ME!
 FieldValues getCurrentRowAsFieldValues()
          DOCUMENT ME!
 Map getCurrentRowAsMap()
          DOCUMENT ME!
 Object[] getCurrentRowAsObjects()
          DOCUMENT ME!
 String getField(int i)
          returns the fieldValues String representation given by index i
 String getField(String fieldName)
          returns the fieldValues string representation given by it's name
 Object getFieldAsObject(int i)
          returns the fieldValues Object given by index i
 Object getFieldAsObject(int row, int i)
          returns the fieldValues Object given by row row and index i
 Object getFieldAsObject(int row, String fieldName)
          returns the fieldValues Object given by row row and fieldName
 Object getFieldAsObject(String fieldName)
          returns the fieldValues Object given by it's name
 Field getFieldDescription(String fieldName)
          gets the Field object to a given fieldName
 int getFieldIndex(String fieldName)
          returns the index of a given fieldName
 String getTableName()
           
 boolean isFirst()
          Return true if the current record is the first record
 boolean isFirstPage()
          DOCUMENT ME!
 boolean isLast()
          Return true if the current record is the last record
 boolean isLastPage()
          DOCUMENT ME!
static boolean isNull(ResultSetVector rsv)
          Checks if the given ResultSetVector is null
 void moveFirst()
          moves to the first record
 void moveLast()
          moves to the last record
 boolean moveNext()
          moves to the next record
 boolean movePrevious()
          moves to the previous record
 void setAttribute(String key, Object value)
          Stores a value in the attributes list
 void setFieldAsObject(int row, int i, Object obj)
          sets the fieldValue Object given by row row and index i
 void setFieldAsObject(int row, String fieldName, Object obj)
          sets the fieldValue Object given by row row and fieldName
 void setFirstPage(boolean b)
          DOCUMENT ME!
 void setLastPage(boolean b)
          DOCUMENT ME!
 int size()
          implements size()
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResultSetVector

public ResultSetVector()
Creates a new, empty ResultSetVector object.


ResultSetVector

public ResultSetVector(Table table)
Creates a new ResultSetVector object with the given FieldList

Parameters:
table - The FieldList to use

ResultSetVector

public ResultSetVector(Table table,
                       Vector selectedFields)
Creates a new ResultSetVector object.

Parameters:
table - DOCUMENT ME!
selectedFields - DOCUMENT ME!
Method Detail

isNull

public static final boolean isNull(ResultSetVector rsv)
Checks if the given ResultSetVector is null

Parameters:
rsv - ResultSetVector to check
Returns:
true if ResultSetVector is null

setAttribute

public void setAttribute(String key,
                         Object value)
Stores a value in the attributes list

Parameters:
key - key for the value
value - value to store

getAttribute

public Object getAttribute(String key)
reads a value from the attributes list

Parameters:
key - key to read
Returns:
The value. If not found null

getAttributes

public Map getAttributes()
DOCUMENT ME!

Returns:
Returns the attributes.

getTableName

public String getTableName()

getCurrentRow

public String[] getCurrentRow()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getCurrentRowAsFieldValues

public FieldValues getCurrentRowAsFieldValues()
DOCUMENT ME!

Returns:
DOCUMENT ME!
Throws:
IllegalArgumentException - DOCUMENT ME!

getCurrentRowAsMap

public Map getCurrentRowAsMap()
DOCUMENT ME!

Returns:
DOCUMENT ME!
Throws:
IllegalArgumentException - DOCUMENT ME!

getCurrentRowAsObjects

public Object[] getCurrentRowAsObjects()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getField

public String getField(int i)
returns the fieldValues String representation given by index i

Parameters:
i - Index into the objectArray
Returns:
the object

getField

public String getField(String fieldName)
returns the fieldValues string representation given by it's name

Parameters:
fieldName - name of the field
Returns:
the object

getFieldAsObject

public Object getFieldAsObject(int i)
returns the fieldValues Object given by index i

Parameters:
i - Index into the objectArray
Returns:
the object

getFieldAsObject

public Object getFieldAsObject(int row,
                               int i)
returns the fieldValues Object given by row row and index i

Parameters:
row - row in the rsv
i - Index into the objectArray
Returns:
the object

setFieldAsObject

public void setFieldAsObject(int row,
                             int i,
                             Object obj)
sets the fieldValue Object given by row row and index i

Parameters:
row - row in the rsv
i - Index into the objectArray

getFieldAsObject

public Object getFieldAsObject(String fieldName)
returns the fieldValues Object given by it's name

Parameters:
fieldName - name of the field
Returns:
the object

getFieldAsObject

public Object getFieldAsObject(int row,
                               String fieldName)
returns the fieldValues Object given by row row and fieldName

Parameters:
row - row in the rsv
Returns:
the object

setFieldAsObject

public void setFieldAsObject(int row,
                             String fieldName,
                             Object obj)
sets the fieldValue Object given by row row and fieldName

Parameters:
row - row in the rsv
fieldName - name of the field

getFieldDescription

public Field getFieldDescription(String fieldName)
gets the Field object to a given fieldName

Parameters:
fieldName - name of the field
Returns:
the Field object of the given name null if not found

getFieldIndex

public int getFieldIndex(String fieldName)
returns the index of a given fieldName

Parameters:
fieldName - name of the field
Returns:
the index of the field in the data arrays

isFirst

public boolean isFirst()
Return true if the current record is the first record

Returns:
true if the first record is reached

setFirstPage

public void setFirstPage(boolean b)
DOCUMENT ME!

Parameters:
b - value to set

isFirstPage

public boolean isFirstPage()
DOCUMENT ME!

Returns:
DOCUMENT ME!

isLast

public boolean isLast()
Return true if the current record is the last record

Returns:
true if the last record is reached

setLastPage

public void setLastPage(boolean b)
DOCUMENT ME!

Parameters:
b - value to set

isLastPage

public boolean isLastPage()
DOCUMENT ME!

Returns:
DOCUMENT ME!

addResultSet

public void addResultSet(DbEventInterceptorData interceptorData,
                         ResultSet rs)
                  throws SQLException
DOCUMENT ME!

Parameters:
interceptorData - DOCUMENT ME!
rs - DOCUMENT ME!
Throws:
SQLException - DOCUMENT ME!

addRow

public void addRow(DbEventInterceptorData interceptorData,
                   Object[] objectRow)
adds a row to the ResultSetVector

Parameters:
interceptorData - DOCUMENT ME!
objectRow - row to add

flip

public void flip()
DOCUMENT ME!


moveFirst

public void moveFirst()
moves to the first record


moveLast

public void moveLast()
moves to the last record


moveNext

public boolean moveNext()
moves to the next record

Returns:
true if end is reached

movePrevious

public boolean movePrevious()
moves to the previous record

Returns:
true if beginning is reached

size

public int size()
implements size()

Returns:
the sizeof the vector


Copyright © 2002-2006 DbForms. All Rights Reserved.