Class ADQLTable
- All Implemented Interfaces:
ADQLObject
,FromContent
A table reference may have an alias (MUST if it is a sub-query).
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBuilds a reference to a sub-query.Builds an ADQL table by copying the given one.Builds a reference to a table with its name (simple or full ({catalog}.{schema}.{table})).Builds a reference to a table with its name and the name of its schema.Builds a reference to a table with its name, the name of its schema and the name of its catalog. -
Method Summary
Modifier and TypeMethodDescriptionGets an iterator on the intern ADQL objects.final String
getAlias()
Gets the label of this table.final byte
Gets the whole case sensitivity of this ADQL table.final String
Gets the name of the catalog which contains this table.getCopy()
Gets a (deep) copy of this ADQL object.Gets the list of all columns (~ database metadata) available in this FROM part.final DBTable
Gets the correspondingDBTable
.final LanguageFeature
Get the description of this ADQL's Language Feature.final String
Gets the full name of this table (catalogName .getName()
Gets the name of this object in ADQL.final TextPosition
Gets the position in the original ADQL query string.final String
Gets the name of the schema which contains this table.final ADQLSet
Gets the sub-query used as table.final String
Gets the name of the table.getTablesByAlias
(String alias, boolean caseSensitive) Gets all the table whose the alias is equals to the given one.final boolean
hasAlias()
Tells whether this table has an alias or not.final boolean
Indicates whether all fields (catalog, schema and table) are case sensitive.final boolean
isCaseSensitive
(IdentifierField field) Indicates whether the specified field (catalog, schema or table) is case sensitive or not.final boolean
Tells whether this table reference is a sub-query or a table name/alias.protected String
normalizeName
(String name, IdentifierField field) Lets normalizing any catalog/schema/table name or alias.final void
(Re-)Builds a default description of this ADQL table ONLY IF it is a sub-query AND there is an alias.void
Sets the label of this table.final void
setCaseSensitive
(boolean sensitive) Sets the case sensitivity of all fields (catalog, schema and table).final void
setCaseSensitive
(byte sensitivity) Sets the whole case sensitivity of this ADQL table.final void
setCaseSensitive
(IdentifierField field, boolean sensitive) Sets the case sensitivity of the specified field (catalog, schema or table).final void
setCatalogName
(String catalog) Sets the name of the catalog which contains this table.final void
final void
setPosition
(TextPosition pos) Sets the position at which thisADQLTable
has been found in the original ADQL query string.final void
setSchemaName
(String schema) Sets the name of the schema which contains this table.final void
setSubQuery
(ADQLSet query) Sets the sub-query to use as table.final void
Updates the whole Table according to the given table reference ({catalog}.{schema}.{table}).void
setTableName
(String newTableName) Sets the name of the table.toADQL()
Gets the ADQL expression of this object.
-
Field Details
-
FEATURE
Description of this ADQL Feature.- Since:
- 2.0
-
-
Constructor Details
-
ADQLTable
Builds a reference to a table with its name (simple or full ({catalog}.{schema}.{table})).- Parameters:
table
- Name of the table (simple or full ({catalog}.{schema}.{table})).
-
ADQLTable
Builds a reference to a table with its name and the name of its schema.- Parameters:
schema
- Name of its schema.table
- Name of the table.
-
ADQLTable
Builds a reference to a table with its name, the name of its schema and the name of its catalog.- Parameters:
catalog
- Name of its catalog.schema
- Name of its schema.table
- Name of the table.
-
ADQLTable
Builds a reference to a sub-query.- Parameters:
query
- Sub-query.- See Also:
-
ADQLTable
Builds an ADQL table by copying the given one.- Parameters:
toCopy
- The ADQLTable to copy.- Throws:
Exception
- If there is an error during the copy.
-
-
Method Details
-
getFeatureDescription
Description copied from interface:ADQLObject
Get the description of this ADQL's Language Feature.Note: Getting this description is generally only useful when discovery optional features so that determining if they are allowed to be used in ADQL queries.
- Specified by:
getFeatureDescription
in interfaceADQLObject
- Returns:
- Description of this ADQL object as an ADQL's feature.
-
normalizeName
Lets normalizing any catalog/schema/table name or alias.If the name is surrounded by double-quotes, they are removed and the corresponding field will be declared as case sensitive.
- Parameters:
name
- Name to normalize.field
- The name part to normalize and to get (if normalized, the case sensitivity of the given field will be set).- Returns:
- The normalized name.
-
getPosition
Gets the position in the original ADQL query string.- Specified by:
getPosition
in interfaceADQLObject
- Returns:
- The position of this
ADQLTable
.
-
setPosition
Sets the position at which thisADQLTable
has been found in the original ADQL query string.- Specified by:
setPosition
in interfaceFromContent
- Parameters:
pos
- Position of thisADQLTable
.
-
getCatalogName
Gets the name of the catalog which contains this table.- Returns:
- Catalog name.
-
setCatalogName
Sets the name of the catalog which contains this table.- Parameters:
catalog
- The new name of its catalog.
-
getSchemaName
Gets the name of the schema which contains this table.- Returns:
- Schema name.
-
setSchemaName
Sets the name of the schema which contains this table.- Parameters:
schema
- The new name of its schema.
-
getTableName
Gets the name of the table.- Returns:
- Table name.
-
getFullTableName
Gets the full name of this table (catalogName . schemaName . tableName) by respecting the case sensitivity of each field (if case sensitive double-quotes will surround the concerned fields name).- Returns:
- Its full name.
-
setTableName
Sets the name of the table.- Parameters:
newTableName
- The new name of the table.
-
setTable
Updates the whole Table according to the given table reference ({catalog}.{schema}.{table}).- Parameters:
tableRef
- The complete table reference ({catalog}.{schema}.{table}).
-
getSubQuery
Gets the sub-query used as table.- Returns:
- Sub-query.
-
setSubQuery
Sets the sub-query to use as table.- Parameters:
query
- Sub-query (MUST NOT BE NULL).- See Also:
-
refreshDBLink
public final void refreshDBLink()(Re-)Builds a default description of this ADQL table ONLY IF it is a sub-query AND there is an alias. This method has no effect if this table is not a sub-query or has no alias.- See Also:
-
isSubQuery
public final boolean isSubQuery()Tells whether this table reference is a sub-query or a table name/alias.- Returns:
true
if this table is a sub-query,false
else.
-
getAlias
Gets the label of this table.- Returns:
- Table label.
-
hasAlias
public final boolean hasAlias()Tells whether this table has an alias or not.- Returns:
true
if this table has an alias,false
otherwise.
-
setAlias
Sets the label of this table.- Parameters:
alias
- Label to put on this table.
-
isCaseSensitive
Indicates whether the specified field (catalog, schema or table) is case sensitive or not.- Parameters:
field
- A field (catalog, schema or table).- Returns:
true
if the specified field is case sensitive,false
otherwise.- See Also:
-
setCaseSensitive
Sets the case sensitivity of the specified field (catalog, schema or table).- Parameters:
field
- The field for which the case sensitivity must be updated.sensitive
-true
if the specified field must be case sensitive,false
otherwise.- See Also:
-
isCaseSensitive
public final boolean isCaseSensitive()Indicates whether all fields (catalog, schema and table) are case sensitive.- Returns:
true
if all fields are case sensitive,false
otherwise.- See Also:
-
setCaseSensitive
public final void setCaseSensitive(boolean sensitive) Sets the case sensitivity of all fields (catalog, schema and table).- Parameters:
sensitive
-true
if all fields must be case sensitive,false
otherwise.- See Also:
-
getCaseSensitive
public final byte getCaseSensitive()Gets the whole case sensitivity of this ADQL table.- Returns:
- Its new case sensitivity (one bit per fields).
- See Also:
-
setCaseSensitive
public final void setCaseSensitive(byte sensitivity) Sets the whole case sensitivity of this ADQL table.- Parameters:
sensitivity
- Its new case sensitivity (one bit per fields).- See Also:
-
getDBLink
Gets the correspondingDBTable
.Note: This information is added automatically by
DBChecker
whenDBChecker.check(adql.query.ADQLSet)
is called.- Returns:
- The corresponding
DBTable
.
-
setDBLink
- Parameters:
dbLink
- Its correspondingDBTable
.
-
getDBColumns
Description copied from interface:FromContent
Gets the list of all columns (~ database metadata) available in this FROM part.Note: In the most cases, this list is generated on the fly !
- Specified by:
getDBColumns
in interfaceFromContent
- Returns:
- All the available
DBColumn
s.
-
getTables
Description copied from interface:FromContent
- Specified by:
getTables
in interfaceFromContent
- Returns:
- The list of all
ADQLTable
s found.
-
getTablesByAlias
Description copied from interface:FromContent
Gets all the table whose the alias is equals to the given one.Note: Theoretically, only one table may be returned. But, since this object may be generated without the parser, it is possible that several
ADQLTable
objects exits with the same alias (particularly if there are JOIN).- Specified by:
getTablesByAlias
in interfaceFromContent
- Parameters:
alias
- Alias of the table(s) to get.caseSensitive
-true
if the research must be made with case-sensitivity,false
otherwise.- Returns:
- The list of all tables found.
-
getCopy
Description copied from interface:ADQLObject
Gets a (deep) copy of this ADQL object.- Specified by:
getCopy
in interfaceADQLObject
- Returns:
- The copy of this ADQL object.
- Throws:
Exception
- If there is any error during the copy.
-
getName
Description copied from interface:ADQLObject
Gets the name of this object in ADQL.- Specified by:
getName
in interfaceADQLObject
- Returns:
- The name of this ADQL object.
-
adqlIterator
Description copied from interface:ADQLObject
Gets an iterator on the intern ADQL objects.Note: The returned iterator is particularly used by a
ISearchHandler
extension to browse a whole ADQL tree.- Specified by:
adqlIterator
in interfaceADQLObject
- Returns:
- An ADQL objects iterator.
- See Also:
-
toADQL
Description copied from interface:ADQLObject
Gets the ADQL expression of this object.- Specified by:
toADQL
in interfaceADQLObject
- Returns:
- The corresponding ADQL expression.
-