Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
4db258b9
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
4db258b9
编写于
8月 11, 2014
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
d100eef8
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
77 addition
and
72 deletion
+77
-72
spring-jdbc/src/main/java/org/springframework/jdbc/core/PreparedStatementCreatorFactory.java
...gframework/jdbc/core/PreparedStatementCreatorFactory.java
+2
-2
spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlParameter.java
...main/java/org/springframework/jdbc/core/SqlParameter.java
+2
-2
spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcCall.java
...rg/springframework/jdbc/core/simple/AbstractJdbcCall.java
+46
-42
spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcInsert.java
.../springframework/jdbc/core/simple/AbstractJdbcInsert.java
+20
-18
spring-webmvc/src/main/java/org/springframework/web/servlet/view/xslt/XsltViewResolver.java
...ringframework/web/servlet/view/xslt/XsltViewResolver.java
+7
-8
未找到文件。
spring-jdbc/src/main/java/org/springframework/jdbc/core/PreparedStatementCreatorFactory.java
浏览文件 @
4db258b9
...
...
@@ -47,7 +47,7 @@ public class PreparedStatementCreatorFactory {
/** The SQL, which won't change when the parameters change */
private
final
String
sql
;
/** List of SqlParameter objects
. May not be {@code null}.
*/
/** List of SqlParameter objects
(may not be {@code null})
*/
private
final
List
<
SqlParameter
>
declaredParameters
;
private
int
resultSetType
=
ResultSet
.
TYPE_FORWARD_ONLY
;
...
...
@@ -75,7 +75,7 @@ public class PreparedStatementCreatorFactory {
* @param sql SQL to execute
* @param types int array of JDBC types
*/
public
PreparedStatementCreatorFactory
(
String
sql
,
int
[]
types
)
{
public
PreparedStatementCreatorFactory
(
String
sql
,
int
...
types
)
{
this
.
sql
=
sql
;
this
.
declaredParameters
=
SqlParameter
.
sqlTypesToAnonymousParameterList
(
types
);
}
...
...
spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlParameter.java
浏览文件 @
4db258b9
/*
* Copyright 2002-201
2
the original author or authors.
* Copyright 2002-201
4
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.
...
...
@@ -177,7 +177,7 @@ public class SqlParameter {
* Convert a list of JDBC types, as defined in {@code java.sql.Types},
* to a List of SqlParameter objects as used in this package.
*/
public
static
List
<
SqlParameter
>
sqlTypesToAnonymousParameterList
(
int
[]
types
)
{
public
static
List
<
SqlParameter
>
sqlTypesToAnonymousParameterList
(
int
...
types
)
{
List
<
SqlParameter
>
result
=
new
LinkedList
<
SqlParameter
>();
if
(
types
!=
null
)
{
for
(
int
type
:
types
)
{
...
...
spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcCall.java
浏览文件 @
4db258b9
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
4
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.
...
...
@@ -53,6 +53,9 @@ public abstract class AbstractJdbcCall {
/** Lower-level class used to execute SQL */
private
final
JdbcTemplate
jdbcTemplate
;
/** Context used to retrieve and manage database metadata */
private
final
CallMetaDataContext
callMetaDataContext
=
new
CallMetaDataContext
();
/** List of SqlParameter objects */
private
final
List
<
SqlParameter
>
declaredParameters
=
new
ArrayList
<
SqlParameter
>();
...
...
@@ -66,12 +69,9 @@ public abstract class AbstractJdbcCall {
*/
private
boolean
compiled
=
false
;
/**
t
he generated string used for call statement */
/**
T
he generated string used for call statement */
private
String
callString
;
/** context used to retrieve and manage database metadata */
private
CallMetaDataContext
callMetaDataContext
=
new
CallMetaDataContext
();
/**
* Object enabling us to create CallableStatementCreators
* efficiently, based on this class's declared parameters.
...
...
@@ -103,13 +103,6 @@ public abstract class AbstractJdbcCall {
return
this
.
jdbcTemplate
;
}
/**
* Get the {@link CallableStatementCreatorFactory} being used
*/
protected
CallableStatementCreatorFactory
getCallableStatementFactory
()
{
return
this
.
callableStatementFactory
;
}
/**
* Set the name of the stored procedure.
*/
...
...
@@ -153,7 +146,7 @@ public abstract class AbstractJdbcCall {
}
/**
* Set the schema name to use
,
* Set the schema name to use
.
*/
public
void
setSchemaName
(
String
schemaName
)
{
this
.
callMetaDataContext
.
setSchemaName
(
schemaName
);
...
...
@@ -183,8 +176,8 @@ public abstract class AbstractJdbcCall {
/**
* Specify whether the call requires a rerurn value.
*/
public
void
setReturnValueRequired
(
boolean
b
)
{
this
.
callMetaDataContext
.
setReturnValueRequired
(
b
);
public
void
setReturnValueRequired
(
boolean
returnValueRequired
)
{
this
.
callMetaDataContext
.
setReturnValueRequired
(
returnValueRequired
);
}
/**
...
...
@@ -194,6 +187,28 @@ public abstract class AbstractJdbcCall {
return
this
.
callMetaDataContext
.
isReturnValueRequired
();
}
/**
* Specify whether the parameter metadata for the call should be used. The default is true.
*/
public
void
setAccessCallParameterMetaData
(
boolean
accessCallParameterMetaData
)
{
this
.
callMetaDataContext
.
setAccessCallParameterMetaData
(
accessCallParameterMetaData
);
}
/**
* Get the call string that should be used based on parameters and meta data.
*/
public
String
getCallString
()
{
return
this
.
callString
;
}
/**
* Get the {@link CallableStatementCreatorFactory} being used
*/
protected
CallableStatementCreatorFactory
getCallableStatementFactory
()
{
return
this
.
callableStatementFactory
;
}
/**
* Add a declared parameter to the list of parameters for the call.
* Only parameters declared as {@code SqlParameter} and {@code SqlInOutParameter}
...
...
@@ -226,20 +241,6 @@ public abstract class AbstractJdbcCall {
}
}
/**
* Get the call string that should be used based on parameters and meta data.
*/
public
String
getCallString
()
{
return
this
.
callString
;
}
/**
* Specify whether the parameter metadata for the call should be used. The default is true.
*/
public
void
setAccessCallParameterMetaData
(
boolean
accessCallParameterMetaData
)
{
this
.
callMetaDataContext
.
setAccessCallParameterMetaData
(
accessCallParameterMetaData
);
}
//-------------------------------------------------------------------------
// Methods handling compilation issues
...
...
@@ -366,18 +367,21 @@ public abstract class AbstractJdbcCall {
/**
* Method to perform the actual call processing
*/
private
Map
<
String
,
Object
>
executeCallInternal
(
Map
<
String
,
?>
param
s
)
{
CallableStatementCreator
csc
=
getCallableStatementFactory
().
newCallableStatementCreator
(
param
s
);
private
Map
<
String
,
Object
>
executeCallInternal
(
Map
<
String
,
?>
arg
s
)
{
CallableStatementCreator
csc
=
getCallableStatementFactory
().
newCallableStatementCreator
(
arg
s
);
if
(
logger
.
isDebugEnabled
())
{
logger
.
debug
(
"The following parameters are used for call "
+
getCallString
()
+
" with
: "
+
param
s
);
logger
.
debug
(
"The following parameters are used for call "
+
getCallString
()
+
" with
"
+
arg
s
);
int
i
=
1
;
for
(
SqlParameter
p
:
getCallParameters
())
{
logger
.
debug
(
i
++
+
": "
+
p
.
getName
()
+
" SQL Type "
+
p
.
getSqlType
()
+
" Type Name "
+
p
.
getTypeName
()
+
" "
+
p
.
getClass
().
getName
());
for
(
SqlParameter
param
:
getCallParameters
())
{
logger
.
debug
(
i
+
": "
+
param
.
getName
()
+
", SQL type "
+
param
.
getSqlType
()
+
", type name "
+
param
.
getTypeName
()
+
", parameter class ["
+
param
.
getClass
().
getName
()
+
"]"
);
i
++;
}
}
return
getJdbcTemplate
().
call
(
csc
,
getCallParameters
());
}
/**
* Get the name of a single out parameter or return value.
* Used for functions or procedures with one out parameter.
...
...
@@ -386,6 +390,14 @@ public abstract class AbstractJdbcCall {
return
this
.
callMetaDataContext
.
getScalarOutParameterName
();
}
/**
* Get a List of all the call parameters to be used for call. This includes any parameters added
* based on meta data processing.
*/
protected
List
<
SqlParameter
>
getCallParameters
()
{
return
this
.
callMetaDataContext
.
getCallParameters
();
}
/**
* Match the provided in parameter values with registered parameters and
* parameters defined via metadata processing.
...
...
@@ -416,12 +428,4 @@ public abstract class AbstractJdbcCall {
return
this
.
callMetaDataContext
.
matchInParameterValuesWithCallParameters
(
args
);
}
/**
* Get a List of all the call parameters to be used for call. This includes any parameters added
* based on meta data processing.
*/
protected
List
<
SqlParameter
>
getCallParameters
()
{
return
this
.
callMetaDataContext
.
getCallParameters
();
}
}
spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcInsert.java
浏览文件 @
4db258b9
...
...
@@ -73,6 +73,9 @@ public abstract class AbstractJdbcInsert {
/** List of columns objects to be used in insert statement */
private
final
List
<
String
>
declaredColumns
=
new
ArrayList
<
String
>();
/** The names of the columns holding the generated key */
private
String
[]
generatedKeyNames
=
new
String
[
0
];
/**
* Has this operation been compiled? Compilation means at least checking
* that a DataSource or JdbcTemplate has been provided, but subclasses
...
...
@@ -86,9 +89,6 @@ public abstract class AbstractJdbcInsert {
/** The SQL type information for the insert columns */
private
int
[]
insertTypes
;
/** The names of the columns holding the generated key */
private
String
[]
generatedKeyNames
=
new
String
[
0
];
/**
* Constructor for sublasses to delegate to for setting the DataSource.
...
...
@@ -119,7 +119,7 @@ public abstract class AbstractJdbcInsert {
}
/**
* Set the name of the table for this insert
* Set the name of the table for this insert
.
*/
public
void
setTableName
(
String
tableName
)
{
checkIfConfigurationModificationIsAllowed
();
...
...
@@ -127,14 +127,14 @@ public abstract class AbstractJdbcInsert {
}
/**
* Get the name of the table for this insert
* Get the name of the table for this insert
.
*/
public
String
getTableName
()
{
return
this
.
tableMetaDataContext
.
getTableName
();
}
/**
* Set the name of the schema for this insert
* Set the name of the schema for this insert
.
*/
public
void
setSchemaName
(
String
schemaName
)
{
checkIfConfigurationModificationIsAllowed
();
...
...
@@ -142,14 +142,14 @@ public abstract class AbstractJdbcInsert {
}
/**
* Get the name of the schema for this insert
* Get the name of the schema for this insert
.
*/
public
String
getSchemaName
()
{
return
this
.
tableMetaDataContext
.
getSchemaName
();
}
/**
* Set the name of the catalog for this insert
* Set the name of the catalog for this insert
.
*/
public
void
setCatalogName
(
String
catalogName
)
{
checkIfConfigurationModificationIsAllowed
();
...
...
@@ -157,14 +157,14 @@ public abstract class AbstractJdbcInsert {
}
/**
* Get the name of the catalog for this insert
* Get the name of the catalog for this insert
.
*/
public
String
getCatalogName
()
{
return
this
.
tableMetaDataContext
.
getCatalogName
();
}
/**
* Set the names of the columns to be used
* Set the names of the columns to be used
.
*/
public
void
setColumnNames
(
List
<
String
>
columnNames
)
{
checkIfConfigurationModificationIsAllowed
();
...
...
@@ -173,14 +173,14 @@ public abstract class AbstractJdbcInsert {
}
/**
* Get the names of the columns used
* Get the names of the columns used
.
*/
public
List
<
String
>
getColumnNames
()
{
return
Collections
.
unmodifiableList
(
this
.
declaredColumns
);
}
/**
* Specify the name of a single generated key column
* Specify the name of a single generated key column
.
*/
public
void
setGeneratedKeyName
(
String
generatedKeyName
)
{
checkIfConfigurationModificationIsAllowed
();
...
...
@@ -188,7 +188,7 @@ public abstract class AbstractJdbcInsert {
}
/**
* Set the names of any generated keys
* Set the names of any generated keys
.
*/
public
void
setGeneratedKeyNames
(
String
...
generatedKeyNames
)
{
checkIfConfigurationModificationIsAllowed
();
...
...
@@ -196,21 +196,23 @@ public abstract class AbstractJdbcInsert {
}
/**
* Get the names of any generated keys
* Get the names of any generated keys
.
*/
public
String
[]
getGeneratedKeyNames
()
{
return
this
.
generatedKeyNames
;
}
/**
* Specify whether the parameter metadata for the call should be used. The default is true.
* Specify whether the parameter metadata for the call should be used.
* The default is {@code true}.
*/
public
void
setAccessTableColumnMetaData
(
boolean
accessTableColumnMetaData
)
{
this
.
tableMetaDataContext
.
setAccessTableColumnMetaData
(
accessTableColumnMetaData
);
}
/**
* Specify whether the default for including synonyms should be changed. The default is false.
* Specify whether the default for including synonyms should be changed.
* The default is {@code false}.
*/
public
void
setOverrideIncludeSynonymsDefault
(
boolean
override
)
{
this
.
tableMetaDataContext
.
setOverrideIncludeSynonymsDefault
(
override
);
...
...
@@ -224,14 +226,14 @@ public abstract class AbstractJdbcInsert {
}
/**
* Get the insert string to be used
* Get the insert string to be used
.
*/
public
String
getInsertString
()
{
return
this
.
insertString
;
}
/**
* Get the array of {@link java.sql.Types} to be used for insert
* Get the array of {@link java.sql.Types} to be used for insert
.
*/
public
int
[]
getInsertTypes
()
{
return
this
.
insertTypes
;
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/view/xslt/XsltViewResolver.java
浏览文件 @
4db258b9
/*
* Copyright 2002-201
2
the original author or authors.
* Copyright 2002-201
4
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.
...
...
@@ -17,7 +17,6 @@
package
org.springframework.web.servlet.view.xslt
;
import
java.util.Properties
;
import
javax.xml.transform.ErrorListener
;
import
javax.xml.transform.URIResolver
;
...
...
@@ -49,10 +48,15 @@ public class XsltViewResolver extends UrlBasedViewResolver {
public
XsltViewResolver
()
{
setViewClass
(
XsltView
.
class
);
setViewClass
(
requiredViewClass
()
);
}
@Override
protected
Class
<?>
requiredViewClass
()
{
return
XsltView
.
class
;
}
/**
* Set the name of the model attribute that represents the XSLT Source.
* If not specified, the model map will be searched for a matching value type.
...
...
@@ -117,11 +121,6 @@ public class XsltViewResolver extends UrlBasedViewResolver {
}
@Override
protected
Class
<?>
requiredViewClass
()
{
return
XsltView
.
class
;
}
@Override
protected
AbstractUrlBasedView
buildView
(
String
viewName
)
throws
Exception
{
XsltView
view
=
(
XsltView
)
super
.
buildView
(
viewName
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录