Methods Summary |
---|
public void | addColumn(java.sql.ResultSet rs)
String column = rs.getString("COLUMN_NAME");
if (column==null) return;
if ( getColumnMetadata(column) == null ) {
ColumnMetadata info = new ColumnMetadata(rs);
columns.put( info.getName().toLowerCase(), info );
}
|
private void | addForeignKey(java.sql.ResultSet rs)
String fk = rs.getString("FK_NAME");
if (fk == null) return;
ForeignKeyMetadata info = getForeignKeyMetadata(fk);
if (info == null) {
info = new ForeignKeyMetadata(rs);
foreignKeys.put( info.getName().toLowerCase(), info );
}
info.addColumn( getColumnMetadata( rs.getString("FKCOLUMN_NAME") ) );
|
private void | addIndex(java.sql.ResultSet rs)
String index = rs.getString("INDEX_NAME");
if (index == null) return;
IndexMetadata info = getIndexMetadata(index);
if (info == null) {
info = new IndexMetadata(rs);
indexes.put( info.getName().toLowerCase(), info );
}
info.addColumn( getColumnMetadata( rs.getString("COLUMN_NAME") ) );
|
public java.lang.String | getCatalog()
return catalog;
|
public ColumnMetadata | getColumnMetadata(java.lang.String columnName)
return (ColumnMetadata) columns.get( columnName.toLowerCase() );
|
public ForeignKeyMetadata | getForeignKeyMetadata(java.lang.String keyName)
return (ForeignKeyMetadata) foreignKeys.get( keyName.toLowerCase() );
|
public IndexMetadata | getIndexMetadata(java.lang.String indexName)
return (IndexMetadata) indexes.get( indexName.toLowerCase() );
|
public java.lang.String | getName()
return name;
|
public java.lang.String | getSchema()
return schema;
|
private void | initColumns(java.sql.DatabaseMetaData meta)
ResultSet rs = null;
try {
rs = meta.getColumns(catalog, schema, name, "%");
while ( rs.next() ) addColumn(rs);
}
finally {
if (rs != null) rs.close();
}
|
private void | initForeignKeys(java.sql.DatabaseMetaData meta)
ResultSet rs = null;
try {
rs = meta.getImportedKeys(catalog, schema, name);
while ( rs.next() ) addForeignKey(rs);
}
finally {
if (rs != null) rs.close();
}
|
private void | initIndexes(java.sql.DatabaseMetaData meta)
ResultSet rs = null;
try {
rs = meta.getIndexInfo(catalog, schema, name, false, true);
while ( rs.next() ) {
if ( rs.getShort("TYPE") == DatabaseMetaData.tableIndexStatistic ) continue;
addIndex(rs);
}
}
finally {
if (rs != null) rs.close();
}
|
public java.lang.String | toString()
return "TableMetadata(" + name + ')";
|