Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
8fecee8c
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,发现更多精彩内容 >>
提交
8fecee8c
编写于
4月 13, 2014
作者:
S
Sam Brannen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve Javadoc in SQL script support classes
上级
910dd414
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
21 deletion
+25
-21
spring-jdbc/src/main/java/org/springframework/jdbc/datasource/init/ResourceDatabasePopulator.java
...ework/jdbc/datasource/init/ResourceDatabasePopulator.java
+10
-6
spring-jdbc/src/main/java/org/springframework/jdbc/datasource/init/ScriptUtils.java
...org/springframework/jdbc/datasource/init/ScriptUtils.java
+15
-15
未找到文件。
spring-jdbc/src/main/java/org/springframework/jdbc/datasource/init/ResourceDatabasePopulator.java
浏览文件 @
8fecee8c
...
...
@@ -48,6 +48,7 @@ import org.springframework.core.io.support.EncodedResource;
* @author Chris Baldwin
* @since 3.0
* @see DatabasePopulatorUtils
* @see ScriptUtils
*/
public
class
ResourceDatabasePopulator
implements
DatabasePopulator
{
...
...
@@ -195,10 +196,10 @@ public class ResourceDatabasePopulator implements DatabasePopulator {
/**
* Flag to indicate that a failed SQL {@code DROP} statement can be ignored.
* <p>This is useful for
non-embedded databases whose SQL dialect does not support an
* {@code IF EXISTS} clause in a {@code DROP} statement.
* <p>This is useful for
a non-embedded database whose SQL dialect does not
*
support an
{@code IF EXISTS} clause in a {@code DROP} statement.
* <p>The default is {@code false} so that if the populator runs accidentally, it will
* fail fast if
the
script starts with a {@code DROP} statement.
* fail fast if
a
script starts with a {@code DROP} statement.
* @param ignoreFailedDrops {@code true} if failed drop statements should be ignored
*/
public
void
setIgnoreFailedDrops
(
boolean
ignoreFailedDrops
)
{
...
...
@@ -219,7 +220,8 @@ public class ResourceDatabasePopulator implements DatabasePopulator {
}
/**
* Execute this {@code DatabasePopulator} against the given {@link DataSource}.
* Execute this {@code ResourceDatabasePopulator} against the given
* {@link DataSource}.
* <p>Delegates to {@link DatabasePopulatorUtils#execute}.
* @param dataSource the {@code DataSource} to execute against
* @throws ScriptException if an error occurs
...
...
@@ -231,8 +233,10 @@ public class ResourceDatabasePopulator implements DatabasePopulator {
}
/**
* {@link EncodedResource} is not a sub-type of {@link Resource}. Thus we always need
* to wrap each script resource in an encoded resource.
* {@link EncodedResource} is not a sub-type of {@link Resource}. Thus we
* always need to wrap each script resource in an {@code EncodedResource}
* using the configured {@linkplain #setSqlScriptEncoding encoding}.
* @param script the script to wrap
*/
private
EncodedResource
encodeScript
(
Resource
script
)
{
return
new
EncodedResource
(
script
,
this
.
sqlScriptEncoding
);
...
...
spring-jdbc/src/main/java/org/springframework/jdbc/datasource/init/ScriptUtils.java
浏览文件 @
8fecee8c
...
...
@@ -50,19 +50,19 @@ public abstract class ScriptUtils {
private
static
final
Log
logger
=
LogFactory
.
getLog
(
ScriptUtils
.
class
);
/**
* Default statement separator within SQL scripts.
* Default statement separator within SQL scripts
: {@code ";"}
.
*/
public
static
final
String
DEFAULT_STATEMENT_SEPARATOR
=
";"
;
/**
* Fallback statement separator within SQL scripts.
* <p>Used if neither a custom
defined
separator nor the
* Fallback statement separator within SQL scripts
: {@code "\n"}
.
* <p>Used if neither a custom separator nor the
* {@link #DEFAULT_STATEMENT_SEPARATOR} is present in a given script.
*/
public
static
final
String
FALLBACK_STATEMENT_SEPARATOR
=
"\n"
;
/**
* End of file (EOF) SQL statement separator.
* End of file (EOF) SQL statement separator
: {@code "^^^ END OF SCRIPT ^^^"}
.
* <p>This value may be supplied as the {@code separator} to {@link
* #executeSqlScript(Connection, EncodedResource, boolean, boolean, String, String, String, String)}
* to denote that an SQL script contains a single statement (potentially
...
...
@@ -73,17 +73,17 @@ public abstract class ScriptUtils {
public
static
final
String
EOF_STATEMENT_SEPARATOR
=
"^^^ END OF SCRIPT ^^^"
;
/**
* Default prefix for
line comments within SQL scripts
.
* Default prefix for
single-line comments within SQL scripts: {@code "--"}
.
*/
public
static
final
String
DEFAULT_COMMENT_PREFIX
=
"--"
;
/**
* Default start delimiter for block comments within SQL scripts.
* Default start delimiter for block comments within SQL scripts
: {@code "/*"}
.
*/
public
static
final
String
DEFAULT_BLOCK_COMMENT_START_DELIMITER
=
"/*"
;
/**
* Default end delimiter for block comments within SQL scripts.
* Default end delimiter for block comments within SQL scripts
: <code>"*/"</code>
.
*/
public
static
final
String
DEFAULT_BLOCK_COMMENT_END_DELIMITER
=
"*/"
;
...
...
@@ -351,8 +351,8 @@ public abstract class ScriptUtils {
}
/**
* Execute the given SQL script using default settings for s
eparator separators,
* comment delimiters, and exception handling flags.
* Execute the given SQL script using default settings for s
tatement
*
separators,
comment delimiters, and exception handling flags.
* <p>Statement separators and comments will be removed before executing
* individual statements within the supplied script.
* <p><b>Do not use this method to execute DDL if you expect rollback.</b>
...
...
@@ -362,8 +362,8 @@ public abstract class ScriptUtils {
* current platform's default encoding
* @throws ScriptException if an error occurred while executing the SQL script
* @see #executeSqlScript(Connection, EncodedResource, boolean, boolean, String, String, String, String)
* @see #DEFAULT_COMMENT_PREFIX
* @see #DEFAULT_STATEMENT_SEPARATOR
* @see #DEFAULT_COMMENT_PREFIX
* @see #DEFAULT_BLOCK_COMMENT_START_DELIMITER
* @see #DEFAULT_BLOCK_COMMENT_END_DELIMITER
*/
...
...
@@ -372,8 +372,8 @@ public abstract class ScriptUtils {
}
/**
* Execute the given SQL script using default settings for s
eparator separators,
* comment delimiters, and exception handling flags.
* Execute the given SQL script using default settings for s
tatement
*
separators,
comment delimiters, and exception handling flags.
* <p>Statement separators and comments will be removed before executing
* individual statements within the supplied script.
* <p><b>Do not use this method to execute DDL if you expect rollback.</b>
...
...
@@ -383,8 +383,8 @@ public abstract class ScriptUtils {
* to load the SQL script from
* @throws ScriptException if an error occurred while executing the SQL script
* @see #executeSqlScript(Connection, EncodedResource, boolean, boolean, String, String, String, String)
* @see #DEFAULT_COMMENT_PREFIX
* @see #DEFAULT_STATEMENT_SEPARATOR
* @see #DEFAULT_COMMENT_PREFIX
* @see #DEFAULT_BLOCK_COMMENT_START_DELIMITER
* @see #DEFAULT_BLOCK_COMMENT_END_DELIMITER
*/
...
...
@@ -406,8 +406,8 @@ public abstract class ScriptUtils {
* in the event of an error
* @param ignoreFailedDrops whether or not to continue in the event of specifically
* an error on a {@code DROP} statement
* @param commentPrefix the prefix that identifies
comments in the SQL script —
* typically "--"
* @param commentPrefix the prefix that identifies
single-line comments in the
*
SQL script —
typically "--"
* @param separator the script statement separator; defaults to
* {@value #DEFAULT_STATEMENT_SEPARATOR} if not specified and falls back to
* {@value #FALLBACK_STATEMENT_SEPARATOR} as a last resort; may be set to
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录