org.eclipse.jpt.db
Interface Database

All Superinterfaces:
DatabaseObject, SchemaContainer

public interface Database
extends SchemaContainer

Database

Provisional API: This interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.


Field Summary
 
Fields inherited from interface org.eclipse.jpt.db.DatabaseObject
DEFAULT_COMPARATOR, IDENTIFIER_TRANSFORMER, NAME_TRANSFORMER
 
Method Summary
 java.lang.String convertNameToIdentifier(java.lang.String name)
          Convert the specified name to a database-appropriate SQL identifier.
 Catalog getCatalogForIdentifier(java.lang.String identifier)
          Return the catalog for the specified identifier.
 Catalog getCatalogNamed(java.lang.String name)
          Return the catalog with specified name.
 java.lang.Iterable<Catalog> getCatalogs()
          Return the database's catalogs.
 int getCatalogsSize()
          Return the number of catalogs the database contains.
 Catalog getDefaultCatalog()
          Return the database's "default" catalog, as defined by the database vendor.
 java.lang.String getDefaultCatalogIdentifier()
          Return the database's "default" catalog identifier.
 java.lang.Iterable<java.lang.String> getSortedCatalogIdentifiers()
          Return the database's catalog identifiers, sorted by name.
 java.lang.Iterable<java.lang.String> getSortedCatalogNames()
          Return the database's catalog names, sorted.
 java.lang.String getVendorName()
          Return the name of the database's vendor.
 java.lang.String getVersion()
          Return the database's version.
<T extends DatabaseObject>
T
selectDatabaseObjectForIdentifier(java.lang.Iterable<T> databaseObjects, java.lang.String identifier)
          Select and return from the specified list of database objects the database object identified by the specified identifier.
 boolean supportsCatalogs()
          Return whether the database supports catalogs.
 
Methods inherited from interface org.eclipse.jpt.db.SchemaContainer
getDefaultSchema, getDefaultSchemaIdentifier, getSchemaForIdentifier, getSchemaNamed, getSchemata, getSchemataSize, getSortedSchemaIdentifiers, getSortedSchemaNames
 
Methods inherited from interface org.eclipse.jpt.db.DatabaseObject
getConnectionProfile, getDatabase, getIdentifier, getIdentifier, getName
 

Method Detail

getVendorName

java.lang.String getVendorName()
Return the name of the database's vendor.


getVersion

java.lang.String getVersion()
Return the database's version.


supportsCatalogs

boolean supportsCatalogs()
Return whether the database supports catalogs. If it does, all database objects are contained by the database's catalogs; otherwise all database objects are contained by the database's schemata.
Practically speaking: This is complicated by the presence of a "default" catalog that clients can use to allow the specification of a catalog to be optional; but clients must manage this explicitly.

See Also:
getCatalogs(), SchemaContainer.getSchemata()

getCatalogs

java.lang.Iterable<Catalog> getCatalogs()
Return the database's catalogs. Return an empty iterable if the database does not support catalogs.

See Also:
supportsCatalogs()

getCatalogsSize

int getCatalogsSize()
Return the number of catalogs the database contains. Return zero if the database does not support catalogs.

See Also:
supportsCatalogs()

getSortedCatalogNames

java.lang.Iterable<java.lang.String> getSortedCatalogNames()
Return the database's catalog names, sorted. Return an empty iterable if the database does not support catalogs. This is useful when the user is selecting a catalog from a read-only combo-box (e.g. in a wizard).

See Also:
getSortedCatalogIdentifiers(), getCatalogNamed(String)

getCatalogNamed

Catalog getCatalogNamed(java.lang.String name)
Return the catalog with specified name. The name must be an exact match of the catalog's name. Return null if the database does not support catalogs.

See Also:
supportsCatalogs(), getSortedCatalogNames(), getCatalogForIdentifier(String)

getSortedCatalogIdentifiers

java.lang.Iterable<java.lang.String> getSortedCatalogIdentifiers()
Return the database's catalog identifiers, sorted by name. Return an empty iterable if the database does not support catalogs. This is useful when the user is selecting an identifier that will be placed in a text file (e.g. in a Java annotation).

See Also:
getSortedCatalogNames(), getCatalogForIdentifier(String)

getCatalogForIdentifier

Catalog getCatalogForIdentifier(java.lang.String identifier)
Return the catalog for the specified identifier. The identifier should be an SQL identifier (i.e. quoted when case-sensitive or containing special characters, unquoted otherwise). Return null if the database does not support catalogs.

See Also:
supportsCatalogs(), getSortedCatalogIdentifiers(), getCatalogNamed(String)

getDefaultCatalog

Catalog getDefaultCatalog()
Return the database's "default" catalog, as defined by the database vendor. In most cases the default catalog's name will match the user name. Return null if the database does not support catalogs or if the default catalog does not exist (e.g. the database has no catalog whose name matches the user name).

See Also:
supportsCatalogs(), getDefaultCatalogIdentifier()

getDefaultCatalogIdentifier

java.lang.String getDefaultCatalogIdentifier()
Return the database's "default" catalog identifier. The database may or may not have a catalog with a matching name.

See Also:
supportsCatalogs(), getDefaultCatalog()

selectDatabaseObjectForIdentifier

<T extends DatabaseObject> T selectDatabaseObjectForIdentifier(java.lang.Iterable<T> databaseObjects,
                                                               java.lang.String identifier)
Select and return from the specified list of database objects the database object identified by the specified identifier. The identifier should be an SQL identifier (i.e. delimited when non-"normal").


convertNameToIdentifier

java.lang.String convertNameToIdentifier(java.lang.String name)
Convert the specified name to a database-appropriate SQL identifier.