com.ibm.as400.util.servlet
Class SQLResultSetMetaData

java.lang.Object
  extended bycom.ibm.as400.util.servlet.SQLResultSetMetaData
All Implemented Interfaces:
RowMetaData, Serializable

public class SQLResultSetMetaData
extends Object
implements RowMetaData, Serializable

An SQLResultSetMetaData object can be used to find out information about the columns of an SQLResultSetRowData object.

Serializing the object results in the metadata being cached with the object. After deserialization the cached data is used until the metadata is reset using the setMetaData method.

SQLResultSetMetaData objects generate the following events:

See Also:
Serialized Form

Constructor Summary
SQLResultSetMetaData()
          Constructs a default SQLResultSetMetaData object.
SQLResultSetMetaData(ResultSetMetaData metadata)
          Constructs an SQLResultSetMetaData object with the specified metadata.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a PropertyChangeListener.
 void addVetoableChangeListener(VetoableChangeListener listener)
          Adds the VetoableChangeListener.
 String getColumnAlignment(int columnIndex)
          Returns the alignment of the column specified by columnIndex.
 int getColumnCount()
          Returns the number of columns in the result set.
 String getColumnDirection(int columnIndex)
          Returns the direction of the column specified by columnIndex.
 int getColumnDisplaySize(int columnIndex)
          Returns the display size in characters of the column specified by columnIndex.
 String getColumnLabel(int columnIndex)
          Returns the label of the column specified by columnIndex.
 String getColumnName(int columnIndex)
          Returns the name of the column specified by columnIndex.
 int getColumnType(int columnIndex)
          Returns the SQL data type of the column specified by columnIndex.
 String getColumnTypeName(int columnIndex)
          Returns the data type name of the column specified by columnIndex.
 ResultSetMetaData getMetaData()
          Returns the result set metadata.
 int getPrecision(int columnIndex)
          Returns the number of decimal digits for the column specified by columnIndex.
 int getScale(int columnIndex)
          Returns the number of digits to the right of the decimal point for the column specified by columnIndex.
 boolean isNumericData(int columnIndex)
          Indicates if the column specified by columnIndex contains numeric data.
 boolean isTextData(int columnIndex)
          Indicates if the column specified by columnIndex contains text data.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes the PropertyChangeListener from the internal list.
 void removeVetoableChangeListener(VetoableChangeListener listener)
          Removes the VetoableChangeListener from the internal list.
 void setColumnAlignment(int columnIndex, String alignment)
          Sets the specified horizontal alignment for the column data specified by columnIndex.
 void setColumnDirection(int columnIndex, String dir)
          Sets the specified direction for the column data specified by columnIndex.
 void setColumnLabel(int columnIndex, String label)
          Sets the specified label at the column specified by columnIndex.
 void setMetaData(ResultSetMetaData metadata)
          Sets the result set metadata.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLResultSetMetaData

public SQLResultSetMetaData()
Constructs a default SQLResultSetMetaData object.


SQLResultSetMetaData

public SQLResultSetMetaData(ResultSetMetaData metadata)
                     throws RowDataException
Constructs an SQLResultSetMetaData object with the specified metadata.

Parameters:
metadata - The metadata.
Throws:
RowDataException - If a row data error occurs.
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange method is called each time the value of any bound property is changed.

Parameters:
listener - The PropertyChangeListener.
See Also:
removePropertyChangeListener(java.beans.PropertyChangeListener)

addVetoableChangeListener

public void addVetoableChangeListener(VetoableChangeListener listener)
Adds the VetoableChangeListener. The specified VetoableChangeListener's vetoableChange method is called each time the value of any constrained property is changed.

Parameters:
listener - The VetoableChangeListener.
See Also:
removeVetoableChangeListener(java.beans.VetoableChangeListener)

getColumnAlignment

public String getColumnAlignment(int columnIndex)
                          throws RowDataException
Returns the alignment of the column specified by columnIndex.

Specified by:
getColumnAlignment in interface RowMetaData
Parameters:
columnIndex - The column index (0-based).
Returns:
The horizontal column alignment. One of the following constants defined in HTMLConstants: LEFT, CENTER, RIGHT, or JUSTIFY.
Throws:
RowDataException - If a row data error occurs.
See Also:
HTMLConstants

getColumnDirection

public String getColumnDirection(int columnIndex)
                          throws RowDataException
Returns the direction of the column specified by columnIndex.

Specified by:
getColumnDirection in interface RowMetaData
Parameters:
columnIndex - The column index (0-based).
Returns:
The column direction.
Throws:
RowDataException - If a row data error occurs.
See Also:
HTMLConstants

getColumnCount

public int getColumnCount()
                   throws RowDataException
Returns the number of columns in the result set.

Specified by:
getColumnCount in interface RowMetaData
Returns:
The number of columns.
Throws:
RowDataException - If a row data error occurs.

getColumnDisplaySize

public int getColumnDisplaySize(int columnIndex)
                         throws RowDataException
Returns the display size in characters of the column specified by columnIndex.

Specified by:
getColumnDisplaySize in interface RowMetaData
Parameters:
columnIndex - The column index (0-based).
Returns:
The column display size in characters.
Throws:
RowDataException - If a row data error occurs.

getColumnLabel

public String getColumnLabel(int columnIndex)
                      throws RowDataException
Returns the label of the column specified by columnIndex.

Specified by:
getColumnLabel in interface RowMetaData
Parameters:
columnIndex - The column index (0-based).
Returns:
The column label.
Throws:
RowDataException - If a row data error occurs.

getColumnName

public String getColumnName(int columnIndex)
                     throws RowDataException
Returns the name of the column specified by columnIndex.

Specified by:
getColumnName in interface RowMetaData
Parameters:
columnIndex - The column index (0-based).
Returns:
The column name.
Throws:
RowDataException - If a row data error occurs.

getColumnType

public int getColumnType(int columnIndex)
                  throws RowDataException
Returns the SQL data type of the column specified by columnIndex.

Specified by:
getColumnType in interface RowMetaData
Parameters:
columnIndex - The column index (0-based).
Returns:
The column SQL type (see java.sql.Types).
Throws:
RowDataException - If a row data error occurs.

getColumnTypeName

public String getColumnTypeName(int columnIndex)
                         throws RowDataException
Returns the data type name of the column specified by columnIndex.

Specified by:
getColumnTypeName in interface RowMetaData
Parameters:
columnIndex - The column index (0-based).
Returns:
The column data type name.
Throws:
RowDataException - If a row data error occurs.

getMetaData

public ResultSetMetaData getMetaData()
Returns the result set metadata.

Returns:
The metadata.

getPrecision

public int getPrecision(int columnIndex)
                 throws RowDataException
Returns the number of decimal digits for the column specified by columnIndex.

Specified by:
getPrecision in interface RowMetaData
Parameters:
columnIndex - The column index (0-based).
Returns:
The column precision (number of decimal digits).
Throws:
RowDataException - If a row data error occurs.

getScale

public int getScale(int columnIndex)
             throws RowDataException
Returns the number of digits to the right of the decimal point for the column specified by columnIndex.

Specified by:
getScale in interface RowMetaData
Parameters:
columnIndex - The column index (0-based).
Returns:
The column scale (number of decimal digits to the right of the decimal point).
Throws:
RowDataException - If a row data error occurs.

isNumericData

public boolean isNumericData(int columnIndex)
                      throws RowDataException
Indicates if the column specified by columnIndex contains numeric data.

Specified by:
isNumericData in interface RowMetaData
Parameters:
columnIndex - The column index (0-based).
Returns:
true if numeric data; false otherwise.
Throws:
RowDataException - If a row data error occurs.

isTextData

public boolean isTextData(int columnIndex)
                   throws RowDataException
Indicates if the column specified by columnIndex contains text data.

Specified by:
isTextData in interface RowMetaData
Parameters:
columnIndex - The column index (0-based).
Returns:
true if text data; false otherwise.
Throws:
RowDataException - If a row data error occurs.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes the PropertyChangeListener from the internal list. If the PropertyChangeListener is not on the list, nothing is done.

Parameters:
listener - The PropertyChangeListener.
See Also:
addPropertyChangeListener(java.beans.PropertyChangeListener)

removeVetoableChangeListener

public void removeVetoableChangeListener(VetoableChangeListener listener)
Removes the VetoableChangeListener from the internal list. If the VetoableChangeListener is not on the list, nothing is done.

Parameters:
listener - The VetoableChangeListener.
See Also:
addVetoableChangeListener(java.beans.VetoableChangeListener)

setMetaData

public void setMetaData(ResultSetMetaData metadata)
                 throws PropertyVetoException,
                        RowDataException
Sets the result set metadata.

Parameters:
metadata - The metadata.
Throws:
PropertyVetoException - If a change is vetoed.
RowDataException - If a row data error occurs.

setColumnAlignment

public void setColumnAlignment(int columnIndex,
                               String alignment)
                        throws RowDataException
Sets the specified horizontal alignment for the column data specified by columnIndex.

Specified by:
setColumnAlignment in interface RowMetaData
Parameters:
columnIndex - The column index (0-based).
alignment - The horizontal column alignment. One of the following constants defined in HTMLConstants: LEFT, CENTER, RIGHT, or JUSTIFY.
Throws:
RowDataException - If a row data error occurs.
See Also:
HTMLConstants

setColumnDirection

public void setColumnDirection(int columnIndex,
                               String dir)
                        throws RowDataException
Sets the specified direction for the column data specified by columnIndex.

Specified by:
setColumnDirection in interface RowMetaData
Parameters:
columnIndex - The column index (0-based).
dir - The column direction.
Throws:
RowDataException - If a row data error occurs.
See Also:
HTMLConstants

setColumnLabel

public void setColumnLabel(int columnIndex,
                           String label)
                    throws RowDataException
Sets the specified label at the column specified by columnIndex.

Specified by:
setColumnLabel in interface RowMetaData
Parameters:
columnIndex - The column index (0-based).
label - The label.
Throws:
RowDataException - If a row data error occurs.