com.tivoli.twg.engine
Class TWGDbQueryResult

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

public class TWGDbQueryResult
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.

See Also:
Serialized Form

Constructor Summary
TWGDbQueryResult()
          Constructor for TWGDbQueryResult
TWGDbQueryResult(byte[] rowBuf, byte[] columnBuf)
          Constructor to create a TWGDbQueryResult from an intel byte buffer format byte array
 
Method Summary
protected  void addColumnMetaData(int columnId, TWGDbQueryColumn columnData)
          * The instance method puts column information into the object.
protected  void addRow(int MOID, TWGDbRow row)
          This method inserts a row into the object.
 TWGDbRow[] getAllRowByMOID(int MOID)
          Return list of TWGDbRows which match the given MOID(MANAGED_OBJ_ID).
protected  TWGDbQueryColumn getColumn(int columnId)
          Get a query column for a specific column id.
 int getColumnCount()
          The instance method gets the number of columns in the TWGDbQueryResult object.
 int[] getColumnIds()
          Gets the column numbers of each column in its super query.
 int[] getColumnTypes()
          Gets column types for all the columns in the query result.
 int getMetaDataBufferLen()
           
 int[] getMOIDs()
          Method to get all the values for the MOID field.
 int getNumOfRows()
          The instance method gets the total number of the rows in the TWGDbQueryResult object.
 int getNumOfRowsByMOID(int MOID)
          Method to get number of rows with the specified MOID.
 TWGDbRow getRow(int rowNumber)
          The method gets a referenece to a TWGDbRow object.
 int getRowBufferLen()
           
protected  int initMetaDataByBuffer(byte[] columnBuf)
           
protected  int initParmsByBuf(byte[] rowBuf, byte[] columnBuf)
          Method to initialize the parameters for the command using data from buffer.
 void setBufferParms(byte[] rowBuf, byte[] columnBuf)
           
protected  void setBufferParms(Command cmd)
           
protected  void setColumnIds(int[] column_ids)
          Sets the column number of each selected field in its super query.
protected  void setIntelByteBufferParms(Command cmd)
           
 int setMetaDataBuffer(byte[] columnBuf)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TWGDbQueryResult

public TWGDbQueryResult()
Constructor for TWGDbQueryResult


TWGDbQueryResult

public TWGDbQueryResult(byte[] rowBuf,
                        byte[] columnBuf)
                 throws TWGDbException
Constructor to create a TWGDbQueryResult from an intel byte buffer format byte array

Parameters:
rowBuf - - byte array containing information about rows in the result set.
columnBuf - - byte array containing infdormation about metadata of the result set.
Throws:
TWGDbException
Method Detail

addColumnMetaData

protected void addColumnMetaData(int columnId,
                                 TWGDbQueryColumn columnData)
* The instance method puts column information into the object. *

Parameters:
columnId - - a column number *
columnData - - a TWGDbQueryColumn object reference *
See Also:
*

addRow

protected void addRow(int MOID,
                      TWGDbRow row)
This method inserts a row into the object.

Parameters:
MOID - - value for the first column of the query.
See Also:
TWGDbRow

setColumnIds

protected void setColumnIds(int[] column_ids)
Sets the column number of each selected field in its super query. it is used in report query format. It's a map from column ids in the single query to ones in combined query. The value in element i is the column number of the column i in combined query. The column_ids[0] element is not used.

Parameters:
column_ids - - int array containing the column ids starting from element 1.

getColumnIds

public int[] getColumnIds()
Gets the column numbers of each column in its super query. it is used in report query format. It's a map from column ids in the single query to ones in combined query. The value in element i is the column number of the column i in combined query. The column_ids[0] element is not used and should not be interrogated.

Returns:
int array containing the column numbers starting from element 1. Element 0 in the array is not valid.

getColumnCount

public int getColumnCount()
The instance method gets the number of columns in the TWGDbQueryResult object.

Returns:
int the number of columns

getColumn

protected TWGDbQueryColumn getColumn(int columnId)
                              throws TWGDbException
Get a query column for a specific column id. Use 0 origin to access the metadata.

Returns:
TWGDbQueryColumn
Throws:
TWGDbException
See Also:
TWGDbQueryColumn

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. Element 0 contains the type for MANAGED_OBJ_ID and the remaining columns start with element 1.
Throws:
TWGDbException

getAllRowByMOID

public TWGDbRow[] getAllRowByMOID(int MOID)
Return list of TWGDbRows which match the given MOID(MANAGED_OBJ_ID).

Parameters:
MOID - - int indicating MANAGED_OBJ_ID.
Returns:
array of TWGDbRow references.
See Also:
TWGDbRow

getNumOfRows

public int getNumOfRows()
The instance method gets the total number of the rows in the TWGDbQueryResult object.

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

getNumOfRowsByMOID

public int getNumOfRowsByMOID(int MOID)
Method to get number of rows with the specified MOID.

Parameters:
MOID - - Managed_Object Id
Returns:
int

getMOIDs

public int[] getMOIDs()
Method to get all the values for the MOID field.

Returns:
int array

getRow

public TWGDbRow getRow(int rowNumber)
                throws TWGDbException
The method gets a referenece to a TWGDbRow object.

Parameters:
rowNumber - indicating row number (use origin starting from 1)
Returns:
TWGDbRow
Throws:
TWGDbException - if invalid index for the row.

initMetaDataByBuffer

protected int initMetaDataByBuffer(byte[] columnBuf)
                            throws TWGDbException
Throws:
TWGDbException

setMetaDataBuffer

public int setMetaDataBuffer(byte[] columnBuf)
                      throws TWGDbException
Throws:
TWGDbException

initParmsByBuf

protected int initParmsByBuf(byte[] rowBuf,
                             byte[] columnBuf)
                      throws TWGDbException
Method to initialize the parameters for the command using data from buffer. It is used to support C or C++ console.

Parameters:
rowBuf - - byte array containing info about the rows and column ids in the query result.
columnBuf - - byte array containing info about the columns.
Returns:
int - new offset.
Throws:
TWGDbException

setBufferParms

public void setBufferParms(byte[] rowBuf,
                           byte[] columnBuf)
                    throws TWGDbException
Throws:
TWGDbException

setBufferParms

protected void setBufferParms(Command cmd)
                       throws TWGDbException
Throws:
TWGDbException

setIntelByteBufferParms

protected void setIntelByteBufferParms(Command cmd)
                                throws TWGDbException
Throws:
TWGDbException

getRowBufferLen

public int getRowBufferLen()

getMetaDataBufferLen

public int getMetaDataBufferLen()
                         throws TWGDbException
Throws:
TWGDbException