Class DefaultDBTable
- Direct Known Subclasses:
DBTableAlias
DBTable
.- Version:
- 1.4 (08/2015)
- Author:
- Grégory Mantelet (CDS;ARI)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultDBTable
(String dbName) Builds a defaultDBTable
with the given DB name.DefaultDBTable
(String dbName, String adqlName) Builds a defaultDBTable
with the given DB and ADQL names.DefaultDBTable
(String dbCatName, String dbSchemName, String dbName) Builds defaultDBTable
with a DB catalog, schema and table names.DefaultDBTable
(String dbCatName, String adqlCatName, String dbSchemName, String adqlSchemName, String dbName, String adqlName) Builds defaultDBTable
with the DB and ADQL names for the catalog, schema and table. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAllColumns
(Collection<DBColumn> colList) void
Makes a copy of this instance ofDBTable
, with the possibility to change the DB and ADQL names.final String
Gets the ADQL name of the catalog which contains this table.final String
Gets the name of this table (without any prefix and double-quotes).final String
Gets the ADQL name of the schema which contains this table.Case sensitive !final String
Gets the DB name of the catalog which contains this table.final String
Gets the name of this table in the "database".final String
Gets the DB name of the schema which contains this table.boolean
iterator()
static final String
joinTableName
(String[] nameParts) Join the last 3 items of the given string array with a dot ('.').void
setADQLCatalogName
(String name) void
setADQLName
(String name) void
setADQLSchemaName
(String name) static final String[]
splitTableName
(String table) Splits the given table name in 3 parts: catalog, schema, table.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
dbCatalogName
-
dbSchemaName
-
dbName
-
adqlCatalogName
-
adqlSchemaName
-
adqlName
-
columns
-
-
Constructor Details
-
DefaultDBTable
Builds a default
DBTable
with the given DB name.With this constructor: ADQL name = DB name.
Note: The table name can be prefixed by a schema and a catalog: t1 or schema1.t1 or cat1.schema1.t2
- Parameters:
dbName
- Database name (it will be also used as ADQL table name).- See Also:
-
DefaultDBTable
Builds a default
DBTable
with the given DB and ADQL names.Note: The table names can be prefixed by a schema and a catalog: t1 or schema1.t1 or cat1.schema1.t2
- Parameters:
dbName
- Database name.adqlName
- Name used in ADQL queries.
-
DefaultDBTable
Builds defaultDBTable
with a DB catalog, schema and table names.- Parameters:
dbCatName
- Database catalog name (it will be also used as ADQL catalog name).dbSchemName
- Database schema name (it will be also used as ADQL schema name).dbName
- Database table name (it will be also used as ADQL table name).- See Also:
-
DefaultDBTable
public DefaultDBTable(String dbCatName, String adqlCatName, String dbSchemName, String adqlSchemName, String dbName, String adqlName) Builds defaultDBTable
with the DB and ADQL names for the catalog, schema and table.- Parameters:
dbCatName
- Database catalog name.adqlCatName
- Catalog name used in ADQL queries. If NULL, it will be set to dbCatName.dbSchemName
- Database schema name.adqlSchemName
- Schema name used in ADQL queries. If NULL, it will be set to dbSchemName.dbName
- Database table name.adqlName
- Table name used in ADQL queries. If NULL, it will be set to dbName.
-
-
Method Details
-
getDBName
Description copied from interface:DBTable
Gets the name of this table in the "database". -
getDBSchemaName
Description copied from interface:DBTable
Gets the DB name of the schema which contains this table.- Specified by:
getDBSchemaName
in interfaceDBTable
- Returns:
- DB name of its schema.
-
getDBCatalogName
Description copied from interface:DBTable
Gets the DB name of the catalog which contains this table.- Specified by:
getDBCatalogName
in interfaceDBTable
- Returns:
- DB name of its catalog.
-
getADQLName
Description copied from interface:DBTable
Gets the name of this table (without any prefix and double-quotes).- Specified by:
getADQLName
in interfaceDBTable
- Returns:
- Its ADQL name.
-
setADQLName
-
getADQLSchemaName
Description copied from interface:DBTable
Gets the ADQL name of the schema which contains this table.- Specified by:
getADQLSchemaName
in interfaceDBTable
- Returns:
- ADQL name of its schema.
-
setADQLSchemaName
-
getADQLCatalogName
Description copied from interface:DBTable
Gets the ADQL name of the catalog which contains this table.- Specified by:
getADQLCatalogName
in interfaceDBTable
- Returns:
- ADQL name of its catalog.
-
setADQLCatalogName
-
getColumn
Case sensitive !
Research optimized for researches by ADQL name.
- Specified by:
getColumn
in interfaceDBTable
- Parameters:
colName
- Name of the column (may be the ADQL or DB name depending of the second parameter).byAdqlName
- true means the given name is the ADQL name of the column and that the research must be done on the ADQL name of columns, false means the same thing but with the DB name.- Returns:
- The corresponding column, or null if the specified column had not been found.
- See Also:
-
hasColumn
-
iterator
-
addColumn
-
addAllColumns
-
splitTableName
Splits the given table name in 3 parts: catalog, schema, table.- Parameters:
table
- The table name to split.- Returns:
- A String array of 3 items: [0]=catalog, [1]=schema, [0]=table.
-
joinTableName
Join the last 3 items of the given string array with a dot ('.'). These three parts should be: [0]=catalog name, [1]=schema name, [2]=table name.
If the array contains less than 3 items, all the given items will be though joined. However, if it contains more than 3 items, only the three last items will be.
A null item will be written as an empty string (string of length 0 ; "").
In the case the first and the third items are not null, but the second is null, the final string will contain in the middle two dots. Example: if the array is {"cat", NULL, "table"}, then the joined string will be: "cat..table".
- Parameters:
nameParts
- String items to join.- Returns:
- A string joining the 3 last string items of the given array, or an empty string if the given array is NULL.
- Since:
- 1.3
-
copy
Description copied from interface:DBTable
Makes a copy of this instance of
DBTable
, with the possibility to change the DB and ADQL names.IMPORTANT: The given DB and ADQL name may be NULL. If NULL, the copy will contain exactly the same full name (DB and/or ADQL).
And they may be qualified (that's to say: prefixed by the schema name or by the catalog and schema name). It means that it is possible to change the catalog, schema and table name in the copy.
For instance:- .copy(null, "foo") => a copy with the same full DB name, but with no ADQL catalog and schema name and with an ADQL table name equals to "foo"
- .copy("schema.table", ) => a copy with the same full ADQL name, but with no DB catalog name, with a DB schema name equals to "schema" and with a DB table name equals to "table"
- Specified by:
copy
in interfaceDBTable
- Parameters:
dbName
- Its new DB name. It may be qualified. It may also be NULL ; if so, the full DB name won't be different in the copy.adqlName
- Its new ADQL name. It may be qualified. It may also be NULL ; if so, the full DB name won't be different in the copy.- Returns:
- A modified copy of this
DBTable
.
-