Skip to content

Commit 1141a1d

Browse files
committed
polishing
1 parent dd79506 commit 1141a1d

File tree

3 files changed

+46
-38
lines changed

3 files changed

+46
-38
lines changed

org.springframework.jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataContext.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2010 the original author or authors.
2+
* Copyright 2002-2011 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -239,8 +239,8 @@ public SqlParameter createReturnResultSetParameter(String parameterName, RowMapp
239239
}
240240

241241
/**
242-
* Get the name of the single out parameter for this call. If there are multiple parameters then the name of
243-
* the first one is returned.
242+
* Get the name of the single out parameter for this call.
243+
* If there are multiple parameters, the name of the first one will be returned.
244244
*/
245245
public String getScalarOutParameterName() {
246246
if (isFunction()) {
@@ -255,32 +255,32 @@ public String getScalarOutParameterName() {
255255
}
256256

257257
/**
258-
* Get the List of SqlParameter objects to be used in call execution
258+
* Get the List of SqlParameter objects to be used in call execution.
259259
*/
260260
public List<SqlParameter> getCallParameters() {
261261
return this.callParameters;
262262
}
263263

264264
/**
265-
* Initialize this class with metadata from the database
265+
* Initialize this class with metadata from the database.
266266
* @param dataSource the DataSource used to retrieve metadata
267267
*/
268268
public void initializeMetaData(DataSource dataSource) {
269269
this.metaDataProvider = CallMetaDataProviderFactory.createMetaDataProvider(dataSource, this);
270270
}
271271

272272
/**
273-
* Process the list of parameters provided and if procedure column metadata is used the
274-
* parameters will be matched against the metadata information and any missing ones will
275-
* be automatically included
273+
* Process the list of parameters provided, and if procedure column metadata is used,
274+
* the parameters will be matched against the metadata information and any missing
275+
* ones will be automatically included.
276276
* @param parameters the list of parameters to use as a base
277277
*/
278278
public void processParameters(List<SqlParameter> parameters) {
279279
this.callParameters = reconcileParameters(parameters);
280280
}
281281

282282
/**
283-
* Reconcile the provided parameters with available metadata and add new ones where appropriate
283+
* Reconcile the provided parameters with available metadata and add new ones where appropriate.
284284
*/
285285
protected List<SqlParameter> reconcileParameters(List<SqlParameter> parameters) {
286286
final List<SqlParameter> declaredReturnParameters = new ArrayList<SqlParameter>();
@@ -289,7 +289,7 @@ protected List<SqlParameter> reconcileParameters(List<SqlParameter> parameters)
289289
List<String> outParameterNames = new ArrayList<String>();
290290
List<String> metaDataParameterNames = new ArrayList<String>();
291291

292-
// get the names of the meta data parameters
292+
// Get the names of the meta data parameters
293293
for (CallParameterMetaData meta : this.metaDataProvider.getCallParameterMetaData()) {
294294
if (meta.getParameterType() != DatabaseMetaData.procedureColumnReturn) {
295295
metaDataParameterNames.add(meta.getParameterName().toLowerCase());
@@ -424,7 +424,6 @@ else if (meta.getParameterType() == DatabaseMetaData.procedureColumnInOut) {
424424
}
425425

426426
return workParameters;
427-
428427
}
429428

430429
/**
@@ -565,8 +564,8 @@ public Map<String, Object> matchInParameterValuesWithCallParameters(SqlParameter
565564
public String createCallString() {
566565
String callString;
567566
int parameterCount = 0;
568-
String catalogNameToUse = null;
569-
String schemaNameToUse = null;
567+
String catalogNameToUse;
568+
String schemaNameToUse;
570569

571570
// For Oracle where catalogs are not supported we need to reverse the schema name
572571
// and the catalog name since the cataog is used for the package name

org.springframework.jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericCallMetaDataProvider.java

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2008 the original author or authors.
2+
* Copyright 2002-2011 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -95,48 +95,60 @@ public void initializeWithMetaData(DatabaseMetaData databaseMetaData) throws SQL
9595
}
9696
}
9797

98-
public void initializeWithProcedureColumnMetaData(DatabaseMetaData databaseMetaData, String catalogName, String schemaName, String procedureName)
99-
throws SQLException {
98+
public void initializeWithProcedureColumnMetaData(DatabaseMetaData databaseMetaData, String catalogName,
99+
String schemaName, String procedureName) throws SQLException {
100100

101101
this.procedureColumnMetaDataUsed = true;
102102
processProcedureColumns(databaseMetaData, catalogName, schemaName, procedureName);
103103
}
104104

105105
public List<CallParameterMetaData> getCallParameterMetaData() {
106-
return callParameterMetaData;
106+
return this.callParameterMetaData;
107107
}
108108

109109
public String procedureNameToUse(String procedureName) {
110-
if (procedureName == null)
110+
if (procedureName == null) {
111111
return null;
112-
else if (isStoresUpperCaseIdentifiers())
112+
}
113+
else if (isStoresUpperCaseIdentifiers()) {
113114
return procedureName.toUpperCase();
114-
else if(isStoresLowerCaseIdentifiers())
115+
}
116+
else if(isStoresLowerCaseIdentifiers()) {
115117
return procedureName.toLowerCase();
116-
else
118+
}
119+
else {
117120
return procedureName;
121+
}
118122
}
119123

120124
public String catalogNameToUse(String catalogName) {
121-
if (catalogName == null)
125+
if (catalogName == null) {
122126
return null;
123-
else if (isStoresUpperCaseIdentifiers())
127+
}
128+
else if (isStoresUpperCaseIdentifiers()) {
124129
return catalogName.toUpperCase();
125-
else if(isStoresLowerCaseIdentifiers())
130+
}
131+
else if(isStoresLowerCaseIdentifiers()) {
126132
return catalogName.toLowerCase();
127-
else
128-
return catalogName;
133+
}
134+
else {
135+
return catalogName;
136+
}
129137
}
130138

131139
public String schemaNameToUse(String schemaName) {
132-
if (schemaName == null)
140+
if (schemaName == null) {
133141
return null;
134-
else if (isStoresUpperCaseIdentifiers())
142+
}
143+
else if (isStoresUpperCaseIdentifiers()) {
135144
return schemaName.toUpperCase();
136-
else if(isStoresLowerCaseIdentifiers())
145+
}
146+
else if(isStoresLowerCaseIdentifiers()) {
137147
return schemaName.toLowerCase();
138-
else
139-
return schemaName;
148+
}
149+
else {
150+
return schemaName;
151+
}
140152
}
141153

142154
public String metaDataCatalogNameToUse(String catalogName) {

org.springframework.jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcCall.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2010 the original author or authors.
2+
* Copyright 2002-2011 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -198,7 +198,7 @@ public boolean isReturnValueRequired() {
198198
/**
199199
* Add a declared parameter to the list of parameters for the call.
200200
* Only parameters declared as <code>SqlParameter</code> and <code>SqlInOutParameter</code>
201-
* will be used to provide input values. This is different from the <code>StoredProcedure</code> class
201+
* will be used to provide input values. This is different from the <code>StoredProcedure</code> class
202202
* which for backwards compatibility reasons allows input values to be provided for parameters declared
203203
* as <code>SqlOutParameter</code>.
204204
* @param parameter the {@link SqlParameter} to add
@@ -237,14 +237,14 @@ public void addDeclaredRowMapper(String parameterName, ParameterizedRowMapper ro
237237
}
238238

239239
/**
240-
* Get the call string that should be used based on parameters and meta data
240+
* Get the call string that should be used based on parameters and meta data.
241241
*/
242242
public String getCallString() {
243243
return this.callString;
244244
}
245245

246246
/**
247-
* Specify whether the parameter metadata for the call should be used. The default is true.
247+
* Specify whether the parameter metadata for the call should be used. The default is true.
248248
*/
249249
public void setAccessCallParameterMetaData(boolean accessCallParameterMetaData) {
250250
this.callMetaDataContext.setAccessCallParameterMetaData(accessCallParameterMetaData);
@@ -267,17 +267,14 @@ public synchronized final void compile() throws InvalidDataAccessApiUsageExcepti
267267
if (getProcedureName() == null) {
268268
throw new InvalidDataAccessApiUsageException("Procedure or Function name is required");
269269
}
270-
271270
try {
272271
this.jdbcTemplate.afterPropertiesSet();
273272
}
274273
catch (IllegalArgumentException ex) {
275274
throw new InvalidDataAccessApiUsageException(ex.getMessage());
276275
}
277-
278276
compileInternal();
279277
this.compiled = true;
280-
281278
if (logger.isDebugEnabled()) {
282279
logger.debug("SqlCall for " + (isFunction() ? "function" : "procedure") + " [" + getProcedureName() + "] compiled");
283280
}

0 commit comments

Comments
 (0)