public class DBModelParser extends Object
Modifier and Type | Field and Description |
---|---|
protected String |
catalog |
protected static org.slf4j.Logger |
log |
protected DBDatabase |
remoteDb |
protected String |
remoteName |
protected String |
schema |
protected Map<String,DBRowSet> |
tableMap |
Constructor and Description |
---|
DBModelParser(String catalog,
String schema)
Creates a new Model Checker
|
Modifier and Type | Method and Description |
---|---|
protected DBColumn |
addColumn(DBRowSet t,
ResultSet rs) |
protected void |
addRelation(String relName,
DBRelation.DBReference... references) |
protected void |
addTable(String tableName) |
protected void |
addView(String viewName) |
protected int |
collectColumns(DatabaseMetaData dbMeta)
collects column information from database meta data for each table
|
protected int |
collectColumns(DatabaseMetaData dbMeta,
String tablePattern)
collects column information from database meta data for whole schema
|
protected int |
collectForeignKeys(DatabaseMetaData dbMeta)
collects foreign key information from database meta data
|
protected int |
collectForeignKeys(DatabaseMetaData dbMeta,
String tablePattern)
collects foreign key information from database meta data
|
protected int |
collectPrimaryKeys(DatabaseMetaData dbMeta)
collects primary key information from database meta data
|
protected int |
collectTablesAndViews(DatabaseMetaData dbMeta,
String tablePattern)
collects table and view information from database meta data
|
protected DBDatabase |
createRemoteDatabase() |
String |
getCatalog() |
protected Object |
getColumnDefault(ResultSet rs) |
protected double |
getColumnSize(DataType empireType,
ResultSet rs) |
DBDatabase |
getDatabase()
Returns the RemoteDatabase
Only available after parseModel() is called
|
protected DataType |
getEmpireDataType(int sqlType) |
String |
getSchema() |
protected DBRowSet |
getTable(String tableName) |
protected Collection<DBRowSet> |
getTables() |
protected boolean |
isColumnRequired(ResultSet rs) |
protected boolean |
isIdentityColumn(ResultSet rs) |
protected boolean |
isSystemTable(String tableName,
ResultSet tableMeta)
Checks if the tableName belongs to a system or hidden table
|
protected boolean |
isTimestampColumn(ResultSet rs) |
void |
parseModel(Connection conn)
This method is used to parse the populate the remote database
|
protected void |
populateRemoteDatabase(DatabaseMetaData dbMeta) |
void |
setStandardIdentityColumnName(String standardIdentityColumnName) |
void |
setStandardTimestampColumnName(String standardTimestampColumnName) |
protected static final org.slf4j.Logger log
protected final String catalog
protected final String schema
protected final String remoteName
protected DBDatabase remoteDb
public String getCatalog()
public String getSchema()
public void setStandardIdentityColumnName(String standardIdentityColumnName)
public void setStandardTimestampColumnName(String standardTimestampColumnName)
public DBDatabase getDatabase()
public void parseModel(Connection conn)
conn
- the connection for retrieving the remote database metadataprotected void populateRemoteDatabase(DatabaseMetaData dbMeta) throws SQLException
SQLException
protected boolean isSystemTable(String tableName, ResultSet tableMeta)
tableName
- the table nametableMeta
- the table metaprotected int collectTablesAndViews(DatabaseMetaData dbMeta, String tablePattern) throws SQLException
dbMeta
- the database meta datatablePattern
- the table patternSQLException
protected int collectColumns(DatabaseMetaData dbMeta) throws SQLException
SQLException
protected int collectColumns(DatabaseMetaData dbMeta, String tablePattern) throws SQLException
SQLException
protected int collectPrimaryKeys(DatabaseMetaData dbMeta) throws SQLException
dbMeta
- the database meta dataSQLException
protected int collectForeignKeys(DatabaseMetaData dbMeta) throws SQLException
dbMeta
- the database meta dataSQLException
protected int collectForeignKeys(DatabaseMetaData dbMeta, String tablePattern) throws SQLException
dbMeta
- the database meta datatablePattern
- the table patternSQLException
protected final Collection<DBRowSet> getTables()
protected DBDatabase createRemoteDatabase()
protected void addTable(String tableName)
protected void addView(String viewName)
protected void addRelation(String relName, DBRelation.DBReference... references)
protected DBColumn addColumn(DBRowSet t, ResultSet rs) throws SQLException
SQLException
protected double getColumnSize(DataType empireType, ResultSet rs) throws SQLException
SQLException
protected boolean isColumnRequired(ResultSet rs) throws SQLException
SQLException
protected Object getColumnDefault(ResultSet rs) throws SQLException
SQLException
protected boolean isIdentityColumn(ResultSet rs)
protected boolean isTimestampColumn(ResultSet rs)
protected DataType getEmpireDataType(int sqlType)
Copyright © 2008–2023 Apache Software Foundation. All rights reserved.