org.javaWebGen.data
Class DbResult

java.lang.Object
  extended by org.javaWebGen.data.DbResult
All Implemented Interfaces:
java.io.Serializable

public final class DbResult
extends java.lang.Object
implements java.io.Serializable

class that provides a way of saving metadata Data from an SQL query for the data objects without using any Data base resources(ie an open connection)

Version:
$Revision: 1.2 $
See Also:
Serialized Form

Constructor Summary
DbResult(java.util.ArrayList<java.lang.Object[]> list, java.lang.String[] colNames, int[] types)
          builds a DbResult Object by passing in a Array List of Object arrays containing the results of a SQL statement and a list of column names in the table and a array of column types SQL.TYPES
DbResult(java.lang.Exception e)
          creates an object storing an error message
 
Method Summary
 java.lang.Object[] get(int row)
          get a row of data
 java.lang.Object getByName(int row, java.lang.String name)
          get a row of data
 int getColType(int index)
          get the column type
 java.lang.String getError()
          get the error message of running the query null if no errors
 java.util.ArrayList<java.lang.Object[]> getList()
          return all the rows in the result set
 java.lang.String[] getNames()
          get column names
 void setColName(java.lang.String name, int index)
          change the column name if the index is out of range it will not change anything
 void setError(java.lang.String msg)
          return all the rows int the result set
 int size()
          return number of rows in results
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbResult

public DbResult(java.util.ArrayList<java.lang.Object[]> list,
                java.lang.String[] colNames,
                int[] types)
builds a DbResult Object by passing in a Array List of Object arrays containing the results of a SQL statement and a list of column names in the table and a array of column types SQL.TYPES

Parameters:
list - of Object arrays containing the results of a query
colNames - column Names
types - of columns
See Also:
DAO.runQuery(java.sql.Connection, java.lang.String)

DbResult

public DbResult(java.lang.Exception e)
creates an object storing an error message

Parameters:
e - exception
Method Detail

get

public java.lang.Object[] get(int row)
get a row of data

Parameters:
row - number
Returns:
object from database query

getByName

public java.lang.Object getByName(int row,
                                  java.lang.String name)
                           throws DBException
get a row of data

Parameters:
row - number
name - column
Returns:
row data at index
Throws:
DBException

getNames

public java.lang.String[] getNames()
get column names

Returns:
array of col names

size

public int size()
return number of rows in results

Returns:
number of rows in the result set

setColName

public void setColName(java.lang.String name,
                       int index)
change the column name if the index is out of range it will not change anything

Parameters:
name - column name
index -

getList

public java.util.ArrayList<java.lang.Object[]> getList()
return all the rows in the result set

Returns:
list of Object arrays

getError

public java.lang.String getError()
get the error message of running the query null if no errors

Returns:
error

setError

public void setError(java.lang.String msg)
return all the rows int the result set

Parameters:
msg - error message

getColType

public int getColType(int index)
get the column type

Parameters:
index -
Returns:
type


Copyright(C) 2003-2006 Kevin Scott - All Rights Reserved.