类 TableMetaDataContext
- java.lang.Object
- org.springframework.jdbc.core.metadata.TableMetaDataContext
public class TableMetaDataContext extends Object
Class to manage context meta-data used for the configuration and execution of operations on a database table.- 从以下版本开始:
- 2.5
- 作者:
- Thomas Risberg, Juergen Hoeller
构造器概要
构造器 构造器 说明 TableMetaDataContext()
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 String
createInsertString(String... generatedKeyNames)
Build the insert string based on configuration and meta-data information.int[]
createInsertTypes()
Build the array ofTypes
based on configuration and meta-data information.String
getCatalogName()
Get the name of the catalog for this context.String
getSchemaName()
Get the name of the schema for this context.String
getSimpleQueryForGetGeneratedKey(String tableName, String keyColumnName)
Does this database support a simple query to retrieve generated keys when the JDBC 3.0 feature is not supported:DatabaseMetaData.supportsGetGeneratedKeys()
?String
getSimulationQueryForGetGeneratedKey(String tableName, String keyColumnName)
已过时。as of 4.3.15, in favor ofgetSimpleQueryForGetGeneratedKey(java.lang.String, java.lang.String)
List<String>
getTableColumns()
Get a List of the table column names.String
getTableName()
Get the name of the table for this context.boolean
isAccessTableColumnMetaData()
Are we accessing table meta-data?boolean
isGeneratedKeysColumnNameArraySupported()
Is a column name String array for retrieving generated keys supported:Connection.createStruct(String, Object[])
?boolean
isGetGeneratedKeysSimulated()
Does this database support simple query to retrieve generated keys when the JDBC 3.0 feature is not supported:DatabaseMetaData.supportsGetGeneratedKeys()
?boolean
isGetGeneratedKeysSupported()
Does this database support the JDBC 3.0 feature of retrieving generated keys:DatabaseMetaData.supportsGetGeneratedKeys()
?boolean
isOverrideIncludeSynonymsDefault()
Are we overriding include synonyms default?List<Object>
matchInParameterValuesWithInsertColumns(Map<String,?> inParameters)
Match the provided column names and values with the list of columns used.List<Object>
matchInParameterValuesWithInsertColumns(SqlParameterSource parameterSource)
Match the provided column names and values with the list of columns used.void
processMetaData(DataSource dataSource, List<String> declaredColumns, String[] generatedKeyNames)
Process the current meta-data with the provided configuration options.protected List<String>
reconcileColumnsToUse(List<String> declaredColumns, String[] generatedKeyNames)
Compare columns created from meta-data with declared columns and return a reconciled list.void
setAccessTableColumnMetaData(boolean accessTableColumnMetaData)
Specify whether we should access table column meta-data.void
setCatalogName(String catalogName)
Set the name of the catalog for this context.void
setOverrideIncludeSynonymsDefault(boolean override)
Specify whether we should override default for accessing synonyms.void
setSchemaName(String schemaName)
Set the name of the schema for this context.void
setTableName(String tableName)
Set the name of the table for this context.
构造器详细资料
TableMetaDataContext
public TableMetaDataContext()
方法详细资料
setTableName
public void setTableName(@Nullable String tableName)
Set the name of the table for this context.
getTableName
@Nullable public String getTableName()
Get the name of the table for this context.
setCatalogName
public void setCatalogName(@Nullable String catalogName)
Set the name of the catalog for this context.
getCatalogName
@Nullable public String getCatalogName()
Get the name of the catalog for this context.
setSchemaName
public void setSchemaName(@Nullable String schemaName)
Set the name of the schema for this context.
getSchemaName
@Nullable public String getSchemaName()
Get the name of the schema for this context.
setAccessTableColumnMetaData
public void setAccessTableColumnMetaData(boolean accessTableColumnMetaData)
Specify whether we should access table column meta-data.
isAccessTableColumnMetaData
public boolean isAccessTableColumnMetaData()
Are we accessing table meta-data?
setOverrideIncludeSynonymsDefault
public void setOverrideIncludeSynonymsDefault(boolean override)
Specify whether we should override default for accessing synonyms.
isOverrideIncludeSynonymsDefault
public boolean isOverrideIncludeSynonymsDefault()
Are we overriding include synonyms default?
getTableColumns
public List<String> getTableColumns()
Get a List of the table column names.
processMetaData
public void processMetaData(DataSource dataSource, List<String> declaredColumns, String[] generatedKeyNames)
Process the current meta-data with the provided configuration options.- 参数:
dataSource
- the DataSource being useddeclaredColumns
- any columns that are declaredgeneratedKeyNames
- name of generated keys
reconcileColumnsToUse
protected List<String> reconcileColumnsToUse(List<String> declaredColumns, String[] generatedKeyNames)
Compare columns created from meta-data with declared columns and return a reconciled list.- 参数:
declaredColumns
- declared column namesgeneratedKeyNames
- names of generated key columns
matchInParameterValuesWithInsertColumns
public List<Object> matchInParameterValuesWithInsertColumns(SqlParameterSource parameterSource)
Match the provided column names and values with the list of columns used.- 参数:
parameterSource
- the parameter names and values
matchInParameterValuesWithInsertColumns
public List<Object> matchInParameterValuesWithInsertColumns(Map<String,?> inParameters)
Match the provided column names and values with the list of columns used.- 参数:
inParameters
- the parameter names and values
createInsertString
public String createInsertString(String... generatedKeyNames)
Build the insert string based on configuration and meta-data information.- 返回:
- the insert string to be used
createInsertTypes
public int[] createInsertTypes()
Build the array ofTypes
based on configuration and meta-data information.- 返回:
- the array of types to be used
isGetGeneratedKeysSupported
public boolean isGetGeneratedKeysSupported()
Does this database support the JDBC 3.0 feature of retrieving generated keys:DatabaseMetaData.supportsGetGeneratedKeys()
?
isGetGeneratedKeysSimulated
public boolean isGetGeneratedKeysSimulated()
Does this database support simple query to retrieve generated keys when the JDBC 3.0 feature is not supported:DatabaseMetaData.supportsGetGeneratedKeys()
?
getSimulationQueryForGetGeneratedKey
@Deprecated @Nullable public String getSimulationQueryForGetGeneratedKey(String tableName, String keyColumnName)
已过时。as of 4.3.15, in favor ofgetSimpleQueryForGetGeneratedKey(java.lang.String, java.lang.String)
Does this database support a simple query to retrieve generated keys when the JDBC 3.0 feature is not supported:DatabaseMetaData.supportsGetGeneratedKeys()
?
getSimpleQueryForGetGeneratedKey
@Nullable public String getSimpleQueryForGetGeneratedKey(String tableName, String keyColumnName)
Does this database support a simple query to retrieve generated keys when the JDBC 3.0 feature is not supported:DatabaseMetaData.supportsGetGeneratedKeys()
?
isGeneratedKeysColumnNameArraySupported
public boolean isGeneratedKeysColumnNameArraySupported()
Is a column name String array for retrieving generated keys supported:Connection.createStruct(String, Object[])
?