public abstract class AbstractSqlResourceMetaData extends Object implements SqlResourceMetaData
Constructor and Description |
---|
AbstractSqlResourceMetaData() |
Modifier and Type | Method and Description |
---|---|
List<ColumnMetaData> |
getAllReadColumns() |
TableMetaData |
getChild() |
List<TableMetaData> |
getChildPlusExtTables() |
List<ColumnMetaData> |
getChildReadColumns() |
protected String |
getColumnDatabaseName(SqlResourceDefinition definition,
ResultSetMetaData resultSetMetaData,
int colNumber)
Retrieves database name from result set meta data.
|
protected String |
getColumnName(SqlResourceDefinition definition,
ResultSetMetaData resultSetMetaData,
int colNumber)
Retrieves actual column name from result set meta data.
|
protected String |
getColumnTableName(SqlResourceDefinition definition,
ResultSetMetaData resultSetMetaData,
int colNumber)
Retrieves table name from result set meta data.
|
TableMetaData |
getJoin() |
List<TableMetaData> |
getJoinList() |
int |
getNumberTables() |
TableMetaData |
getParent() |
List<TableMetaData> |
getParentPlusExtTables() |
List<ColumnMetaData> |
getParentReadColumns() |
protected abstract String |
getQualifiedColumnLabel(String tableName,
String qualifiedTableName,
boolean readOnly,
String label)
Retrieves label disambiguated for duplication.
|
protected String |
getQualifiedColumnName(String tableName,
String qualifiedTableName,
boolean readOnly,
String name)
Returns fully qualified column name in database-specific form for use in SQL statements.
|
protected abstract String |
getQualifiedTableName(Connection connection,
String databaseName,
String tableName)
Retrieves database-specific table name used in SQL statements.
|
protected abstract String |
getQualifiedTableName(SqlResourceDefinition definition,
ResultSetMetaData resultSetMetaData,
int colNumber)
Retrieves database-specific table name used in SQL statements.
|
protected abstract String |
getSqlColumnsQuery()
Retrieves sql for querying columns.
|
protected String |
getSqlMainQuery(SqlResourceDefinition definition,
SqlBuilder sqlBuilder)
Retrieves sql for the main query based on the definition.
|
protected abstract String |
getSqlPkQuery()
Retrieves sql for querying primary keys.
|
Map<String,TableMetaData> |
getTableMap() |
List<TableMetaData> |
getTables() |
List<TableMetaData> |
getWriteTables(Request.Type requestType,
boolean doParent)
Determines the tables to use for write, possibly substituting the parent+, child+ or join table for query tables.
|
boolean |
hasJoinTable() |
boolean |
hasMultipleDatabases() |
void |
init(String resName,
SqlResourceDefinition definition,
SqlBuilder sqlBuilder)
Populates metadata using definition.
|
protected boolean |
isColumnReadOnly(ResultSetMetaData resultSetMetaData,
int colNumber)
Return whether a column in the given result set is read-only.
|
protected boolean |
isDbMetaDataUpperCase()
Returns true if db metadata, e.g.
|
boolean |
isHierarchical() |
protected abstract void |
setSequenceMetaData(ColumnMetaDataImpl column,
ResultSet resultSet)
Sets sequence metadata for a column with the columns query result set.
|
String |
toHtml()
Returns HTML representation.
|
String |
toXml()
Returns XML representation.
|
public List<ColumnMetaData> getAllReadColumns()
getAllReadColumns
in interface SqlResourceMetaData
public TableMetaData getChild()
getChild
in interface SqlResourceMetaData
public List<TableMetaData> getChildPlusExtTables()
getChildPlusExtTables
in interface SqlResourceMetaData
public List<ColumnMetaData> getChildReadColumns()
getChildReadColumns
in interface SqlResourceMetaData
public TableMetaData getJoin()
getJoin
in interface SqlResourceMetaData
public List<TableMetaData> getJoinList()
getJoinList
in interface SqlResourceMetaData
public int getNumberTables()
getNumberTables
in interface SqlResourceMetaData
public TableMetaData getParent()
getParent
in interface SqlResourceMetaData
public List<TableMetaData> getParentPlusExtTables()
getParentPlusExtTables
in interface SqlResourceMetaData
public List<ColumnMetaData> getParentReadColumns()
getParentReadColumns
in interface SqlResourceMetaData
public Map<String,TableMetaData> getTableMap()
getTableMap
in interface SqlResourceMetaData
public List<TableMetaData> getTables()
getTables
in interface SqlResourceMetaData
public List<TableMetaData> getWriteTables(Request.Type requestType, boolean doParent)
getWriteTables
in interface SqlResourceMetaData
public boolean hasJoinTable()
hasJoinTable
in interface SqlResourceMetaData
public boolean hasMultipleDatabases()
hasMultipleDatabases
in interface SqlResourceMetaData
public void init(String resName, SqlResourceDefinition definition, SqlBuilder sqlBuilder) throws SqlResourceException
init
in interface SqlResourceMetaData
SqlResourceException
public boolean isHierarchical()
isHierarchical
in interface SqlResourceMetaData
public String toHtml()
toHtml
in interface SqlResourceMetaData
public String toXml()
toXml
in interface SqlResourceMetaData
protected String getColumnDatabaseName(SqlResourceDefinition definition, ResultSetMetaData resultSetMetaData, int colNumber) throws SQLException
SQLException
protected String getColumnName(SqlResourceDefinition definition, ResultSetMetaData resultSetMetaData, int colNumber) throws SQLException
SQLException
protected String getColumnTableName(SqlResourceDefinition definition, ResultSetMetaData resultSetMetaData, int colNumber) throws SQLException
SQLException
protected abstract String getQualifiedColumnLabel(String tableName, String qualifiedTableName, boolean readOnly, String label)
protected String getQualifiedColumnName(String tableName, String qualifiedTableName, boolean readOnly, String name)
database.table.column
, for example sakila.film.film_id
. PostgreSQL uses the form
database.schema.table.column
, for example sakila.public.film.film_id
.tableName
- table namequalifiedTableName
- qualified table namereadOnly
- true if column is a functionname
- base column nameprotected abstract String getQualifiedTableName(Connection connection, String databaseName, String tableName) throws SQLException
SQLException
protected abstract String getQualifiedTableName(SqlResourceDefinition definition, ResultSetMetaData resultSetMetaData, int colNumber) throws SQLException
SQLException
protected abstract String getSqlColumnsQuery()
protected String getSqlMainQuery(SqlResourceDefinition definition, SqlBuilder sqlBuilder) throws InvalidRequestException
InvalidRequestException
- if main query is invalidprotected abstract String getSqlPkQuery()
protected boolean isColumnReadOnly(ResultSetMetaData resultSetMetaData, int colNumber) throws SQLException
resultSetMetaData
- Result set metadatacolNumber
- Column number (1..N)SQLException
- if a database access error occursprotected boolean isDbMetaDataUpperCase()
protected abstract void setSequenceMetaData(ColumnMetaDataImpl column, ResultSet resultSet) throws SQLException
SQLException
- when a database error occursCopyright © 2011-2018 restSQL Project Contributors