public class ADQLTable extends java.lang.Object implements ADQLObject, FromContent
Constructor and Description |
---|
ADQLTable(ADQLQuery query)
Builds a reference to a sub-query.
|
ADQLTable(ADQLTable toCopy)
Builds an ADQL table by copying the given one.
|
ADQLTable(java.lang.String table)
Builds a reference to a table with its name (simple or full ({catalog}.{schema}.{table})).
|
ADQLTable(java.lang.String schema,
java.lang.String table)
Builds a reference to a table with its name and the name of its schema.
|
ADQLTable(java.lang.String catalog,
java.lang.String schema,
java.lang.String table)
Builds a reference to a table with its name, the name of its schema and the name of its catalog.
|
Modifier and Type | Method and Description |
---|---|
ADQLIterator |
adqlIterator()
Gets an iterator on the intern ADQL objects.
|
java.lang.String |
getAlias()
Gets the label of this table.
|
byte |
getCaseSensitive()
Gets the whole case sensitivity of this ADQL table.
|
java.lang.String |
getCatalogName()
Gets the name of the catalog which contains this table.
|
ADQLObject |
getCopy()
Gets a (deep) copy of this ADQL object.
|
SearchColumnList |
getDBColumns()
Gets the list of all columns (~ database metadata) available in this FROM part.
|
DBTable |
getDBLink()
Gets the corresponding
DBTable . |
java.lang.String |
getFullTableName()
Gets the full name of this table (catalogName .
|
java.lang.String |
getName()
Gets the name of this object in ADQL.
|
TextPosition |
getPosition()
Gets the position in the original ADQL query string.
|
java.lang.String |
getSchemaName()
Gets the name of the schema which contains this table.
|
ADQLQuery |
getSubQuery()
Gets the sub-query used as table.
|
java.lang.String |
getTableName()
Gets the name of the table.
|
java.util.List<ADQLTable> |
getTables()
|
java.util.List<ADQLTable> |
getTablesByAlias(java.lang.String alias,
boolean caseSensitive)
Gets all the table whose the alias is equals to the given one.
|
boolean |
hasAlias()
Tells whether this table has an alias or not.
|
boolean |
isCaseSensitive()
Indicates whether all fields (catalog, schema and table) are case sensitive.
|
boolean |
isCaseSensitive(IdentifierField field)
Indicates whether the specified field (catalog, schema or table) is case sensitive or not.
|
boolean |
isSubQuery()
Tells whether this table reference is a sub-query or a table name/alias.
|
protected java.lang.String |
normalizeName(java.lang.String name,
IdentifierField field)
Lets normalizing any catalog/schema/table name or alias.
|
void |
refreshDBLink()
(Re-)Builds a default description of this ADQL table ONLY IF it is a sub-query AND there is an alias.
|
void |
setAlias(java.lang.String alias)
Sets the label of this table.
|
void |
setCaseSensitive(boolean sensitive)
Sets the case sensitivity of all fields (catalog, schema and table).
|
void |
setCaseSensitive(byte sensitivity)
Sets the whole case sensitivity of this ADQL table.
|
void |
setCaseSensitive(IdentifierField field,
boolean sensitive)
Sets the case sensitivity of the specified field (catalog, schema or table).
|
void |
setCatalogName(java.lang.String catalog)
Sets the name of the catalog which contains this table.
|
void |
setDBLink(DBTable dbLink)
|
void |
setPosition(TextPosition pos)
Sets the position at which this
ADQLTable has been found in the original ADQL query string. |
void |
setSchemaName(java.lang.String schema)
Sets the name of the schema which contains this table.
|
void |
setSubQuery(ADQLQuery query)
Sets the sub-query to use as table.
|
void |
setTable(java.lang.String tableRef)
Updates the whole Table according to the given table reference ({catalog}.{schema}.{table}).
|
void |
setTableName(java.lang.String newTableName)
Sets the name of the table.
|
java.lang.String |
toADQL()
Gets the ADQL expression of this object.
|
public ADQLTable(java.lang.String table)
table
- Name of the table (simple or full ({catalog}.{schema}.{table})).public ADQLTable(java.lang.String schema, java.lang.String table)
schema
- Name of its schema.table
- Name of the table.public ADQLTable(java.lang.String catalog, java.lang.String schema, java.lang.String table)
catalog
- Name of its catalog.schema
- Name of its schema.table
- Name of the table.public ADQLTable(ADQLQuery query)
query
- Sub-query.setSubQuery(ADQLQuery)
public ADQLTable(ADQLTable toCopy) throws java.lang.Exception
toCopy
- The ADQLTable to copy.java.lang.Exception
- If there is an error during the copy.protected java.lang.String normalizeName(java.lang.String name, IdentifierField field)
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.
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).public final TextPosition getPosition()
getPosition
in interface ADQLObject
ADQLTable
.public final void setPosition(TextPosition pos)
ADQLTable
has been found in the original ADQL query string.setPosition
in interface FromContent
pos
- Position of this ADQLTable
.public final java.lang.String getCatalogName()
public final void setCatalogName(java.lang.String catalog)
catalog
- The new name of its catalog.public final java.lang.String getSchemaName()
public final void setSchemaName(java.lang.String schema)
schema
- The new name of its schema.public final java.lang.String getTableName()
public final java.lang.String getFullTableName()
public void setTableName(java.lang.String newTableName)
newTableName
- The new name of the table.public final void setTable(java.lang.String tableRef)
tableRef
- The complete table reference ({catalog}.{schema}.{table}).public final ADQLQuery getSubQuery()
public final void setSubQuery(ADQLQuery query)
query
- Sub-query (MUST NOT BE NULL).refreshDBLink()
public final void refreshDBLink()
public final boolean isSubQuery()
public final java.lang.String getAlias()
public final boolean hasAlias()
public void setAlias(java.lang.String alias)
alias
- Label to put on this table.public final boolean isCaseSensitive(IdentifierField field)
field
- A field (catalog, schema or table).IdentifierField
,
IdentifierField.isCaseSensitive(byte)
public final void setCaseSensitive(IdentifierField field, boolean sensitive)
field
- The field for which the case sensitivity must be updated.sensitive
- true if the specified field must be case sensitive, false otherwise.IdentifierField
,
IdentifierField.setCaseSensitive(byte, boolean)
public final boolean isCaseSensitive()
IdentifierField.isFullCaseSensitive(byte)
public final void setCaseSensitive(boolean sensitive)
sensitive
- true if all fields must be case sensitive, false otherwise.IdentifierField.getFullCaseSensitive(boolean)
public final byte getCaseSensitive()
IdentifierField
public final void setCaseSensitive(byte sensitivity)
sensitivity
- Its new case sensitivity (one bit per fields).IdentifierField
public final DBTable getDBLink()
Gets the corresponding DBTable
.
Note: This information is added automatically by DBChecker
when DBChecker.check(adql.query.ADQLQuery)
is called.
DBTable
.public final void setDBLink(DBTable dbLink)
dbLink
- Its corresponding DBTable
.public SearchColumnList getDBColumns()
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 !
getDBColumns
in interface FromContent
DBColumn
s.public java.util.List<ADQLTable> getTables()
FromContent
getTables
in interface FromContent
ADQLTable
s found.public java.util.List<ADQLTable> getTablesByAlias(java.lang.String alias, boolean caseSensitive)
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).
getTablesByAlias
in interface FromContent
alias
- Alias of the table(s) to get.caseSensitive
- true if the research must be made with case-sensitivity, false otherwise.public ADQLObject getCopy() throws java.lang.Exception
ADQLObject
getCopy
in interface ADQLObject
java.lang.Exception
- If there is any error during the copy.public java.lang.String getName()
ADQLObject
getName
in interface ADQLObject
public ADQLIterator adqlIterator()
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.
adqlIterator
in interface ADQLObject
ADQLIterator
,
ISearchHandler
public java.lang.String toADQL()
ADQLObject
toADQL
in interface ADQLObject