Class DefaultDBTable
DBTable
.
WARNING: constructors signature and behavior changed since v2.0!
Before v2.0, the constructors expected to have the DB names before the ADQL
names and thus, they forced to give a DB table name ; the ADQL table name
being optional (if not provided it was set to the DB name).
But since v2.0, this logic is inverted: the ADQL name is mandatory (a
NullPointerException
will be thrown if NULL or empty) while the DB
name is optional (DBIdentifier.getDBName()
will return the same as
DBIdentifier.getADQLName()
if no DB name is specified at initialization).
Consequently, the ADQL names are expected as first parameters.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
protected String
protected String
protected String
Fields inherited from class adql.db.DBIdentifier
adqlCaseSensitive, adqlName, dbName
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultDBTable
(String adqlName) Builds a defaultDBTable
with the given ADQL name.DefaultDBTable
(String adqlName, String dbName) Builds a defaultDBTable
with the given ADQL and DB names.DefaultDBTable
(String adqlCatName, String adqlSchemaName, String adqlName) Builds defaultDBTable
with a ADQL catalog, schema and table names.DefaultDBTable
(String adqlCatName, String dbCatName, String adqlSchemaName, String dbSchemaName, String adqlName, String dbName) Builds defaultDBTable
with the ADQL and DB 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 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 DB name of the schema which contains this table.boolean
iterator()
static final String
joinTableName
(String[] nameParts) Deprecated.Since v2.0, the table name is not any more split automatically.void
setADQLCatalogName
(String name) void
setADQLSchemaName
(String name) final void
setDBCatalogName
(String name) final void
setDBSchemaName
(String name) static final String[]
splitTableName
(String table) Deprecated.Since v2.0, the table name is not any more split automatically.Methods inherited from class adql.db.DBIdentifier
denormalize, getADQLName, getDBName, isCaseSensitive, isDelimited, normalize, setADQLName, setCaseSensitive, setDBName
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface adql.db.DBTable
getADQLName, getDBName, isCaseSensitive
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
dbCatalogName
-
dbSchemaName
-
adqlCatalogName
-
adqlSchemaName
-
columns
-
-
Constructor Details
-
DefaultDBTable
Builds a defaultDBTable
with the given ADQL name.With this constructor: DB name = ADQL name.
Note: The ADQL/DB schema and catalog names are set to NULL.
WARNING: The ADQL table name MUST be NON-qualified (i.e. not prefixed by a schema and/or a catalog)! For instance,
t1
is ok, but notschema1.t1
orcat1.schema1.t2
which won't be split but instead, considered as the whole ADQL name.Important note: The ADQL table name can be delimited (i.e. surrounded by double quotes). In such case, the surrounded name would be considered as case-sensitive.
- Parameters:
adqlName
- The ADQL name of this table (i.e. name to use in ADQL).- Throws:
NullPointerException
- If the given ADQL name is NULL or empty.- Since:
- 2.0
-
DefaultDBTable
Builds a defaultDBTable
with the given ADQL and DB names.Note: The ADQL/DB schema and catalog names are set to NULL.
WARNING: The ADQL table name MUST NOT be qualified (i.e. prefixed by a schema and/or a catalog)! For instance,
t1
is ok, but notschema1.t1
orcat1.schema1.t2
which won't be split but instead, considered as the whole ADQL name.Important note: The ADQL table name can be delimited (i.e. surrounded by double quotes). In such case, the surrounded name would be considered as case-sensitive.
- Parameters:
adqlName
- Name used in ADQL queries.dbName
- Database name. If NULL,DBIdentifier.getDBName()
will return the same asDBIdentifier.getADQLName()
.- Throws:
NullPointerException
- If the given ADQL name is NULL or empty.- Since:
- 2.0
-
DefaultDBTable
public DefaultDBTable(String adqlCatName, String adqlSchemaName, String adqlName) throws NullPointerException Builds defaultDBTable
with a ADQL catalog, schema and table names.WARNING: The ADQL table name MUST NOT be qualified (i.e. prefixed by a schema and/or a catalog)! For instance,
t1
is ok, but notschema1.t1
orcat1.schema1.t2
which won't be split but instead, considered as the whole ADQL name.Important note: The ADQL table name can be delimited (i.e. surrounded by double quotes). In such case, the surrounded name would be considered as case-sensitive.
- Parameters:
adqlCatName
- ADQL catalog name (it will be also used as DB catalog name).adqlSchemaName
- ADQL schema name (it will be also used as DB schema name).adqlName
- ADQL table name (it will be also used as DB table name). MUST NOT be NULL!- Throws:
NullPointerException
- If the given ADQL name is NULL or empty.- Since:
- 2.0
-
DefaultDBTable
public DefaultDBTable(String adqlCatName, String dbCatName, String adqlSchemaName, String dbSchemaName, String adqlName, String dbName) throws NullPointerException Builds defaultDBTable
with the ADQL and DB names for the catalog, schema and table.WARNING: The ADQL table name MUST NOT be qualified (i.e. prefixed by a schema and/or a catalog)! For instance,
t1
is ok, but notschema1.t1
orcat1.schema1.t2
which won't be split but instead, considered as the whole ADQL name.Important note: The ADQL table name can be delimited (i.e. surrounded by double quotes). In such case, the surrounded name would be considered as case-sensitive.
- Parameters:
adqlCatName
- Catalog name used in ADQL queries.dbCatName
- Database catalog name. If NULL, it will be set to adqlCatName.adqlSchemaName
- Schema name used in ADQL queries.dbSchemaName
- Database schema name. If NULL, it will be set to adqlSchemaName.adqlName
- Table name used in ADQL queries. MUST NOT be NULL!dbName
- Database table name. If NULL, it will be set to adqlName.- Throws:
NullPointerException
- If the given ADQL name is NULL or empty.
-
-
Method Details
-
getDBSchemaName
Description copied from interface:DBTable
Gets the DB name of the schema which contains this table.Warning! Same rules as
DBTable.getDBName()
.- Specified by:
getDBSchemaName
in interfaceDBTable
- Returns:
- DB name of its schema.
-
setDBSchemaName
-
getDBCatalogName
Description copied from interface:DBTable
Gets the DB name of the catalog which contains this table.Warning! Same rules as
DBTable.getDBName()
.- Specified by:
getDBCatalogName
in interfaceDBTable
- Returns:
- DB name of its catalog.
-
setDBCatalogName
-
getADQLSchemaName
Description copied from interface:DBTable
Gets the ADQL name of the schema which contains this table.Warning! Same rules as
DBTable.getADQLName()
.- 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.Warning! Same rules as
DBTable.getADQLName()
.- 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
Deprecated.Since v2.0, the table name is not any more split automatically.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
Deprecated.Since v2.0, the table name is not any more split automatically. So, it is not any more needed to join all its parts.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 ofDBTable
, 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).
- 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.
- they may be delimited (that's to say: written between double quotes to force case sensitivity).
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", null)
=> 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 and/or delimited. 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 and/or delimited. 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
.
-