Skip navigation links
com.sigmadynamics.server.DataServices.DatabaseProvider
Class DatabaseInfo
java.lang.Object
com.sigmadynamics.server.DataServices.DatabaseProvider.DatabaseInfo
-
public class DatabaseInfo
- extends java.lang.Object
This Class has a static allInfoObjects that holds instances of the class. There is a 1 to 1 mapping between instances of this class and a datasource. Hence, any one instance is specific to a particular vendor, user, and, if applicable, database (in the Sql Server sense).
Constructor Summary |
DatabaseInfo(java.sql.DatabaseMetaData md, java.lang.String currentCatalogName)
|
Method Summary |
java.lang.String |
composeFullName(java.lang.String catalog, java.lang.String schema, java.lang.String objectName)
|
protected StoredProcCacheEntry |
createProcCacheEntry(java.sql.Connection conn, java.lang.String[] identifiers)
|
protected TableCacheEntry |
createTableCacheEntry(java.lang.String catalog, java.lang.String schema, java.lang.String tableName)
|
java.lang.String |
getCatalog()
|
(package private) java.lang.String |
getCatalogNameFromCatalog(java.lang.String catalog, java.sql.DatabaseMetaData md)
|
protected void |
getColumnInfoFromMetaData(TableCacheEntry ce, java.sql.Connection conn)
|
protected void |
getColumnInfoFromMetaData(TableCacheEntry ce, java.sql.DatabaseMetaData md)
|
int |
getDatabaseType()
|
protected java.lang.String |
getDefaultCatalogName(java.sql.DatabaseMetaData md, java.lang.String currentName)
|
protected java.lang.String |
getDefaultSchemaName(java.sql.DatabaseMetaData md)
|
protected java.lang.String[] |
getIdentifiers(java.lang.String name)
|
static DatabaseInfo |
getInstance(java.lang.String dsName, javax.sql.DataSource ds)
|
java.util.Comparator |
getNameComparator()
|
DatabaseFactory |
getObjectFactory()
|
protected void |
getParmInfofromMetaData(java.sql.DatabaseMetaData md, java.lang.String[] identifiers, StoredProcCacheEntry ce)
|
StoredProcCacheEntry |
getProcedureInfo(DatabaseProviderInterface dbp, java.lang.String procName, boolean refresh)
|
protected java.lang.String |
getProcNameFromMetaData(java.lang.String[] identifiers, java.lang.String namePattern, java.sql.DatabaseMetaData md)
|
java.lang.String |
getSchema()
|
(package private) java.lang.String |
getSchemaNameFromCatalog(java.lang.String catalog, java.lang.String schema, java.sql.DatabaseMetaData md)
|
(package private) java.util.List |
getSchemaNamesFromCatalog(java.lang.String catalog, java.sql.DatabaseMetaData md)
|
TableCacheEntry |
getTableInfo(DatabaseProviderInterface dbp, java.lang.String tableName, boolean refresh)
Get a cache object for a table. |
protected java.lang.String |
getTableNameFromMetaData(java.lang.String[] identifiers, java.lang.String namePattern, java.sql.DatabaseMetaData md)
|
boolean |
isCaseSensitive()
|
protected static boolean |
isTransientProblem(java.sql.Connection conn, java.sql.SQLException ex)
|
protected java.lang.String |
quoteName(java.lang.String name)
enclose name in double quotation characters |
void |
remoteProcedureEntry(java.lang.String procName)
|
void |
removeTableEntry(java.lang.String tableName)
|
boolean |
supportsBatchUpdates()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
protected static final SDCategory log
tables
protected final java.util.Hashtable<java.lang.String,TableCacheEntry> tables
procs
protected final java.util.Hashtable<java.lang.String,StoredProcCacheEntry> procs
supportsBatchUpdates
protected boolean supportsBatchUpdates
caseSensitive
protected boolean caseSensitive
defaultCatalogName
protected java.lang.String defaultCatalogName
defaultSchemaName
protected java.lang.String defaultSchemaName
usesCatalog
protected boolean usesCatalog
usesSchema
protected boolean usesSchema
doUpperCaseOnName
protected boolean doUpperCaseOnName
DatabaseInfo
public DatabaseInfo(java.sql.DatabaseMetaData md,
java.lang.String currentCatalogName)
getObjectFactory
public DatabaseFactory getObjectFactory()
getDefaultSchemaName
protected java.lang.String getDefaultSchemaName(java.sql.DatabaseMetaData md)
getDefaultCatalogName
protected java.lang.String getDefaultCatalogName(java.sql.DatabaseMetaData md,
java.lang.String currentName)
getDatabaseType
public int getDatabaseType()
getCatalog
public java.lang.String getCatalog()
getSchema
public java.lang.String getSchema()
getInstance
public static DatabaseInfo getInstance(java.lang.String dsName,
javax.sql.DataSource ds)
supportsBatchUpdates
public boolean supportsBatchUpdates()
isCaseSensitive
public boolean isCaseSensitive()
getIdentifiers
protected java.lang.String[] getIdentifiers(java.lang.String name)
getTableNameFromMetaData
protected java.lang.String getTableNameFromMetaData(java.lang.String[] identifiers,
java.lang.String namePattern,
java.sql.DatabaseMetaData md)
getProcNameFromMetaData
protected java.lang.String getProcNameFromMetaData(java.lang.String[] identifiers,
java.lang.String namePattern,
java.sql.DatabaseMetaData md)
composeFullName
public java.lang.String composeFullName(java.lang.String catalog,
java.lang.String schema,
java.lang.String objectName)
getTableInfo
public TableCacheEntry getTableInfo(DatabaseProviderInterface dbp,
java.lang.String tableName,
boolean refresh)
throws DatabaseProviderException
- Get a cache object for a table. This object contains the names of the table and its columns as it should be used in the SQL statement.
This function tries to get the table info from the cache. If info for the table isn't in the cache, it calls another function to create a cache entry and then puts it in the cache before returning. This function purposefully puts things into the cache based on the original string, even though it may need to add info to find metadata about the item using jdbc. That is, if the string is "fred" and we really need "sd.dbo.fred" to properly get at the object, we assume that the system will typically always use the same form, i.e. it is more likely that the system will again refer to this as "fred" rather than "sd.dbo.fred", "sd..fred" etc. So, we make sure that we can find the cache entry again by keying on the original name. The system could be made to be a little smarter so that it figures out that "fred" and "sd.dbo.fred" can use the same cache entry but it's not clear that that additional complexity is worth doing at this time. If the data source can't get metadata, then it doesn't throw an exception but a null is returned
-
- Parameters:
tableName
-
- Returns:
- a table cache entry. A null return indicates that we can't get metadata from this data source.
- Throws:
DatabaseProviderException
- this RuntimeException is thrown if, for example, the requested table does not exist in the database.
removeTableEntry
public void removeTableEntry(java.lang.String tableName)
getProcedureInfo
public StoredProcCacheEntry getProcedureInfo(DatabaseProviderInterface dbp,
java.lang.String procName,
boolean refresh)
remoteProcedureEntry
public void remoteProcedureEntry(java.lang.String procName)
getCatalogNameFromCatalog
java.lang.String getCatalogNameFromCatalog(java.lang.String catalog,
java.sql.DatabaseMetaData md)
getSchemaNameFromCatalog
java.lang.String getSchemaNameFromCatalog(java.lang.String catalog,
java.lang.String schema,
java.sql.DatabaseMetaData md)
getSchemaNamesFromCatalog
java.util.List getSchemaNamesFromCatalog(java.lang.String catalog,
java.sql.DatabaseMetaData md)
createTableCacheEntry
protected TableCacheEntry createTableCacheEntry(java.lang.String catalog,
java.lang.String schema,
java.lang.String tableName)
createProcCacheEntry
protected StoredProcCacheEntry createProcCacheEntry(java.sql.Connection conn,
java.lang.String[] identifiers)
getParmInfofromMetaData
protected void getParmInfofromMetaData(java.sql.DatabaseMetaData md,
java.lang.String[] identifiers,
StoredProcCacheEntry ce)
getColumnInfoFromMetaData
protected void getColumnInfoFromMetaData(TableCacheEntry ce,
java.sql.DatabaseMetaData md)
getColumnInfoFromMetaData
protected void getColumnInfoFromMetaData(TableCacheEntry ce,
java.sql.Connection conn)
isTransientProblem
protected static boolean isTransientProblem(java.sql.Connection conn,
java.sql.SQLException ex)
quoteName
protected final java.lang.String quoteName(java.lang.String name)
- enclose name in double quotation characters
-
- Parameters:
name
-
getNameComparator
public java.util.Comparator getNameComparator()
-
- Returns:
- Returns the name Comparator
Skip navigation links
Copyright © 2010, 2011, Oracle. All rights reserved.