Polishing

This commit is contained in:
Juergen Hoeller
2018-01-19 19:35:02 +01:00
parent a73d9bbed5
commit 8b5a013423
12 changed files with 108 additions and 128 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,43 +51,43 @@ import org.springframework.util.StringUtils;
*/
public class CallMetaDataContext {
/** Logger available to subclasses */
// Logger available to subclasses
protected final Log logger = LogFactory.getLog(getClass());
/** name of procedure to call **/
// Name of procedure to call
private String procedureName;
/** name of catalog for call **/
// Name of catalog for call
private String catalogName;
/** name of schema for call **/
// Name of schema for call
private String schemaName;
/** List of SqlParameter objects to be used in call execution */
// List of SqlParameter objects to be used in call execution
private List<SqlParameter> callParameters = new ArrayList<SqlParameter>();
/** Actual name to use for the return value in the output map */
// Actual name to use for the return value in the output map
private String actualFunctionReturnName;
/** Set of in parameter names to exclude use for any not listed */
// Set of in parameter names to exclude use for any not listed
private Set<String> limitedInParameterNames = new HashSet<String>();
/** List of SqlParameter names for out parameters */
// List of SqlParameter names for out parameters
private List<String> outParameterNames = new ArrayList<String>();
/** Indicates whether this is a procedure or a function **/
// Indicates whether this is a procedure or a function
private boolean function = false;
/** Indicates whether this procedure's return value should be included **/
// Indicates whether this procedure's return value should be included
private boolean returnValueRequired = false;
/** Should we access call parameter meta data info or not */
// Should we access call parameter meta data info or not
private boolean accessCallParameterMetaData = true;
/** Should we bind parameter by name **/
// Should we bind parameter by name
private boolean namedBinding;
/** The provider of call meta data */
// The provider of call meta data
private CallMetaDataProvider metaDataProvider;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,34 +44,34 @@ import org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor;
*/
public class TableMetaDataContext {
/** Logger available to subclasses */
// Logger available to subclasses
protected final Log logger = LogFactory.getLog(getClass());
/** Name of table for this context */
// Name of table for this context
private String tableName;
/** Name of catalog for this context */
// Name of catalog for this context
private String catalogName;
/** Name of schema for this context */
// Name of schema for this context
private String schemaName;
/** List of columns objects to be used in this context */
// List of columns objects to be used in this context
private List<String> tableColumns = new ArrayList<String>();
/** should we access insert parameter meta data info or not */
// Should we access insert parameter meta data info or not
private boolean accessTableColumnMetaData = true;
/** should we override default for including synonyms for meta data lookups */
// Should we override default for including synonyms for meta data lookups
private boolean overrideIncludeSynonymsDefault = false;
/** the provider of table meta data */
// The provider of table meta data
private TableMetaDataProvider metaDataProvider;
/** are we using generated key columns */
// Are we using generated key columns
private boolean generatedKeyColumnsUsed = false;
/** NativeJdbcExtractor to be used to retrieve the native connection */
// NativeJdbcExtractor to be used to retrieve the native connection
NativeJdbcExtractor nativeJdbcExtractor;
@@ -204,8 +204,8 @@ public class TableMetaDataContext {
*/
public List<Object> matchInParameterValuesWithInsertColumns(SqlParameterSource parameterSource) {
List<Object> values = new ArrayList<Object>();
// for parameter source lookups we need to provide caseinsensitive lookup support since the
// database metadata is not necessarily providing case sensitive column names
// For parameter source lookups we need to provide case-insensitive lookup support since the
// database metadata is not necessarily providing case-sensitive column names
Map<String, String> caseInsensitiveParameterNames =
SqlParameterSourceUtils.extractCaseInsensitiveParameterNames(parameterSource);
for (String column : this.tableColumns) {
@@ -224,9 +224,8 @@ public class TableMetaDataContext {
}
else {
if (caseInsensitiveParameterNames.containsKey(lowerCaseName)) {
values.add(
SqlParameterSourceUtils.getTypedValue(parameterSource,
caseInsensitiveParameterNames.get(lowerCaseName)));
values.add(SqlParameterSourceUtils.getTypedValue(
parameterSource, caseInsensitiveParameterNames.get(lowerCaseName)));
}
else {
values.add(null);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,6 +70,20 @@ public class BeanPropertySqlParameterSource extends AbstractSqlParameterSource {
}
}
/**
* Derives a default SQL type from the corresponding property type.
* @see org.springframework.jdbc.core.StatementCreatorUtils#javaTypeToSqlParameterType
*/
@Override
public int getSqlType(String paramName) {
int sqlType = super.getSqlType(paramName);
if (sqlType != TYPE_UNKNOWN) {
return sqlType;
}
Class<?> propType = this.beanWrapper.getPropertyType(paramName);
return StatementCreatorUtils.javaTypeToSqlParameterType(propType);
}
/**
* Provide access to the property names of the wrapped bean.
* Uses support provided in the {@link PropertyAccessor} interface.
@@ -89,18 +103,4 @@ public class BeanPropertySqlParameterSource extends AbstractSqlParameterSource {
return this.propertyNames;
}
/**
* Derives a default SQL type from the corresponding property type.
* @see org.springframework.jdbc.core.StatementCreatorUtils#javaTypeToSqlParameterType
*/
@Override
public int getSqlType(String paramName) {
int sqlType = super.getSqlType(paramName);
if (sqlType != TYPE_UNKNOWN) {
return sqlType;
}
Class<?> propType = this.beanWrapper.getPropertyType(paramName);
return StatementCreatorUtils.javaTypeToSqlParameterType(propType);
}
}