com.ricebridge.xmlman.in
Class XmlResultSetMetaData

java.lang.Object
  extended bycom.ricebridge.xmlman.in.XmlResultSetMetaData
All Implemented Interfaces:
ResultSetMetaData

public class XmlResultSetMetaData
extends Object
implements ResultSetMetaData

Implementation of ResultSetMetaData to present headers from XML data (if defined).

This ResultSetMetaData implementation provides much the same interface as a normal ResultSetMetaData. It assumes that the first data record from XML file specifies the column headers, which are are returned by getColumnName(int). Apart from methods relating to column names, all other methods return default values which assume that all data is in the form of Strings.

The Source Code of this Java class is available under a BSD-style license.


Field Summary
protected  int iColumnCount
          Number of columns of data.
protected  HashMap iColumnMap
          Map from column name to index.
protected  String[] iColumnName
          Column names
 
Fields inherited from interface java.sql.ResultSetMetaData
columnNoNulls, columnNullable, columnNullableUnknown
 
Constructor Summary
XmlResultSetMetaData(String[] pFieldNames)
          Initialised with a List of String[] containing column field names.
 
Method Summary
 int findColumn(String pColumnName)
          Find the index (starting at one, not zero) of a named column.
 String getCatalogName(int pColumn)
           
 String getColumnClassName(int pColumn)
           
 int getColumnCount()
          Get the number of columns.
 int getColumnDisplaySize(int pColumn)
           
 String getColumnLabel(int pColumn)
          Get the name of a column.
 String getColumnName(int pColumn)
          Get the name of a column.
 int getColumnType(int pColumn)
           
 String getColumnTypeName(int pColumn)
           
 int getPrecision(int pColumn)
           
 int getScale(int pColumn)
           
 String getSchemaName(int pColumn)
           
 String getTableName(int pColumn)
           
 boolean isAutoIncrement(int pColumn)
           
 boolean isCaseSensitive(int pColumn)
           
 boolean isCurrency(int pColumn)
           
 boolean isDefinitelyWritable(int pColumn)
           
 int isNullable(int pColumn)
           
 boolean isReadOnly(int pColumn)
           
 boolean isSearchable(int pColumn)
           
 boolean isSigned(int pColumn)
           
 boolean isWritable(int pColumn)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iColumnCount

protected int iColumnCount
Number of columns of data.


iColumnName

protected String[] iColumnName
Column names


iColumnMap

protected HashMap iColumnMap
Map from column name to index.

Constructor Detail

XmlResultSetMetaData

public XmlResultSetMetaData(String[] pFieldNames)
Initialised with a List of String[] containing column field names.

Parameters:
pFieldNames - header names
Method Detail

findColumn

public int findColumn(String pColumnName)
Find the index (starting at one, not zero) of a named column.

Parameters:
pColumnName - name of column

getColumnCount

public int getColumnCount()
                   throws SQLException
Get the number of columns.

Specified by:
getColumnCount in interface ResultSetMetaData
Throws:
SQLException

getColumnLabel

public String getColumnLabel(int pColumn)
                      throws SQLException
Get the name of a column.

Specified by:
getColumnLabel in interface ResultSetMetaData
Parameters:
pColumn - index of column (from one, not zero)
Throws:
SQLException

getColumnName

public String getColumnName(int pColumn)
                     throws SQLException
Get the name of a column.

Specified by:
getColumnName in interface ResultSetMetaData
Parameters:
pColumn - index of column (from one, not zero)
Throws:
SQLException

isAutoIncrement

public boolean isAutoIncrement(int pColumn)
                        throws SQLException
Specified by:
isAutoIncrement in interface ResultSetMetaData
Throws:
SQLException

isCaseSensitive

public boolean isCaseSensitive(int pColumn)
                        throws SQLException
Specified by:
isCaseSensitive in interface ResultSetMetaData
Throws:
SQLException

isSearchable

public boolean isSearchable(int pColumn)
                     throws SQLException
Specified by:
isSearchable in interface ResultSetMetaData
Throws:
SQLException

isCurrency

public boolean isCurrency(int pColumn)
                   throws SQLException
Specified by:
isCurrency in interface ResultSetMetaData
Throws:
SQLException

isNullable

public int isNullable(int pColumn)
               throws SQLException
Specified by:
isNullable in interface ResultSetMetaData
Throws:
SQLException

isSigned

public boolean isSigned(int pColumn)
                 throws SQLException
Specified by:
isSigned in interface ResultSetMetaData
Throws:
SQLException

getColumnDisplaySize

public int getColumnDisplaySize(int pColumn)
                         throws SQLException
Specified by:
getColumnDisplaySize in interface ResultSetMetaData
Throws:
SQLException

getSchemaName

public String getSchemaName(int pColumn)
                     throws SQLException
Specified by:
getSchemaName in interface ResultSetMetaData
Throws:
SQLException

getPrecision

public int getPrecision(int pColumn)
                 throws SQLException
Specified by:
getPrecision in interface ResultSetMetaData
Throws:
SQLException

getScale

public int getScale(int pColumn)
             throws SQLException
Specified by:
getScale in interface ResultSetMetaData
Throws:
SQLException

getTableName

public String getTableName(int pColumn)
                    throws SQLException
Specified by:
getTableName in interface ResultSetMetaData
Throws:
SQLException

getCatalogName

public String getCatalogName(int pColumn)
                      throws SQLException
Specified by:
getCatalogName in interface ResultSetMetaData
Throws:
SQLException

getColumnType

public int getColumnType(int pColumn)
                  throws SQLException
Specified by:
getColumnType in interface ResultSetMetaData
Throws:
SQLException

getColumnTypeName

public String getColumnTypeName(int pColumn)
                         throws SQLException
Specified by:
getColumnTypeName in interface ResultSetMetaData
Throws:
SQLException

isReadOnly

public boolean isReadOnly(int pColumn)
                   throws SQLException
Specified by:
isReadOnly in interface ResultSetMetaData
Throws:
SQLException

isWritable

public boolean isWritable(int pColumn)
                   throws SQLException
Specified by:
isWritable in interface ResultSetMetaData
Throws:
SQLException

isDefinitelyWritable

public boolean isDefinitelyWritable(int pColumn)
                             throws SQLException
Specified by:
isDefinitelyWritable in interface ResultSetMetaData
Throws:
SQLException

getColumnClassName

public String getColumnClassName(int pColumn)
                          throws SQLException
Specified by:
getColumnClassName in interface ResultSetMetaData
Throws:
SQLException


Copyright © 2004-2005 Ricebridge