com.tivoli.twg.engine
Class TWGDbResultSet

java.lang.Object
  extended bycom.tivoli.twg.engine.TWGDbResultSet
All Implemented Interfaces:
java.io.Serializable

public class TWGDbResultSet
extends java.lang.Object
implements java.io.Serializable

This class contains a set of rows returned by a query and information about columns * of the result set. The data stored in the TWGDbResultSet object is retrieved through * a set of get methods that allow access to the various columns of the current row. *

See Also:
Serialized Form

Constructor Summary
TWGDbResultSet()
          Constructor for TWGDbResultSet *
TWGDbResultSet(byte[] rowBuf, byte[] columnBuf)
          This method is public as an implementation side effect.
TWGDbResultSet(Command cmd)
          This method is public as an implementation side effect.
TWGDbResultSet(long qId)
          Constructor for TWGDbResultSet
TWGDbResultSet(java.lang.Long qId)
          Constructor for TWGDbResultSet
 
Method Summary
protected  void addColumnMetaData(java.lang.String table_column, int columnId, TWGDbQueryColumn columnMeta)
          * Put column meta information into the result set.
protected  void addColumnMetaData(java.lang.String table_column, java.lang.String columnName, int columnId, TWGDbQueryColumn columnMeta)
          * Put column meta information into the result set.
protected  void addRow(TWGDbRow value)
          Insert a row into the result set.
 int getColumnCount()
          Get the number of columns in the TWGDbResultSet object.
 int getColumnId(java.lang.String columnToken)
          The instance method maps column token name into its column number.
 Vect getColumns()
          Get all the TWGDbQueryColumn objects for result set.
 int[] getColumnTypes()
          Gets column types for all the columns in the query result.
 double getDouble(int columnIndex)
          Get the value of the designated column from the current row as a double.
 double getDouble(java.lang.String columnToken)
          Get the value of the designated column from the current row as a double.
 float getFloat(int columnIndex)
          Get the value of the designated column from the current row as a float.
 float getFloat(java.lang.String columnToken)
          Get the value of the designated column from the current row as a float.
 int getInt(int columnIndex)
          Get the value of the designated column from the current row as an int.
 int getInt(java.lang.String columnToken)
          Get the value of the designated column from the current row as an int.
 long getLong(int columnIndex)
          Get the value of the designated column from the current row as a long.
 long getLong(java.lang.String columnToken)
          Get the value of the designated column from the current row as a long.
 TWGDbResultSetMetaData getMetaData()
          Get a TWGDbResultSetMetaData object which contains information about the columns in the result set.
protected  int getMetaDataBufferLen()
          Get the length of the buffer required for the column information This method should be called only in the Director server engine.
protected static java.lang.String getMyClassName(java.lang.Object objectVariable)
          The class method gets the class name of an object.
 int getNumOfRows()
          Gets the total number of the rows in the TWGDbResultSet object.
 java.lang.Object getObject(int columnIndex)
          Get the value of the designated column from the current row as an Object.
 java.lang.Object getObject(java.lang.String columnToken)
          Get the value of the designated column from the current row as an Object.
 int getPosition()
          Return the current row pointer.
 java.lang.Long getQueryId()
          Get the persistent object id of the query that was run
 TWGDbRow getRow(int rowNumber)
          Get a referenece to a TWGDbRow object.
protected  int getRowBufferLen()
          Get the length of the buffer required for the header and row data.
 short getShort(int columnIndex)
          Get the value of the designated column from the current row as a short.
 short getShort(java.lang.String columnToken)
          Get the value of the designated column from the current row as a short.
 java.lang.String getString(int columnIndex)
          Get the value of the designated column from the current row as a String object.
 java.lang.String getString(java.lang.String columnToken)
          Get the value of the designated column from the current row as a String object.
 boolean next()
          Increment to the next row
protected  void setBufferParms(byte[] rowBuf, byte[] columnBuf)
          Method to write out information into two buffers.
protected  void setBufferParms(Command cmd)
          Build IntelByteBuffer parms version of the result set and add it to the IPC command
 void setPosition(int rowNum)
          Set the current row pointer to a specific row.
protected  void setQueryId(long qId)
          The instance method sets the id of the query from which the result set * was derived from.
protected  void setQueryId(java.lang.Long qId)
          The instance method sets the id of the query from which the result set * was derived from.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TWGDbResultSet

public TWGDbResultSet(java.lang.Long qId)
Constructor for TWGDbResultSet

Parameters:
qId - - the persistent object id for the query

TWGDbResultSet

public TWGDbResultSet(long qId)
Constructor for TWGDbResultSet

Parameters:
qId - - the persistent object id for the query

TWGDbResultSet

public TWGDbResultSet()
Constructor for TWGDbResultSet *


TWGDbResultSet

public TWGDbResultSet(byte[] rowBuf,
                      byte[] columnBuf)
               throws TWGDbException
This method is public as an implementation side effect. Do not call or change. Its interface may be changed in a later release.

Constructor for TWGDbResultSet that uses an intel byte buffer formats of the row and column data as input.

Parameters:
rowBuf - - the row information in intel Byte buffer format
columnBuf - - the column information in intel Byte buffer format

TWGDbResultSet

public TWGDbResultSet(Command cmd)
               throws TWGDbException
This method is public as an implementation side effect. Do not call or change. Its interface may be changed in a later release.

Constructor for TWGDbResultSet an IPC command whose input parameter is the an intel byte buffer format for the result set row and column data as input.

Throws:
TWGDbException - thrown for parameter or version errors.
Method Detail

getMyClassName

protected static java.lang.String getMyClassName(java.lang.Object objectVariable)
The class method gets the class name of an object. This method is protected as an implementation side effect. Do not call or change. Its interface may be changed in a later release.

Parameters:
objectVariable - - reference to an object
Returns:
String

addRow

protected void addRow(TWGDbRow value)
Insert a row into the result set. The row data structure * must match the one of the result set. * This method should be called only in the Director server engine.

Parameters:
value - - a TWGDbRow object reference *

addColumnMetaData

protected void addColumnMetaData(java.lang.String table_column,
                                 int columnId,
                                 TWGDbQueryColumn columnMeta)
* Put column meta information into the result set. * This method should be called only in the Director server engine.

Parameters:
table_column - - a column full name * *
columnMeta - - a TWGDbQueryColumn object reference *
See Also:
*

addColumnMetaData

protected void addColumnMetaData(java.lang.String table_column,
                                 java.lang.String columnName,
                                 int columnId,
                                 TWGDbQueryColumn columnMeta)
* Put column meta information into the result set. * This method should be called only in the Director server engine.

Parameters:
table_column - - a column full name *
columnName - - a column token name *
columnMeta - - a TWGDbQueryColumn object reference *
See Also:
*

getMetaData

public TWGDbResultSetMetaData getMetaData()
Get a TWGDbResultSetMetaData object which contains information about the columns in the result set.

Returns:
TWGDbResultSetMetaData
See Also:
TWGDbResultSetMetaData

next

public boolean next()
Increment to the next row

Returns:
true if the move to the next row was successful; false if there are no more rows.

getColumnCount

public int getColumnCount()
Get the number of columns in the TWGDbResultSet object.

Returns:
int indicating the number of columns in the TWGDbResultSet object.

getPosition

public int getPosition()
Return the current row pointer.


setPosition

public void setPosition(int rowNum)
Set the current row pointer to a specific row.

Parameters:
rowNum - - row number

getNumOfRows

public int getNumOfRows()
Gets the total number of the rows in the TWGDbResultSet object.

Returns:
int indicating the number of rows in the TWGDbResultSet object.

getRow

public TWGDbRow getRow(int rowNumber)
                throws TWGDbNoMoreRowException
Get a referenece to a TWGDbRow object.

Parameters:
rowNumber - the number of the requested row
Returns:
TWGDbRow
Throws:
TWGDbException
TWGDbNoMoreRowException

setQueryId

protected void setQueryId(java.lang.Long qId)
The instance method sets the id of the query from which the result set * was derived from. * This method should be called only in the Director server engine.

Parameters:
qId - - the persistent object id for the query *

setQueryId

protected void setQueryId(long qId)
The instance method sets the id of the query from which the result set * was derived from. * This method should be called only in the Director server engine.

Parameters:
qId - - the persistent object id for the query *

getQueryId

public java.lang.Long getQueryId()
Get the persistent object id of the query that was run

Returns:
the persistent object id for the query

getColumns

public Vect getColumns()
Get all the TWGDbQueryColumn objects for result set.

Returns:
Vect - containing TWGDbQueryColumn objects.

getColumnTypes

public int[] getColumnTypes()
                     throws TWGDbException
Gets column types for all the columns in the query result.

Returns:
int array containing column types starting from element 1.
Throws:
TWGDbException

getString

public java.lang.String getString(int columnIndex)
                           throws TWGDbNoMoreRowException
Get the value of the designated column from the current row as a String object.

Parameters:
columnIndex - - column number *
Returns:
String *
Throws:
TWGDbNoMoreRowException

getString

public java.lang.String getString(java.lang.String columnToken)
                           throws TWGDbColumnNotFoundException,
                                  TWGDbNoMoreRowException
Get the value of the designated column from the current row as a String object.

Parameters:
columnToken - - column name - column token name or the fully qualified table_token_name.column_token_name
Returns:
String *
Throws:
TWGDbColumnNotFoundException
TWGDbNoMoreRowException

getInt

public int getInt(int columnIndex)
           throws TWGDbNoMoreRowException,
                  TWGDbException
Get the value of the designated column from the current row as an int. The method is allowed to retrieve SMALLINT, INTEGER JDBC types. * *

Parameters:
columnIndex - - column number *
Returns:
int *
Throws:
TWGDbException - *
TWGDbNoMoreRowException

getInt

public int getInt(java.lang.String columnToken)
           throws TWGDbColumnNotFoundException,
                  TWGDbNoMoreRowException,
                  TWGDbException
Get the value of the designated column from the current row as an int. The method is allowed to retrieve SMALLINT, INTEGER JDBC types. *

Parameters:
columnToken - - column name - column token name or the fully qualified table_token_name.column_token_name
Returns:
int *
Throws:
TWGDbException - *
TWGDbColumnNotFoundException
TWGDbNoMoreRowException

getShort

public short getShort(int columnIndex)
               throws TWGDbNoMoreRowException
Get the value of the designated column from the current row as a short. *

Parameters:
columnIndex - - column number *
Returns:
short *
Throws:
TWGDbException - *
TWGDbNoMoreRowException

getShort

public short getShort(java.lang.String columnToken)
               throws TWGDbColumnNotFoundException,
                      TWGDbNoMoreRowException
Get the value of the designated column from the current row as a short.

Returns:
short *
Throws:
TWGDbException - *
TWGDbColumnNotFoundException
TWGDbNoMoreRowException

getFloat

public float getFloat(int columnIndex)
               throws TWGDbNoMoreRowException
Get the value of the designated column from the current row as a float. *

Parameters:
columnIndex - - column number *
Returns:
float *
Throws:
TWGDbException - *
TWGDbNoMoreRowException

getFloat

public float getFloat(java.lang.String columnToken)
               throws TWGDbColumnNotFoundException,
                      TWGDbNoMoreRowException
Get the value of the designated column from the current row as a float.

Returns:
float *
Throws:
TWGDbException - *
TWGDbColumnNotFoundException
TWGDbNoMoreRowException

getDouble

public double getDouble(int columnIndex)
                 throws TWGDbNoMoreRowException
Get the value of the designated column from the current row as a double. *

Parameters:
columnIndex - - column number *
Returns:
double *
Throws:
TWGDbException - *
TWGDbNoMoreRowException

getDouble

public double getDouble(java.lang.String columnToken)
                 throws TWGDbColumnNotFoundException,
                        TWGDbNoMoreRowException
Get the value of the designated column from the current row as a double. If the columns in the result set are derived from more than one table, * use table name plus column token name to get the value. If the columns are only from* one table, both table name plus column token name and column token name can be used * to get the value. * *

Parameters:
columnToken - - column name - column token name or the fully qualified table_token_name.column_token_name
Returns:
double *
Throws:
TWGDbException - *
TWGDbColumnNotFoundException
TWGDbNoMoreRowException

getLong

public long getLong(int columnIndex)
             throws TWGDbNoMoreRowException
Get the value of the designated column from the current row as a long. *

Parameters:
columnIndex - - column number *
Returns:
long *
Throws:
TWGDbException - *
TWGDbNoMoreRowException

getLong

public long getLong(java.lang.String columnToken)
             throws TWGDbColumnNotFoundException,
                    TWGDbNoMoreRowException
Get the value of the designated column from the current row as a long. *

Parameters:
columnToken - - column name - column token name or the fully qualified table_token_name.column_token_name
Returns:
long *
Throws:
TWGDbException - *
TWGDbColumnNotFoundException
TWGDbNoMoreRowException

getObject

public java.lang.Object getObject(int columnIndex)
                           throws TWGDbNoMoreRowException
Get the value of the designated column from the current row as an Object.

Parameters:
columnIndex - - column number *
Returns:
Object *
Throws:
TWGDbException - *
TWGDbNoMoreRowException

getObject

public java.lang.Object getObject(java.lang.String columnToken)
                           throws TWGDbColumnNotFoundException,
                                  TWGDbNoMoreRowException
Get the value of the designated column from the current row as an Object. *

Parameters:
columnToken - - column name - column token name or the fully qualified table_token_name.column_token_name
Returns:
Object *
Throws:
TWGDbException - *
TWGDbColumnNotFoundException
TWGDbNoMoreRowException

getColumnId

public int getColumnId(java.lang.String columnToken)
                throws TWGDbColumnNotFoundException
The instance method maps column token name into its column number.

Parameters:
columnToken - - column token name
Returns:
int
Throws:
TWGDbColumnNotFoundException

setBufferParms

protected void setBufferParms(byte[] rowBuf,
                              byte[] columnBuf)
                       throws TWGDbException
Method to write out information into two buffers.

This method should be called only in the Director server engine.

Parameters:
columnBuf - - conatining information about meta data.
Throws:
TWGDbException

setBufferParms

protected void setBufferParms(Command cmd)
                       throws TWGDbException
Build IntelByteBuffer parms version of the result set and add it to the IPC command

This method should be called only in the Director server engine.

Parameters:
cmd - - the IPC command whose input parameters will be set by this method
Throws:
- - TWGDbException thrown for parameter or version errors
TWGDbException

getRowBufferLen

protected int getRowBufferLen()
                       throws TWGDbNoMoreRowException
Get the length of the buffer required for the header and row data.

This method should be called only in the Director server engine.

Returns:
the length
Throws:
TWGDbNoMoreRowException

getMetaDataBufferLen

protected int getMetaDataBufferLen()
                            throws TWGDbException
Get the length of the buffer required for the column information This method should be called only in the Director server engine.

Returns:
the length
Throws:
TWGDbException