com.isti.util.database
Class QueryJDBC

java.lang.Object
  extended by com.isti.util.database.QueryJDBC

public class QueryJDBC
extends java.lang.Object


Constructor Summary
QueryJDBC(ConnectionJDBC dbConn, java.lang.String sql)
          Execute a query.
 
Method Summary
protected static boolean addColumn(java.util.Map columnObjects, java.lang.String columnName, java.lang.Object columnValue)
          Adds a column to the list.
 int getColumnCount()
          Getss the number of columns in this ResultSet object.
 java.lang.String getColumnName(int columnIndex)
          Gets the designated column's name.
 java.util.List getColumnObjects()
          Gets a list of the column objects.
 java.util.Map getMap(int index)
          Gets the map for the specified index.
 java.lang.String getResultInformation()
          Gets result information from the query.
protected  java.lang.String getResultInformation(java.util.Map map)
          Gets result information from the query for the specified map element.
 java.lang.String getResultSetMetaDataInformation()
          Gets information about the database.
 int getSize()
          Gets the size of the query list.
 java.lang.String getSql()
          Gets the sql statement
 java.lang.String getString(int index)
          Gets a string representation of a database element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryJDBC

public QueryJDBC(ConnectionJDBC dbConn,
                 java.lang.String sql)
          throws java.sql.SQLException
Execute a query.

Parameters:
dbConn - database connection.
sql - typically this is a static SQL SELECT statement
Throws:
java.sql.SQLException - if a database access error occurs
Method Detail

addColumn

protected static boolean addColumn(java.util.Map columnObjects,
                                   java.lang.String columnName,
                                   java.lang.Object columnValue)
Adds a column to the list.

Parameters:
columnObjects - map of column objects.
columnName - column name
columnValue - column value
Returns:
true if the column was added.

getResultSetMetaDataInformation

public java.lang.String getResultSetMetaDataInformation()
                                                 throws java.sql.SQLException
Gets information about the database.

Returns:
information string or null if not available
Throws:
java.sql.SQLException - if a database access error occurs

getColumnCount

public int getColumnCount()
Getss the number of columns in this ResultSet object.

Returns:
the number of columns

getColumnName

public java.lang.String getColumnName(int columnIndex)
Gets the designated column's name.

Parameters:
columnIndex - the first column is 0, the second is 1, ...
Returns:
the column name or null if not available

getColumnObjects

public java.util.List getColumnObjects()
Gets a list of the column objects. The list contains Map objects with the column name for the key.

Returns:
list of column objects.

getMap

public java.util.Map getMap(int index)
Gets the map for the specified index.

Parameters:
index - database element index
Returns:
the map for the specified index.

getResultInformation

protected java.lang.String getResultInformation(java.util.Map map)
Gets result information from the query for the specified map element.

Parameters:
map - map element.
Returns:
information string

getResultInformation

public java.lang.String getResultInformation()
Gets result information from the query.

Returns:
information string

getSize

public int getSize()
Gets the size of the query list.

Returns:
the size of the query list.

getSql

public java.lang.String getSql()
Gets the sql statement

Returns:
the sql statement

getString

public java.lang.String getString(int index)
Gets a string representation of a database element.

Parameters:
index - database element index
Returns:
a string or null if not available.