|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.jdbc.core.metadata.GenericTableMetaDataProvider
public class GenericTableMetaDataProvider
A generic implementation of the TableMetaDataProvider
that should provide
enough features for all supported databases.
Nested Class Summary | |
---|---|
private static class |
GenericTableMetaDataProvider.TableMetaData
Inner class representing table meta data. |
Field Summary | |
---|---|
private java.lang.String |
databaseVersion
the version of the database |
private boolean |
generatedKeysColumnNameArraySupported
indicates whether the use of a String[] for generated keys is supported |
private boolean |
getGeneratedKeysSupported
indicates whether generated keys retrieval is supported |
private java.util.List<TableParameterMetaData> |
insertParameterMetaData
Collection of TableParameterMetaData objects |
protected static Log |
logger
Logger available to subclasses |
private NativeJdbcExtractor |
nativeJdbcExtractor
NativeJdbcExtractor that can be used to retrieve the native connection |
private java.util.List |
productsNotSupportingGeneratedKeysColumnNameArray
database products we know not supporting the use of a String[] for generated keys |
private boolean |
storesLowerCaseIdentifiers
indicates whether the identifiers are lowercased |
private boolean |
storesUpperCaseIdentifiers
indicates whether the identifiers are uppercased |
private boolean |
tableColumnMetaDataUsed
indicator whether column metadata should be used |
private java.lang.String |
userName
the name of the user currently connected |
Constructor Summary | |
---|---|
protected |
GenericTableMetaDataProvider(java.sql.DatabaseMetaData databaseMetaData)
Constructor used to initialize with provided database meta data. |
Method Summary | |
---|---|
java.lang.String |
catalogNameToUse(java.lang.String catalogName)
Get the catalog name formatted based on metadata information. |
protected java.lang.String |
getDatabaseVersion()
Provide access to version info for subclasses. |
protected NativeJdbcExtractor |
getNativeJdbcExtractor()
|
java.lang.String |
getSimpleQueryForGetGeneratedKey(java.lang.String tableName,
java.lang.String keyColumnName)
Get the simple query to retrieve a generated key |
java.util.List<TableParameterMetaData> |
getTableParameterMetaData()
Get the table parameter metadata that is currently used. |
void |
initializeWithMetaData(java.sql.DatabaseMetaData databaseMetaData)
Initialize using the database metedata provided |
void |
initializeWithTableColumnMetaData(java.sql.DatabaseMetaData databaseMetaData,
java.lang.String catalogName,
java.lang.String schemaName,
java.lang.String tableName)
Initialize using provided database metadata, table and column information. |
boolean |
isGeneratedKeysColumnNameArraySupported()
Does this database support a column name String array for retreiving generated keys Connection.createStruct(String, Object[]) |
boolean |
isGetGeneratedKeysSimulated()
Does this database support a simple quey to retrieve the generated key whe the JDBC 3.0 feature of retreiving generated keys is not supported DatabaseMetaData.supportsGetGeneratedKeys() |
boolean |
isGetGeneratedKeysSupported()
Does this database support the JDBC 3.0 feature of retreiving generated keys DatabaseMetaData.supportsGetGeneratedKeys() |
boolean |
isStoresLowerCaseIdentifiers()
Get whether identifiers use lower case |
boolean |
isStoresUpperCaseIdentifiers()
Get whether identifiers use upper case |
boolean |
isTableColumnMetaDataUsed()
Are we using the meta data for the table columns? |
private void |
locateTableAndProcessMetaData(java.sql.DatabaseMetaData databaseMetaData,
java.lang.String catalogName,
java.lang.String schemaName,
java.lang.String tableName)
Method supporting the metedata processing for a table. |
java.lang.String |
metaDataCatalogNameToUse(java.lang.String catalogName)
Provide any modification of the catalog name passed in to match the meta data currently used. |
java.lang.String |
metaDataSchemaNameToUse(java.lang.String schemaName)
Provide any modification of the schema name passed in to match the meta data currently used. |
private void |
processTableColumns(java.sql.DatabaseMetaData databaseMetaData,
GenericTableMetaDataProvider.TableMetaData tmd)
Method supporting the metedata processing for a table's columns |
java.lang.String |
schemaNameToUse(java.lang.String schemaName)
Get the schema name formatted based on metadata information. |
void |
setGeneratedKeysColumnNameArraySupported(boolean generatedKeysColumnNameArraySupported)
Specify whether a column name array is supported for generated keys |
void |
setGetGeneratedKeysSupported(boolean getGeneratedKeysSupported)
Specify whether a column name array is supported for generated keys |
void |
setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor)
Set the NativeJdbcExtractor to use to retrieve the native connection if necessary |
void |
setStoresLowerCaseIdentifiers(boolean storesLowerCaseIdentifiers)
Specify whether identifiers use lower case. |
void |
setStoresUpperCaseIdentifiers(boolean storesUpperCaseIdentifiers)
Specify whether identifiers use upper case |
java.lang.String |
tableNameToUse(java.lang.String tableName)
Get the table name formatted based on metadata information. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final Log logger
private boolean tableColumnMetaDataUsed
private java.lang.String databaseVersion
private java.lang.String userName
private boolean storesUpperCaseIdentifiers
private boolean storesLowerCaseIdentifiers
private boolean getGeneratedKeysSupported
private boolean generatedKeysColumnNameArraySupported
private java.util.List productsNotSupportingGeneratedKeysColumnNameArray
private java.util.List<TableParameterMetaData> insertParameterMetaData
private NativeJdbcExtractor nativeJdbcExtractor
Constructor Detail |
---|
protected GenericTableMetaDataProvider(java.sql.DatabaseMetaData databaseMetaData) throws java.sql.SQLException
databaseMetaData
- meta data to be used
java.sql.SQLException
Method Detail |
---|
public void setStoresUpperCaseIdentifiers(boolean storesUpperCaseIdentifiers)
public boolean isStoresUpperCaseIdentifiers()
public void setStoresLowerCaseIdentifiers(boolean storesLowerCaseIdentifiers)
public boolean isStoresLowerCaseIdentifiers()
public boolean isTableColumnMetaDataUsed()
TableMetaDataProvider
isTableColumnMetaDataUsed
in interface TableMetaDataProvider
public java.util.List<TableParameterMetaData> getTableParameterMetaData()
TableMetaDataProvider
getTableParameterMetaData
in interface TableMetaDataProvider
TableParameterMetaData
public boolean isGetGeneratedKeysSupported()
TableMetaDataProvider
DatabaseMetaData.supportsGetGeneratedKeys()
isGetGeneratedKeysSupported
in interface TableMetaDataProvider
public boolean isGetGeneratedKeysSimulated()
TableMetaDataProvider
DatabaseMetaData.supportsGetGeneratedKeys()
isGetGeneratedKeysSimulated
in interface TableMetaDataProvider
public java.lang.String getSimpleQueryForGetGeneratedKey(java.lang.String tableName, java.lang.String keyColumnName)
TableMetaDataProvider
getSimpleQueryForGetGeneratedKey
in interface TableMetaDataProvider
public void setGetGeneratedKeysSupported(boolean getGeneratedKeysSupported)
public void setGeneratedKeysColumnNameArraySupported(boolean generatedKeysColumnNameArraySupported)
public boolean isGeneratedKeysColumnNameArraySupported()
TableMetaDataProvider
Connection.createStruct(String, Object[])
isGeneratedKeysColumnNameArraySupported
in interface TableMetaDataProvider
public void setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor)
TableMetaDataProvider
NativeJdbcExtractor
to use to retrieve the native connection if necessary
setNativeJdbcExtractor
in interface TableMetaDataProvider
protected NativeJdbcExtractor getNativeJdbcExtractor()
public void initializeWithMetaData(java.sql.DatabaseMetaData databaseMetaData) throws java.sql.SQLException
TableMetaDataProvider
initializeWithMetaData
in interface TableMetaDataProvider
java.sql.SQLException
public void initializeWithTableColumnMetaData(java.sql.DatabaseMetaData databaseMetaData, java.lang.String catalogName, java.lang.String schemaName, java.lang.String tableName) throws java.sql.SQLException
TableMetaDataProvider
initializeWithTableColumnMetaData
in interface TableMetaDataProvider
databaseMetaData
- used to retrieve database specific informationcatalogName
- name of catalog to use or nullschemaName
- name of schema name to use or nulltableName
- name of the table
java.sql.SQLException
public java.lang.String tableNameToUse(java.lang.String tableName)
TableMetaDataProvider
tableNameToUse
in interface TableMetaDataProvider
public java.lang.String catalogNameToUse(java.lang.String catalogName)
TableMetaDataProvider
catalogNameToUse
in interface TableMetaDataProvider
public java.lang.String schemaNameToUse(java.lang.String schemaName)
TableMetaDataProvider
schemaNameToUse
in interface TableMetaDataProvider
public java.lang.String metaDataCatalogNameToUse(java.lang.String catalogName)
TableMetaDataProvider
metaDataCatalogNameToUse
in interface TableMetaDataProvider
public java.lang.String metaDataSchemaNameToUse(java.lang.String schemaName)
TableMetaDataProvider
metaDataSchemaNameToUse
in interface TableMetaDataProvider
protected java.lang.String getDatabaseVersion()
private void locateTableAndProcessMetaData(java.sql.DatabaseMetaData databaseMetaData, java.lang.String catalogName, java.lang.String schemaName, java.lang.String tableName)
private void processTableColumns(java.sql.DatabaseMetaData databaseMetaData, GenericTableMetaDataProvider.TableMetaData tmd)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |