SPT RWT Application API

com.sptci.rwt
Class PrimaryKeyAnalyser

java.lang.Object
  extended by com.sptci.rwt.Analyser
      extended by com.sptci.rwt.KeyAnalyser
          extended by com.sptci.rwt.PrimaryKeyAnalyser

public class PrimaryKeyAnalyser
extends KeyAnalyser

An analyser for analysing primary key columns for tables in the database.

© Copyright 2007 Sans Pareil Technologies, Inc.

Version:
$Id: PrimaryKeyAnalyser.java 4123 2008-05-25 21:49:01Z rakesh $
Author:
Rakesh Vidyadharan 2007-09-25
See Also:
DatabaseMetaData.getPrimaryKeys(java.lang.String, java.lang.String, java.lang.String)

Nested Class Summary
 
Nested classes/interfaces inherited from class com.sptci.rwt.Analyser
Analyser.CatalogueSchema
 
Field Summary
 
Fields inherited from class com.sptci.rwt.Analyser
logger, manager
 
Constructor Summary
PrimaryKeyAnalyser(ConnectionManager manager)
          Create a new instance of the class using the specified connection manager.
 
Method Summary
 Collection<PrimaryKeyMetaData> analyse(MetaData... parameters)
          Returns a collection of PrimaryKeyMetaData objects that contain all information pertaining to the primary key columns for the specified table.
protected  Collection<ColumnMetaData> processColumns(TableMetaData tmd, ResultSet resultSet)
          Read the column(s) that comprise the primary key and crate a collection of ColumnMetaData objects ordered by key_seq.
 
Methods inherited from class com.sptci.rwt.KeyAnalyser
checkTableColumns
 
Methods inherited from class com.sptci.rwt.Analyser
getNames
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrimaryKeyAnalyser

public PrimaryKeyAnalyser(ConnectionManager manager)
Create a new instance of the class using the specified connection manager.

Parameters:
manager - The manager for obtaining database connections.
Method Detail

analyse

public Collection<PrimaryKeyMetaData> analyse(MetaData... parameters)
                                       throws SQLException
Returns a collection of PrimaryKeyMetaData objects that contain all information pertaining to the primary key columns for the specified table.

Specified by:
analyse in class Analyser
Parameters:
parameters - Must contain two parameters which are the names of the schema and table from which primary key metadata are to be retrieved.
Returns:
A collection representing the primary key for the table. This method returns a collection purely to keep compatibility with the super-class abstract method declaration. A table can have only one primary key.
Throws:
SQLException - If errors are encountered while analysisng the
See Also:
Analyser.analyse(com.sptci.rwt.MetaData...), Analyser.getNames(com.sptci.rwt.MetaData), KeyAnalyser.checkTableColumns(com.sptci.rwt.TableMetaData), processColumns(com.sptci.rwt.TableMetaData, java.sql.ResultSet)

processColumns

protected Collection<ColumnMetaData> processColumns(TableMetaData tmd,
                                                    ResultSet resultSet)
                                             throws SQLException
Read the column(s) that comprise the primary key and crate a collection of ColumnMetaData objects ordered by key_seq.

Parameters:
tmd - The meta data object representing the table on which the primary key is defined.
resultSet - The result set object to process.
Returns:
The collection of columns.
Throws:
SQLException - If errors are encountered while processing the result set.

SPT RWT Application API