Class DBCommonColumn
- All Implemented Interfaces:
DBColumn
Thus, the writer of an ADQL query can use the column name without table prefix (since after the join there will be only one) or with a prefix table of the joined tables. The list of all covered tables is stored in this object and can be extended in case of several JOINs.
- Since:
- 1.2
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDBCommonColumn
(DBColumn leftCol, DBColumn rightCol) Create a column which merges both of the given columns.DBCommonColumn
(DBCommonColumn toCopy, String dbName, String adqlName) Constructor by copy. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addCoveredTable
(DBTable table) Add a table that this common column must cover from now.WARNING: This copy function does not make a real copy of this DBCommonColumn! It returns a modified copy of the general column description it contains.final String
Gets the name of this column.Get an iterator over the list of all tables covered by this common column.final DBType
Get the type of this column (as closed as possible from the "database" type).final String
Gets the name of this column in the "database" (e.g.final DBTable
getTable()
Gets the table which contains thisDBColumn
.final boolean
Tell whether the column name used in ADQL queries must be delimited (i.e.
-
Field Details
-
generalColumnDesc
-
lstCoveredTables
-
-
Constructor Details
-
DBCommonColumn
Create a column which merges both of the given columns.This special
DBColumn
implementation is not associated with one table, and can be listed in aDBTable
ONLY IF the latter is the result of a sub-query (seeADQLQuery.getResultingColumns()
).A column resulting from a tables join is common only to the joined tables. That's why a list of all tables covered by this column is created or update at each merge. It can be accessed thanks to
getCoveredTables()
.Note: In the case one or both of the columns to join are
DBCommonColumn
, the list of their covered tables are also merged.- Parameters:
leftCol
- Column of the left join table. May be aDBCommonColumn
.rightCol
- Column of the right join table. May be aDBCommonColumn
.- Throws:
UnresolvedJoinException
- If the type of the two given columns are not roughly (just testing numeric, string or geometry) compatible.
-
DBCommonColumn
Constructor by copy. It returns a copy of this instance ofDBCommonColumn
.Note: The list of covered tables is NOT deeply copied!
- Parameters:
toCopy
- TheDBCommonColumn
to copy.dbName
- The new DB name of thisDBCommonColumn
.adqlName
- The new ADQL name of thisDBCommonColumn
.
-
-
Method Details
-
getADQLName
Description copied from interface:DBColumn
Gets the name of this column.Notes: The returned ADQL name is:
- non-empty/NULL
- non-delimited (i.e. not between double quotes),
- non-prefixed (i.e. no table/schema/catalog name)
- and in the same case as provided at initialization (even if not case sensitive).
- Specified by:
getADQLName
in interfaceDBColumn
- Returns:
- Its ADQL name.
-
isCaseSensitive
public final boolean isCaseSensitive()Description copied from interface:DBColumn
Tell whether the column name used in ADQL queries must be delimited (i.e. surrounded by"
). In such case, it will be case sensitive.- Specified by:
isCaseSensitive
in interfaceDBColumn
- Returns:
true
if the ADQL column name is case sensitive,false
otherwise.
-
getDBName
Description copied from interface:DBColumn
Gets the name of this column in the "database" (e.g. as it should be used in SQL queries).Notes The returned DB name is:
- non-empty/NULL
- non-delimited (i.e. not between double quotes),
- non-prefixed (i.e. no table/schema/catalog name)
- and in the EXACT case as it MUST be used.
-
getDatatype
Description copied from interface:DBColumn
Get the type of this column (as closed as possible from the "database" type).Note: The returned type should be as closed as possible from a type listed by the IVOA in the TAP protocol description into the section UPLOAD.
- Specified by:
getDatatype
in interfaceDBColumn
- Returns:
- Its type.
-
getTable
Description copied from interface:DBColumn
Gets the table which contains thisDBColumn
. -
getCoveredTables
Get an iterator over the list of all tables covered by this common column.- Returns:
- Iterator over all covered tables.
-
addCoveredTable
Add a table that this common column must cover from now.Warning: No unicity check is never done!
- Parameters:
table
- Table to add in the covered tables list.
-
copy
WARNING: This copy function does not make a real copy of this DBCommonColumn! It returns a modified copy of the general column description it contains.
Note: To make a real copy of this DBCommonColumn use the Constructor by copy
DBCommonColumn(DBCommonColumn, String, String)
.
-