Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
343e4cb9
提交
343e4cb9
authored
15 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use StringBuilder instead of StringBuffer
上级
e126424c
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
110 个修改的文件
包含
296 行增加
和
350 行删除
+296
-350
Bnf.java
h2/src/main/org/h2/bnf/Bnf.java
+1
-1
RuleFixed.java
h2/src/main/org/h2/bnf/RuleFixed.java
+1
-1
RuleList.java
h2/src/main/org/h2/bnf/RuleList.java
+1
-1
Parser.java
h2/src/main/org/h2/command/Parser.java
+2
-2
Prepared.java
h2/src/main/org/h2/command/Prepared.java
+1
-1
AlterTableAlterColumn.java
h2/src/main/org/h2/command/ddl/AlterTableAlterColumn.java
+2
-2
Analyze.java
h2/src/main/org/h2/command/ddl/Analyze.java
+7
-13
Delete.java
h2/src/main/org/h2/command/dml/Delete.java
+3
-4
ScriptCommand.java
h2/src/main/org/h2/command/dml/ScriptCommand.java
+9
-12
SelectOrderBy.java
h2/src/main/org/h2/command/dml/SelectOrderBy.java
+1
-1
SelectUnion.java
h2/src/main/org/h2/command/dml/SelectUnion.java
+6
-13
Set.java
h2/src/main/org/h2/command/dml/Set.java
+1
-2
Update.java
h2/src/main/org/h2/command/dml/Update.java
+4
-8
ConstraintCheck.java
h2/src/main/org/h2/constraint/ConstraintCheck.java
+8
-17
Comment.java
h2/src/main/org/h2/engine/Comment.java
+3
-6
FunctionAlias.java
h2/src/main/org/h2/engine/FunctionAlias.java
+2
-4
Right.java
h2/src/main/org/h2/engine/Right.java
+5
-8
Role.java
h2/src/main/org/h2/engine/Role.java
+1
-1
SessionRemote.java
h2/src/main/org/h2/engine/SessionRemote.java
+1
-1
Setting.java
h2/src/main/org/h2/engine/Setting.java
+2
-4
User.java
h2/src/main/org/h2/engine/User.java
+7
-9
UserAggregate.java
h2/src/main/org/h2/engine/UserAggregate.java
+2
-5
UserDataType.java
h2/src/main/org/h2/engine/UserDataType.java
+1
-6
CompareLike.java
h2/src/main/org/h2/expression/CompareLike.java
+1
-1
ConditionExists.java
h2/src/main/org/h2/expression/ConditionExists.java
+1
-2
ConditionInSelect.java
h2/src/main/org/h2/expression/ConditionInSelect.java
+1
-6
Function.java
h2/src/main/org/h2/expression/Function.java
+7
-9
Operation.java
h2/src/main/org/h2/expression/Operation.java
+2
-3
TableFunction.java
h2/src/main/org/h2/expression/TableFunction.java
+1
-1
FullText.java
h2/src/main/org/h2/fulltext/FullText.java
+19
-16
FullTextLucene.java
h2/src/main/org/h2/fulltext/FullTextLucene.java
+3
-3
BaseIndex.java
h2/src/main/org/h2/index/BaseIndex.java
+3
-3
IndexCondition.java
h2/src/main/org/h2/index/IndexCondition.java
+1
-1
IndexType.java
h2/src/main/org/h2/index/IndexType.java
+1
-1
LinkedIndex.java
h2/src/main/org/h2/index/LinkedIndex.java
+1
-1
JdbcClob.java
h2/src/main/org/h2/jdbc/JdbcClob.java
+1
-1
JdbcSQLException.java
h2/src/main/org/h2/jdbc/JdbcSQLException.java
+1
-1
JdbcXAConnection.java
h2/src/main/org/h2/jdbcx/JdbcXAConnection.java
+2
-2
JdbcXid.java
h2/src/main/org/h2/jdbcx/JdbcXid.java
+1
-1
Trace.java
h2/src/main/org/h2/message/Trace.java
+1
-1
TraceObject.java
h2/src/main/org/h2/message/TraceObject.java
+1
-1
UpdatableRow.java
h2/src/main/org/h2/result/UpdatableRow.java
+1
-1
Constant.java
h2/src/main/org/h2/schema/Constant.java
+1
-1
Schema.java
h2/src/main/org/h2/schema/Schema.java
+1
-1
Sequence.java
h2/src/main/org/h2/schema/Sequence.java
+1
-1
TriggerObject.java
h2/src/main/org/h2/schema/TriggerObject.java
+2
-2
PageParser.java
h2/src/main/org/h2/server/web/PageParser.java
+6
-6
WebThread.java
h2/src/main/org/h2/server/web/WebThread.java
+16
-16
Column.java
h2/src/main/org/h2/table/Column.java
+2
-2
IndexColumn.java
h2/src/main/org/h2/table/IndexColumn.java
+1
-1
LinkSchema.java
h2/src/main/org/h2/table/LinkSchema.java
+2
-2
MetaTable.java
h2/src/main/org/h2/table/MetaTable.java
+1
-1
TableData.java
h2/src/main/org/h2/table/TableData.java
+1
-1
TableLink.java
h2/src/main/org/h2/table/TableLink.java
+1
-1
TableView.java
h2/src/main/org/h2/table/TableView.java
+2
-4
ConvertTraceFile.java
h2/src/main/org/h2/tools/ConvertTraceFile.java
+1
-1
Csv.java
h2/src/main/org/h2/tools/Csv.java
+4
-4
MultiDimension.java
h2/src/main/org/h2/tools/MultiDimension.java
+1
-1
Recover.java
h2/src/main/org/h2/tools/Recover.java
+8
-8
RunScript.java
h2/src/main/org/h2/tools/RunScript.java
+2
-2
Script.java
h2/src/main/org/h2/tools/Script.java
+2
-2
Server.java
h2/src/main/org/h2/tools/Server.java
+4
-6
Shell.java
h2/src/main/org/h2/tools/Shell.java
+1
-1
ScriptReader.java
h2/src/main/org/h2/util/ScriptReader.java
+1
-1
StatementBuilder.java
h2/src/main/org/h2/util/StatementBuilder.java
+14
-4
StringUtils.java
h2/src/main/org/h2/util/StringUtils.java
+12
-12
Tool.java
h2/src/main/org/h2/util/Tool.java
+1
-1
Transfer.java
h2/src/main/org/h2/value/Transfer.java
+2
-2
ValueLob.java
h2/src/main/org/h2/value/ValueLob.java
+1
-1
ValueUuid.java
h2/src/main/org/h2/value/ValueUuid.java
+2
-2
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+3
-6
TestBase.java
h2/src/test/org/h2/test/TestBase.java
+1
-1
BenchCRandom.java
h2/src/test/org/h2/test/bench/BenchCRandom.java
+2
-2
Tokenizer.java
h2/src/test/org/h2/test/coverage/Tokenizer.java
+2
-2
TestCases.java
h2/src/test/org/h2/test/db/TestCases.java
+1
-1
TestCsv.java
h2/src/test/org/h2/test/db/TestCsv.java
+1
-1
TestFunctions.java
h2/src/test/org/h2/test/db/TestFunctions.java
+1
-1
TestIndex.java
h2/src/test/org/h2/test/db/TestIndex.java
+2
-2
TestLob.java
h2/src/test/org/h2/test/db/TestLob.java
+3
-3
TestScript.java
h2/src/test/org/h2/test/db/TestScript.java
+7
-7
TestNativeSQL.java
h2/src/test/org/h2/test/jdbc/TestNativeSQL.java
+4
-4
TestPreparedStatement.java
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
+1
-1
TestXid.java
h2/src/test/org/h2/test/jdbcx/TestXid.java
+3
-3
OutputCatcher.java
h2/src/test/org/h2/test/synth/OutputCatcher.java
+1
-1
TestBtreeIndex.java
h2/src/test/org/h2/test/synth/TestBtreeIndex.java
+1
-1
TestHalt.java
h2/src/test/org/h2/test/synth/TestHalt.java
+1
-1
TestJoin.java
h2/src/test/org/h2/test/synth/TestJoin.java
+4
-4
TestSimpleIndex.java
h2/src/test/org/h2/test/synth/TestSimpleIndex.java
+3
-3
RandomGen.java
h2/src/test/org/h2/test/synth/sql/RandomGen.java
+4
-4
Value.java
h2/src/test/org/h2/test/synth/sql/Value.java
+3
-3
TestMultiNews.java
h2/src/test/org/h2/test/synth/thread/TestMultiNews.java
+1
-1
TestMultiOrder.java
h2/src/test/org/h2/test/synth/thread/TestMultiOrder.java
+1
-1
Statement.java
h2/src/test/org/h2/test/trace/Statement.java
+1
-1
TestPattern.java
h2/src/test/org/h2/test/unit/TestPattern.java
+3
-3
TestScriptReader.java
h2/src/test/org/h2/test/unit/TestScriptReader.java
+2
-2
TestSecurity.java
h2/src/test/org/h2/test/unit/TestSecurity.java
+1
-1
TestStringCache.java
h2/src/test/org/h2/test/unit/TestStringCache.java
+1
-1
TestStringUtils.java
h2/src/test/org/h2/test/unit/TestStringUtils.java
+3
-3
BuildBase.java
h2/src/tools/org/h2/build/BuildBase.java
+1
-1
MergeDocs.java
h2/src/tools/org/h2/build/doc/MergeDocs.java
+1
-1
SpellChecker.java
h2/src/tools/org/h2/build/doc/SpellChecker.java
+2
-2
Doclet.java
h2/src/tools/org/h2/build/doclet/Doclet.java
+3
-3
ResourceDoclet.java
h2/src/tools/org/h2/build/doclet/ResourceDoclet.java
+1
-1
PrepareTranslation.java
h2/src/tools/org/h2/build/i18n/PrepareTranslation.java
+5
-5
PropertiesToUTF8.java
h2/src/tools/org/h2/build/i18n/PropertiesToUTF8.java
+1
-1
HtmlConverter.java
h2/src/tools/org/h2/build/indexer/HtmlConverter.java
+2
-2
Indexer.java
h2/src/tools/org/h2/build/indexer/Indexer.java
+2
-2
FtpClient.java
h2/src/tools/org/h2/dev/ftp/FtpClient.java
+1
-1
FtpServer.java
h2/src/tools/org/h2/dev/ftp/server/FtpServer.java
+2
-2
PgTcpRedirect.java
h2/src/tools/org/h2/dev/net/PgTcpRedirect.java
+1
-1
没有找到文件。
h2/src/main/org/h2/bnf/Bnf.java
浏览文件 @
343e4cb9
...
...
@@ -141,7 +141,7 @@ public class Bnf {
*/
public
String
getSyntaxHtml
(
String
bnf
)
{
StringTokenizer
tokenizer
=
getTokenizer
(
bnf
);
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
while
(
tokenizer
.
hasMoreTokens
())
{
String
s
=
tokenizer
.
nextToken
();
if
(
s
.
length
()
==
1
||
StringUtils
.
toUpperEnglish
(
s
).
equals
(
s
))
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/bnf/RuleFixed.java
浏览文件 @
343e4cb9
...
...
@@ -74,7 +74,7 @@ public class RuleFixed implements Rule {
case
ANY_WORD:
case
ANY_EXCEPT_2_DOLLAR:
case
ANY_UNTIL_END:
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
int
len
=
r
.
nextBoolean
()
?
1
:
r
.
nextInt
(
5
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
buff
.
append
((
char
)
(
'A'
+
r
.
nextInt
(
'C'
-
'A'
)));
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/bnf/RuleList.java
浏览文件 @
343e4cb9
...
...
@@ -65,7 +65,7 @@ public class RuleList implements Rule {
int
idx
=
config
.
getRandom
().
nextInt
(
list
.
size
());
return
get
(
idx
).
random
(
config
,
level
+
1
);
}
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
for
(
Rule
r
:
list
)
{
buff
.
append
(
r
.
random
(
config
,
level
+
1
));
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/Parser.java
浏览文件 @
343e4cb9
...
...
@@ -764,7 +764,7 @@ public class Parser {
}
private
Prepared
parseHelp
()
throws
SQLException
{
StringBu
ffer
buff
=
new
StringBuff
er
(
"SELECT * FROM INFORMATION_SCHEMA.HELP"
);
StringBu
ilder
buff
=
new
StringBuild
er
(
"SELECT * FROM INFORMATION_SCHEMA.HELP"
);
int
i
=
0
;
ObjectArray
<
Value
>
paramValues
=
ObjectArray
.
newInstance
();
while
(
currentTokenType
!=
END
)
{
...
...
@@ -784,7 +784,7 @@ public class Parser {
private
Prepared
parseShow
()
throws
SQLException
{
ObjectArray
<
Value
>
paramValues
=
ObjectArray
.
newInstance
();
StringBu
ffer
buff
=
new
StringBuff
er
(
"SELECT "
);
StringBu
ilder
buff
=
new
StringBuild
er
(
"SELECT "
);
if
(
readIf
(
"CLIENT_ENCODING"
))
{
// for PostgreSQL compatibility
buff
.
append
(
"'UNICODE' AS CLIENT_ENCODING FROM DUAL"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/Prepared.java
浏览文件 @
343e4cb9
...
...
@@ -410,7 +410,7 @@ public abstract class Prepared {
protected
SQLException
setRow
(
SQLException
ex
,
int
rowId
,
String
values
)
{
if
(
ex
instanceof
JdbcSQLException
)
{
JdbcSQLException
e
=
(
JdbcSQLException
)
ex
;
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
if
(
sqlStatement
!=
null
)
{
buff
.
append
(
sqlStatement
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/ddl/AlterTableAlterColumn.java
浏览文件 @
343e4cb9
...
...
@@ -239,9 +239,9 @@ public class AlterTableAlterColumn extends SchemaCommand {
int
id
=
db
.
allocateObjectId
(
true
,
true
);
TableData
newTable
=
getSchema
().
createTable
(
tempName
,
id
,
newColumns
,
table
.
isPersistIndexes
(),
table
.
isPersistData
(),
false
,
Index
.
EMPTY_HEAD
,
session
);
newTable
.
setComment
(
table
.
getComment
());
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
buff
.
append
(
newTable
.
getCreateSQL
());
StringBu
ffer
columnList
=
new
StringBuff
er
();
StringBu
ilder
columnList
=
new
StringBuild
er
();
for
(
Column
nc
:
newColumns
)
{
if
(
columnList
.
length
()
>
0
)
{
columnList
.
append
(
", "
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/ddl/Analyze.java
浏览文件 @
343e4cb9
...
...
@@ -15,6 +15,7 @@ import org.h2.result.LocalResult;
import
org.h2.table.Column
;
import
org.h2.table.Table
;
import
org.h2.table.TableData
;
import
org.h2.util.StatementBuilder
;
/**
* This class represents the statement
...
...
@@ -37,22 +38,15 @@ public class Analyze extends DefineCommand {
if
(!(
table
instanceof
TableData
))
{
continue
;
}
StatementBuilder
buff
=
new
StatementBuilder
(
"SELECT "
);
Column
[]
columns
=
table
.
getColumns
();
StringBuffer
buff
=
new
StringBuffer
();
buff
.
append
(
"SELECT "
);
for
(
int
j
=
0
;
j
<
columns
.
length
;
j
++)
{
if
(
j
>
0
)
{
buff
.
append
(
", "
);
}
buff
.
append
(
"SELECTIVITY("
);
buff
.
append
(
columns
[
j
].
getSQL
());
buff
.
append
(
')'
);
for
(
Column
col
:
columns
)
{
buff
.
appendExceptFirst
(
", "
);
buff
.
append
(
"SELECTIVITY("
).
append
(
col
.
getSQL
()).
append
(
')'
);
}
buff
.
append
(
" FROM "
);
buff
.
append
(
table
.
getSQL
());
buff
.
append
(
" FROM "
).
append
(
table
.
getSQL
());
if
(
sampleRows
>
0
)
{
buff
.
append
(
" LIMIT 1 SAMPLE_SIZE "
);
buff
.
append
(
sampleRows
);
buff
.
append
(
" LIMIT 1 SAMPLE_SIZE "
).
append
(
sampleRows
);
}
String
sql
=
buff
.
toString
();
Prepared
command
=
session
.
prepare
(
sql
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/dml/Delete.java
浏览文件 @
343e4cb9
...
...
@@ -83,11 +83,10 @@ public class Delete extends Prepared {
}
public
String
getPlanSQL
()
{
StringBuffer
buff
=
new
StringBuffer
();
buff
.
append
(
"DELETE FROM "
);
buff
.
append
(
tableFilter
.
getPlanSQL
(
false
));
StringBuilder
buff
=
new
StringBuilder
();
buff
.
append
(
"DELETE FROM "
).
append
(
tableFilter
.
getPlanSQL
(
false
));
if
(
condition
!=
null
)
{
buff
.
append
(
"\nWHERE "
+
StringUtils
.
unEnclose
(
condition
.
getSQL
()));
buff
.
append
(
"\nWHERE "
).
append
(
StringUtils
.
unEnclose
(
condition
.
getSQL
()));
}
return
buff
.
toString
();
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/dml/ScriptCommand.java
浏览文件 @
343e4cb9
...
...
@@ -49,6 +49,7 @@ import org.h2.util.ByteUtils;
import
org.h2.util.IOUtils
;
import
org.h2.util.MathUtils
;
import
org.h2.util.ObjectArray
;
import
org.h2.util.StatementBuilder
;
import
org.h2.util.StringUtils
;
import
org.h2.value.Value
;
import
org.h2.value.ValueLob
;
...
...
@@ -215,15 +216,11 @@ public class ScriptCommand extends ScriptBase {
Index
index
=
plan
.
getIndex
();
Cursor
cursor
=
index
.
find
(
session
,
null
,
null
);
Column
[]
columns
=
table
.
getColumns
();
StringBuffer
buff
=
new
StringBuffer
();
buff
.
append
(
"INSERT INTO "
);
buff
.
append
(
table
.
getSQL
());
buff
.
append
(
'('
);
for
(
int
j
=
0
;
j
<
columns
.
length
;
j
++)
{
if
(
j
>
0
)
{
buff
.
append
(
", "
);
}
buff
.
append
(
Parser
.
quoteIdentifier
(
columns
[
j
].
getName
()));
StatementBuilder
buff
=
new
StatementBuilder
(
"INSERT INTO "
);
buff
.
append
(
table
.
getSQL
()).
append
(
'('
);
for
(
Column
col
:
columns
)
{
buff
.
appendExceptFirst
(
", "
);
buff
.
append
(
Parser
.
quoteIdentifier
(
col
.
getName
()));
}
buff
.
append
(
") VALUES"
);
if
(!
simple
)
{
...
...
@@ -235,7 +232,7 @@ public class ScriptCommand extends ScriptBase {
while
(
cursor
.
next
())
{
Row
row
=
cursor
.
get
();
if
(
buff
==
null
)
{
buff
=
new
St
ringBuff
er
(
ins
);
buff
=
new
St
atementBuild
er
(
ins
);
}
else
{
buff
.
append
(
",\n("
);
}
...
...
@@ -333,7 +330,7 @@ public class ScriptCommand extends ScriptBase {
InputStream
input
=
v
.
getInputStream
();
try
{
for
(
int
i
=
0
;;
i
++)
{
StringBu
ffer
buff
=
new
StringBuff
er
(
lobBlockSize
*
2
);
StringBu
ilder
buff
=
new
StringBuild
er
(
lobBlockSize
*
2
);
buff
.
append
(
"INSERT INTO SYSTEM_LOB_STREAM VALUES("
+
id
+
", "
+
i
+
", NULL, '"
);
int
len
=
IOUtils
.
readFully
(
input
,
bytes
,
0
,
lobBlockSize
);
if
(
len
<=
0
)
{
...
...
@@ -354,7 +351,7 @@ public class ScriptCommand extends ScriptBase {
Reader
reader
=
v
.
getReader
();
try
{
for
(
int
i
=
0
;;
i
++)
{
StringBu
ffer
buff
=
new
StringBuff
er
(
lobBlockSize
*
2
);
StringBu
ilder
buff
=
new
StringBuild
er
(
lobBlockSize
*
2
);
buff
.
append
(
"INSERT INTO SYSTEM_LOB_STREAM VALUES("
+
id
+
", "
+
i
+
", "
);
int
len
=
IOUtils
.
readFully
(
reader
,
chars
,
lobBlockSize
);
if
(
len
<
0
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/dml/SelectOrderBy.java
浏览文件 @
343e4cb9
...
...
@@ -41,7 +41,7 @@ public class SelectOrderBy {
public
boolean
nullsLast
;
public
String
getSQL
()
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
if
(
expression
!=
null
)
{
buff
.
append
(
'='
).
append
(
expression
.
getSQL
());
}
else
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/dml/SelectUnion.java
浏览文件 @
343e4cb9
...
...
@@ -295,10 +295,8 @@ public class SelectUnion extends Query {
}
public
String
getPlanSQL
()
{
StringBuffer
buff
=
new
StringBuffer
();
buff
.
append
(
'('
);
buff
.
append
(
StringUtils
.
unEnclose
(
left
.
getPlanSQL
()));
buff
.
append
(
')'
);
StringBuilder
buff
=
new
StringBuilder
();
buff
.
append
(
'('
).
append
(
StringUtils
.
unEnclose
(
left
.
getPlanSQL
())).
append
(
')'
);
switch
(
unionType
)
{
case
UNION_ALL:
buff
.
append
(
"UNION ALL "
);
...
...
@@ -315,21 +313,16 @@ public class SelectUnion extends Query {
default
:
Message
.
throwInternalError
(
"type="
+
unionType
);
}
buff
.
append
(
'('
);
buff
.
append
(
StringUtils
.
unEnclose
(
right
.
getPlanSQL
()));
buff
.
append
(
')'
);
buff
.
append
(
'('
).
append
(
StringUtils
.
unEnclose
(
right
.
getPlanSQL
())).
append
(
')'
);
Expression
[]
exprList
=
new
Expression
[
expressions
.
size
()];
expressions
.
toArray
(
exprList
);
if
(
sort
!=
null
)
{
buff
.
append
(
" ORDER BY "
);
buff
.
append
(
sort
.
getSQL
(
exprList
,
exprList
.
length
));
buff
.
append
(
" ORDER BY "
).
append
(
sort
.
getSQL
(
exprList
,
exprList
.
length
));
}
if
(
limitExpr
!=
null
)
{
buff
.
append
(
" LIMIT "
);
buff
.
append
(
StringUtils
.
unEnclose
(
limitExpr
.
getSQL
()));
buff
.
append
(
" LIMIT "
).
append
(
StringUtils
.
unEnclose
(
limitExpr
.
getSQL
()));
if
(
offsetExpr
!=
null
)
{
buff
.
append
(
" OFFSET "
);
buff
.
append
(
StringUtils
.
unEnclose
(
offsetExpr
.
getSQL
()));
buff
.
append
(
" OFFSET "
).
append
(
StringUtils
.
unEnclose
(
offsetExpr
.
getSQL
()));
}
}
if
(
isForUpdate
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/dml/Set.java
浏览文件 @
343e4cb9
...
...
@@ -95,8 +95,7 @@ public class Set extends Prepared {
throw
Message
.
getSQLException
(
ErrorCode
.
COLLATION_CHANGE_WITH_DATA_TABLE_1
,
table
.
getSQL
());
}
CompareMode
compareMode
;
StringBuffer
buff
=
new
StringBuffer
();
buff
.
append
(
stringValue
);
StringBuilder
buff
=
new
StringBuilder
(
stringValue
);
if
(
stringValue
.
equals
(
CompareMode
.
OFF
))
{
compareMode
=
new
CompareMode
(
null
,
0
);
}
else
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/dml/Update.java
浏览文件 @
343e4cb9
...
...
@@ -146,10 +146,8 @@ public class Update extends Prepared {
}
public
String
getPlanSQL
()
{
StringBuffer
buff
=
new
StringBuffer
();
buff
.
append
(
"UPDATE "
);
buff
.
append
(
tableFilter
.
getPlanSQL
(
false
));
buff
.
append
(
"\nSET "
);
StringBuilder
buff
=
new
StringBuilder
(
"UPDATE "
);
buff
.
append
(
tableFilter
.
getPlanSQL
(
false
)).
append
(
"\nSET "
);
Table
table
=
tableFilter
.
getTable
();
int
columnCount
=
table
.
getColumns
().
length
;
for
(
int
i
=
0
,
j
=
0
;
i
<
columnCount
;
i
++)
{
...
...
@@ -160,13 +158,11 @@ public class Update extends Prepared {
}
j
++;
Column
column
=
table
.
getColumn
(
i
);
buff
.
append
(
column
.
getName
());
buff
.
append
(
" = "
);
buff
.
append
(
newExpr
.
getSQL
());
buff
.
append
(
column
.
getName
()).
append
(
" = "
).
append
(
newExpr
.
getSQL
());
}
}
if
(
condition
!=
null
)
{
buff
.
append
(
"\nWHERE "
+
StringUtils
.
unEnclose
(
condition
.
getSQL
()));
buff
.
append
(
"\nWHERE "
).
append
(
StringUtils
.
unEnclose
(
condition
.
getSQL
()));
}
return
buff
.
toString
();
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/constraint/ConstraintCheck.java
浏览文件 @
343e4cb9
...
...
@@ -46,26 +46,20 @@ public class ConstraintCheck extends Constraint {
}
public
String
getCreateSQLForCopy
(
Table
forTable
,
String
quotedName
)
{
StringBuffer
buff
=
new
StringBuffer
();
buff
.
append
(
"ALTER TABLE "
);
buff
.
append
(
forTable
.
getSQL
());
buff
.
append
(
" ADD CONSTRAINT "
);
StringBuilder
buff
=
new
StringBuilder
(
"ALTER TABLE "
);
buff
.
append
(
forTable
.
getSQL
()).
append
(
" ADD CONSTRAINT "
);
buff
.
append
(
quotedName
);
if
(
comment
!=
null
)
{
buff
.
append
(
" COMMENT "
);
buff
.
append
(
StringUtils
.
quoteStringSQL
(
comment
));
buff
.
append
(
" COMMENT "
).
append
(
StringUtils
.
quoteStringSQL
(
comment
));
}
buff
.
append
(
" CHECK"
);
buff
.
append
(
StringUtils
.
enclose
(
expr
.
getSQL
()));
buff
.
append
(
" CHECK"
).
append
(
StringUtils
.
enclose
(
expr
.
getSQL
()));
buff
.
append
(
" NOCHECK"
);
return
buff
.
toString
();
}
public
String
getShortDescription
()
{
StringBuffer
buff
=
new
StringBuffer
();
buff
.
append
(
getName
());
buff
.
append
(
": "
);
buff
.
append
(
expr
.
getSQL
());
StringBuilder
buff
=
new
StringBuilder
(
getName
());
buff
.
append
(
": "
).
append
(
expr
.
getSQL
());
return
buff
.
toString
();
}
...
...
@@ -126,12 +120,9 @@ public class ConstraintCheck extends Constraint {
// don't check at startup
return
;
}
StringBuffer
buff
=
new
StringBuffer
();
buff
.
append
(
"SELECT 1 FROM "
);
StringBuilder
buff
=
new
StringBuilder
(
"SELECT 1 FROM "
);
buff
.
append
(
filter
.
getTable
().
getSQL
());
buff
.
append
(
" WHERE NOT("
);
buff
.
append
(
expr
.
getSQL
());
buff
.
append
(
')'
);
buff
.
append
(
" WHERE NOT("
).
append
(
expr
.
getSQL
()).
append
(
')'
);
String
sql
=
buff
.
toString
();
LocalResult
r
=
session
.
prepare
(
sql
).
query
(
1
);
if
(
r
.
next
())
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Comment.java
浏览文件 @
343e4cb9
...
...
@@ -67,12 +67,9 @@ public class Comment extends DbObjectBase {
}
public
String
getCreateSQL
()
{
StringBuffer
buff
=
new
StringBuffer
();
buff
.
append
(
"COMMENT ON "
);
buff
.
append
(
getTypeName
(
objectType
));
buff
.
append
(
' '
);
buff
.
append
(
objectName
);
buff
.
append
(
" IS "
);
StringBuilder
buff
=
new
StringBuilder
(
"COMMENT ON "
);
buff
.
append
(
getTypeName
(
objectType
)).
append
(
' '
).
append
(
objectName
).
append
(
" IS "
);
if
(
commentText
==
null
)
{
buff
.
append
(
"NULL"
);
}
else
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/FunctionAlias.java
浏览文件 @
343e4cb9
...
...
@@ -121,14 +121,12 @@ public class FunctionAlias extends DbObjectBase {
}
public
String
getCreateSQL
()
{
StringBuffer
buff
=
new
StringBuffer
();
buff
.
append
(
"CREATE FORCE ALIAS "
);
StringBuilder
buff
=
new
StringBuilder
(
"CREATE FORCE ALIAS "
);
buff
.
append
(
getSQL
());
if
(
deterministic
)
{
buff
.
append
(
" DETERMINISTIC"
);
}
buff
.
append
(
" FOR "
);
buff
.
append
(
Parser
.
quoteIdentifier
(
className
+
"."
+
methodName
));
buff
.
append
(
" FOR "
).
append
(
Parser
.
quoteIdentifier
(
className
+
"."
+
methodName
));
return
buff
.
toString
();
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Right.java
浏览文件 @
343e4cb9
...
...
@@ -62,7 +62,7 @@ public class Right extends DbObjectBase {
this
.
grantedTable
=
grantedRightOnTable
;
}
private
boolean
appendRight
(
StringBu
ff
er
buff
,
int
right
,
int
mask
,
String
name
,
boolean
comma
)
{
private
boolean
appendRight
(
StringBu
ild
er
buff
,
int
right
,
int
mask
,
String
name
,
boolean
comma
)
{
if
((
right
&
mask
)
!=
0
)
{
if
(
comma
)
{
buff
.
append
(
", "
);
...
...
@@ -74,7 +74,7 @@ public class Right extends DbObjectBase {
}
public
String
getRights
()
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
if
(
grantedRight
==
ALL
)
{
buff
.
append
(
"ALL"
);
}
else
{
...
...
@@ -104,18 +104,15 @@ public class Right extends DbObjectBase {
}
public
String
getCreateSQLForCopy
(
Table
table
,
String
quotedName
)
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
buff
.
append
(
"GRANT "
);
if
(
grantedRole
!=
null
)
{
buff
.
append
(
grantedRole
.
getSQL
());
}
else
{
buff
.
append
(
getRights
());
buff
.
append
(
" ON "
);
buff
.
append
(
table
.
getSQL
());
buff
.
append
(
getRights
()).
append
(
" ON "
).
append
(
table
.
getSQL
());
}
buff
.
append
(
" TO "
);
// TODO rights: need role 'PUBLIC'
buff
.
append
(
grantee
.
getSQL
());
buff
.
append
(
" TO "
).
append
(
grantee
.
getSQL
());
return
buff
.
toString
();
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Role.java
浏览文件 @
343e4cb9
...
...
@@ -42,7 +42,7 @@ public class Role extends RightOwner {
if
(
system
)
{
return
null
;
}
StringBu
ffer
buff
=
new
StringBuff
er
(
"CREATE ROLE "
);
StringBu
ilder
buff
=
new
StringBuild
er
(
"CREATE ROLE "
);
if
(
ifNotExists
)
{
buff
.
append
(
"IF NOT EXISTS "
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/SessionRemote.java
浏览文件 @
343e4cb9
...
...
@@ -198,7 +198,7 @@ public class SessionRemote extends SessionWithState implements SessionFactory, D
}
private
String
getFilePrefix
(
String
dir
)
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
buff
.
append
(
dir
);
buff
.
append
(
'/'
);
for
(
int
i
=
0
;
i
<
databaseName
.
length
();
i
++)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Setting.java
浏览文件 @
343e4cb9
...
...
@@ -49,10 +49,8 @@ public class Setting extends DbObjectBase {
}
public
String
getCreateSQL
()
{
StringBuffer
buff
=
new
StringBuffer
();
buff
.
append
(
"SET "
);
buff
.
append
(
getSQL
());
buff
.
append
(
' '
);
StringBuilder
buff
=
new
StringBuilder
(
"SET "
);
buff
.
append
(
getSQL
()).
append
(
' '
);
if
(
stringValue
!=
null
)
{
buff
.
append
(
stringValue
);
}
else
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/User.java
浏览文件 @
343e4cb9
...
...
@@ -134,22 +134,20 @@ public class User extends RightOwner {
* @return the SQL statement
*/
public
String
getCreateSQL
(
boolean
password
,
boolean
ifNotExists
)
{
StringBuffer
buff
=
new
StringBuffer
();
buff
.
append
(
"CREATE USER "
);
StringBuilder
buff
=
new
StringBuilder
(
"CREATE USER "
);
if
(
ifNotExists
)
{
buff
.
append
(
"IF NOT EXISTS "
);
}
buff
.
append
(
getSQL
());
if
(
comment
!=
null
)
{
buff
.
append
(
" COMMENT "
);
buff
.
append
(
StringUtils
.
quoteStringSQL
(
comment
));
buff
.
append
(
" COMMENT "
).
append
(
StringUtils
.
quoteStringSQL
(
comment
));
}
if
(
password
)
{
buff
.
append
(
" SALT '"
)
;
buff
.
append
(
ByteUtils
.
convertBytesToString
(
salt
));
buff
.
append
(
"' HASH '"
);
buff
.
append
(
ByteUtils
.
convertBytesToString
(
passwordHash
));
buff
.
append
(
'\''
);
buff
.
append
(
" SALT '"
)
.
append
(
ByteUtils
.
convertBytesToString
(
salt
)).
append
(
"' HASH '"
).
append
(
ByteUtils
.
convertBytesToString
(
passwordHash
)).
append
(
'\''
);
}
else
{
buff
.
append
(
" PASSWORD ''"
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/UserAggregate.java
浏览文件 @
343e4cb9
...
...
@@ -54,11 +54,8 @@ public class UserAggregate extends DbObjectBase {
}
public
String
getCreateSQL
()
{
StringBuffer
buff
=
new
StringBuffer
();
buff
.
append
(
"CREATE FORCE AGGREGATE "
);
buff
.
append
(
getSQL
());
buff
.
append
(
" FOR "
);
buff
.
append
(
Parser
.
quoteIdentifier
(
className
));
StringBuilder
buff
=
new
StringBuilder
(
"CREATE FORCE AGGREGATE "
);
buff
.
append
(
getSQL
()).
append
(
" FOR "
).
append
(
Parser
.
quoteIdentifier
(
className
));
return
buff
.
toString
();
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/UserDataType.java
浏览文件 @
343e4cb9
...
...
@@ -33,12 +33,7 @@ public class UserDataType extends DbObjectBase {
}
public
String
getCreateSQL
()
{
StringBuffer
buff
=
new
StringBuffer
();
buff
.
append
(
"CREATE DOMAIN "
);
buff
.
append
(
getSQL
());
buff
.
append
(
" AS "
);
buff
.
append
(
column
.
getCreateSQL
());
return
buff
.
toString
();
return
"CREATE DOMAIN "
+
getSQL
()
+
" AS "
+
column
.
getCreateSQL
();
}
public
Column
getColumn
()
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/CompareLike.java
浏览文件 @
343e4cb9
...
...
@@ -166,7 +166,7 @@ public class CompareLike extends Condition {
return
;
}
int
maxMatch
=
0
;
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
while
(
maxMatch
<
patternLength
&&
types
[
maxMatch
]
==
MATCH
)
{
buff
.
append
(
pattern
[
maxMatch
++]);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/ConditionExists.java
浏览文件 @
343e4cb9
...
...
@@ -41,8 +41,7 @@ public class ConditionExists extends Condition {
}
public
String
getSQL
()
{
StringBuffer
buff
=
new
StringBuffer
(
"EXISTS("
);
return
buff
.
append
(
query
.
getPlanSQL
()).
append
(
')'
).
toString
();
return
"EXISTS("
+
query
.
getPlanSQL
()
+
")"
;
}
public
void
updateAggregate
(
Session
session
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/ConditionInSelect.java
浏览文件 @
343e4cb9
...
...
@@ -105,12 +105,7 @@ public class ConditionInSelect extends Condition {
}
public
String
getSQL
()
{
StringBuffer
buff
=
new
StringBuffer
(
"("
);
buff
.
append
(
left
.
getSQL
());
buff
.
append
(
" IN("
);
buff
.
append
(
query
.
getPlanSQL
());
buff
.
append
(
"))"
);
return
buff
.
toString
();
return
"("
+
left
.
getSQL
()
+
" IN("
+
query
.
getPlanSQL
()
+
"))"
;
}
public
void
updateAggregate
(
Session
session
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/Function.java
浏览文件 @
343e4cb9
...
...
@@ -1311,7 +1311,7 @@ public class Function extends Expression implements FunctionCall {
// avoid out of memory
return
s
;
}
StringBu
ffer
buff
=
new
StringBuff
er
(
s
.
length
());
StringBu
ilder
buff
=
new
StringBuild
er
(
s
.
length
());
int
start
=
0
;
int
len
=
replace
.
length
();
while
(
true
)
{
...
...
@@ -1328,7 +1328,7 @@ public class Function extends Expression implements FunctionCall {
}
private
static
String
repeat
(
String
s
,
int
count
)
{
StringBu
ffer
buff
=
new
StringBuff
er
(
s
.
length
()
*
count
);
StringBu
ilder
buff
=
new
StringBuild
er
(
s
.
length
()
*
count
);
while
(
count
--
>
0
)
{
buff
.
append
(
s
);
}
...
...
@@ -1336,7 +1336,7 @@ public class Function extends Expression implements FunctionCall {
}
private
static
String
rawToHex
(
String
s
)
{
StringBu
ffer
buff
=
new
StringBuff
er
(
4
*
s
.
length
());
StringBu
ilder
buff
=
new
StringBuild
er
(
4
*
s
.
length
());
for
(
int
i
=
0
;
i
<
s
.
length
();
i
++)
{
String
hex
=
Integer
.
toHexString
(
s
.
charAt
(
i
)
&
0xffff
);
for
(
int
j
=
hex
.
length
();
j
<
4
;
j
++)
{
...
...
@@ -1399,7 +1399,7 @@ public class Function extends Expression implements FunctionCall {
if
(
len
%
4
!=
0
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
DATA_CONVERSION_ERROR_1
,
s
);
}
StringBu
ffer
buff
=
new
StringBuff
er
(
len
/
4
);
StringBu
ilder
buff
=
new
StringBuild
er
(
len
/
4
);
for
(
int
i
=
0
;
i
<
len
;
i
+=
4
)
{
try
{
char
raw
=
(
char
)
Integer
.
parseInt
(
s
.
substring
(
i
,
i
+
4
),
16
);
...
...
@@ -1431,7 +1431,7 @@ public class Function extends Expression implements FunctionCall {
if
((
d
>
1000000000000
.)
||
(
d
<
-
1000000000000
.))
{
return
d
;
}
StringBu
ffer
s
=
new
StringBuff
er
();
StringBu
ilder
s
=
new
StringBuild
er
();
s
.
append
(
d
);
if
(
s
.
toString
().
indexOf
(
"E"
)
>=
0
)
{
return
d
;
...
...
@@ -1825,14 +1825,12 @@ public class Function extends Expression implements FunctionCall {
buff
.
append
(
'('
);
switch
(
info
.
type
)
{
case
CAST:
{
buff
.
append
(
args
[
0
].
getSQL
()).
append
(
" AS "
).
buff
.
append
(
args
[
0
].
getSQL
()).
append
(
" AS "
).
append
(
new
Column
(
null
,
dataType
,
precision
,
scale
,
displaySize
).
getCreateSQL
());
break
;
}
case
CONVERT:
{
buff
.
append
(
args
[
0
].
getSQL
()).
append
(
","
).
buff
.
append
(
args
[
0
].
getSQL
()).
append
(
','
).
append
(
new
Column
(
null
,
dataType
,
precision
,
scale
,
displaySize
).
getCreateSQL
());
break
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/Operation.java
浏览文件 @
343e4cb9
...
...
@@ -114,9 +114,8 @@ public class Operation extends Expression {
return
l
;
}
String
s1
=
l
.
getString
(),
s2
=
r
.
getString
();
StringBuffer
buff
=
new
StringBuffer
(
s1
.
length
()
+
s2
.
length
());
buff
.
append
(
s1
);
buff
.
append
(
s2
);
StringBuilder
buff
=
new
StringBuilder
(
s1
.
length
()
+
s2
.
length
());
buff
.
append
(
s1
).
append
(
s2
);
return
ValueString
.
get
(
buff
.
toString
());
}
case
PLUS:
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/TableFunction.java
浏览文件 @
343e4cb9
...
...
@@ -55,7 +55,7 @@ public class TableFunction extends Function {
int
i
=
0
;
for
(
Expression
e
:
args
)
{
buff
.
appendExceptFirst
(
", "
);
buff
.
append
(
columnList
[
i
++].
getCreateSQL
()).
append
(
"="
).
append
(
e
.
getSQL
());
buff
.
append
(
columnList
[
i
++].
getCreateSQL
()).
append
(
'='
).
append
(
e
.
getSQL
());
}
return
buff
.
append
(
')'
).
toString
();
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/fulltext/FullText.java
浏览文件 @
343e4cb9
...
...
@@ -556,12 +556,12 @@ public class FullText {
};
result
.
addRow
(
row
);
}
else
{
StringBu
ffer
buff
=
new
StringBuff
er
();
buff
.
append
(
StringUtils
.
quoteIdentifier
(
index
.
schema
))
;
buff
.
append
(
'.'
);
buff
.
append
(
StringUtils
.
quoteIdentifier
(
index
.
table
));
buff
.
append
(
" WHERE "
);
buff
.
append
(
key
);
StringBu
ilder
buff
=
new
StringBuild
er
();
buff
.
append
(
StringUtils
.
quoteIdentifier
(
index
.
schema
))
.
append
(
'.'
).
append
(
StringUtils
.
quoteIdentifier
(
index
.
table
)).
append
(
" WHERE "
).
append
(
key
);
String
query
=
buff
.
toString
();
result
.
addRow
(
new
String
[]
{
query
});
}
...
...
@@ -623,13 +623,15 @@ public class FullText {
+
StringUtils
.
quoteIdentifier
(
TRIGGER_PREFIX
+
table
);
stat
.
execute
(
"DROP TRIGGER IF EXISTS "
+
trigger
);
if
(
create
)
{
StringBuffer
buff
=
new
StringBuffer
(
"CREATE TRIGGER IF NOT EXISTS "
);
buff
.
append
(
trigger
);
buff
.
append
(
" AFTER INSERT, UPDATE, DELETE ON "
);
buff
.
append
(
StringUtils
.
quoteIdentifier
(
schema
)
+
"."
+
StringUtils
.
quoteIdentifier
(
table
));
buff
.
append
(
" FOR EACH ROW CALL \""
);
buff
.
append
(
FullText
.
FullTextTrigger
.
class
.
getName
());
buff
.
append
(
"\""
);
StringBuilder
buff
=
new
StringBuilder
(
"CREATE TRIGGER IF NOT EXISTS "
);
buff
.
append
(
trigger
).
append
(
" AFTER INSERT, UPDATE, DELETE ON "
).
append
(
StringUtils
.
quoteIdentifier
(
schema
)).
append
(
'.'
).
append
(
StringUtils
.
quoteIdentifier
(
table
)).
append
(
" FOR EACH ROW CALL \""
).
append
(
FullText
.
FullTextTrigger
.
class
.
getName
()).
append
(
"\""
);
stat
.
execute
(
buff
.
toString
());
}
}
...
...
@@ -637,8 +639,9 @@ public class FullText {
private
static
void
indexExistingRows
(
Connection
conn
,
String
schema
,
String
table
)
throws
SQLException
{
FullText
.
FullTextTrigger
existing
=
new
FullText
.
FullTextTrigger
();
existing
.
init
(
conn
,
schema
,
null
,
table
,
false
,
Trigger
.
INSERT
);
StringBuffer
buff
=
new
StringBuffer
(
"SELECT * FROM "
);
buff
.
append
(
StringUtils
.
quoteIdentifier
(
schema
)
+
"."
+
StringUtils
.
quoteIdentifier
(
table
));
StringBuilder
buff
=
new
StringBuilder
(
"SELECT * FROM "
);
buff
.
append
(
StringUtils
.
quoteIdentifier
(
schema
)).
append
(
'.'
).
append
(
StringUtils
.
quoteIdentifier
(
table
));
ResultSet
rs
=
conn
.
createStatement
().
executeQuery
(
buff
.
toString
());
int
columnCount
=
rs
.
getMetaData
().
getColumnCount
();
while
(
rs
.
next
())
{
...
...
@@ -654,7 +657,7 @@ public class FullText {
if
(
data
.
indexOf
(
'\''
)
<
0
)
{
return
"'"
+
data
+
"'"
;
}
StringBu
ffer
buff
=
new
StringBuff
er
(
data
.
length
()
+
2
);
StringBu
ilder
buff
=
new
StringBuild
er
(
data
.
length
()
+
2
);
buff
.
append
(
'\''
);
for
(
int
i
=
0
;
i
<
data
.
length
();
i
++)
{
char
ch
=
data
.
charAt
(
i
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/fulltext/FullTextLucene.java
浏览文件 @
343e4cb9
...
...
@@ -223,7 +223,7 @@ public class FullTextLucene extends FullText {
Statement
stat
=
conn
.
createStatement
();
String
trigger
=
StringUtils
.
quoteIdentifier
(
schema
)
+
"."
+
StringUtils
.
quoteIdentifier
(
TRIGGER_PREFIX
+
table
);
stat
.
execute
(
"DROP TRIGGER IF EXISTS "
+
trigger
);
StringBu
ffer
buff
=
new
StringBuff
er
(
"CREATE TRIGGER IF NOT EXISTS "
);
StringBu
ilder
buff
=
new
StringBuild
er
(
"CREATE TRIGGER IF NOT EXISTS "
);
buff
.
append
(
trigger
);
buff
.
append
(
" AFTER INSERT, UPDATE, DELETE ON "
);
buff
.
append
(
StringUtils
.
quoteIdentifier
(
schema
)
+
"."
+
StringUtils
.
quoteIdentifier
(
table
));
...
...
@@ -279,7 +279,7 @@ public class FullTextLucene extends FullText {
private
static
void
indexExistingRows
(
Connection
conn
,
String
schema
,
String
table
)
throws
SQLException
{
FullTextLucene
.
FullTextTrigger
existing
=
new
FullTextLucene
.
FullTextTrigger
();
existing
.
init
(
conn
,
schema
,
null
,
table
,
false
,
Trigger
.
INSERT
);
StringBu
ffer
buff
=
new
StringBuff
er
(
"SELECT * FROM "
);
StringBu
ilder
buff
=
new
StringBuild
er
(
"SELECT * FROM "
);
buff
.
append
(
StringUtils
.
quoteIdentifier
(
schema
)
+
"."
+
StringUtils
.
quoteIdentifier
(
table
));
ResultSet
rs
=
conn
.
createStatement
().
executeQuery
(
buff
.
toString
());
int
columnCount
=
rs
.
getMetaData
().
getColumnCount
();
...
...
@@ -530,7 +530,7 @@ public class FullTextLucene extends FullText {
private
String
getQuery
(
Object
[]
row
)
throws
SQLException
{
StatementBuilder
buff
=
new
StatementBuilder
();
if
(
schema
!=
null
)
{
buff
.
append
(
StringUtils
.
quoteIdentifier
(
schema
)).
append
(
"."
);
buff
.
append
(
StringUtils
.
quoteIdentifier
(
schema
)).
append
(
'.'
);
}
buff
.
append
(
StringUtils
.
quoteIdentifier
(
table
)).
append
(
" WHERE "
);
for
(
int
columnIndex
:
keys
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/BaseIndex.java
浏览文件 @
343e4cb9
...
...
@@ -150,7 +150,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
}
public
SQLException
getDuplicateKeyException
()
{
StringBu
ffer
buff
=
new
StringBuff
er
(
getName
());
StringBu
ilder
buff
=
new
StringBuild
er
(
getName
());
buff
.
append
(
" ON "
).
append
(
table
.
getSQL
()).
append
(
'('
);
buff
.
append
(
getColumnListSQL
()).
append
(
')'
);
return
Message
.
getSQLException
(
ErrorCode
.
DUPLICATE_KEY_1
,
buff
.
toString
());
...
...
@@ -319,7 +319,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
}
public
String
getCreateSQLForCopy
(
Table
table
,
String
quotedName
)
{
StringBu
ffer
buff
=
new
StringBuff
er
(
"CREATE "
);
StringBu
ilder
buff
=
new
StringBuild
er
(
"CREATE "
);
buff
.
append
(
indexType
.
getSQL
());
if
(!
indexType
.
getPrimaryKey
())
{
buff
.
append
(
' '
).
append
(
quotedName
);
...
...
@@ -328,7 +328,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
if
(
comment
!=
null
)
{
buff
.
append
(
" COMMENT "
).
append
(
StringUtils
.
quoteStringSQL
(
comment
));
}
buff
.
append
(
'('
).
append
(
getColumnListSQL
()).
append
(
")"
);
buff
.
append
(
'('
).
append
(
getColumnListSQL
()).
append
(
')'
);
return
buff
.
toString
();
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/IndexCondition.java
浏览文件 @
343e4cb9
...
...
@@ -85,7 +85,7 @@ public class IndexCondition {
if
(
compareType
==
Comparison
.
FALSE
)
{
return
"FALSE"
;
}
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
buff
.
append
(
column
.
getSQL
());
switch
(
compareType
)
{
case
Comparison
.
EQUAL
:
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/IndexType.java
浏览文件 @
343e4cb9
...
...
@@ -130,7 +130,7 @@ public class IndexType {
* @return the SQL snippet
*/
public
String
getSQL
()
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
if
(
primaryKey
)
{
buff
.
append
(
"PRIMARY KEY"
);
if
(
hash
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/LinkedIndex.java
浏览文件 @
343e4cb9
...
...
@@ -51,7 +51,7 @@ public class LinkedIndex extends BaseIndex {
}
public
void
add
(
Session
session
,
Row
row
)
throws
SQLException
{
StringBu
ffer
buff
=
new
StringBuff
er
(
"INSERT INTO "
);
StringBu
ilder
buff
=
new
StringBuild
er
(
"INSERT INTO "
);
buff
.
append
(
targetTableName
);
buff
.
append
(
" VALUES("
);
for
(
int
i
=
0
,
j
=
0
;
i
<
row
.
getColumnCount
();
i
++)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/jdbc/JdbcClob.java
浏览文件 @
343e4cb9
...
...
@@ -152,7 +152,7 @@ public class JdbcClob extends TraceObject implements Clob
if
(
length
<
0
)
{
throw
Message
.
getInvalidValueException
(
"length"
,
""
+
length
);
}
StringBu
ffer
buff
=
new
StringBuff
er
(
Math
.
min
(
4096
,
length
));
StringBu
ilder
buff
=
new
StringBuild
er
(
Math
.
min
(
4096
,
length
));
Reader
reader
=
value
.
getReader
();
try
{
IOUtils
.
skipFully
(
reader
,
pos
-
1
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/jdbc/JdbcSQLException.java
浏览文件 @
343e4cb9
...
...
@@ -148,7 +148,7 @@ public class JdbcSQLException extends SQLException {
}
private
void
buildMessage
()
{
StringBu
ffer
buff
=
new
StringBuff
er
(
originalMessage
==
null
?
"- "
:
originalMessage
);
StringBu
ilder
buff
=
new
StringBuild
er
(
originalMessage
==
null
?
"- "
:
originalMessage
);
if
(
sql
!=
null
)
{
buff
.
append
(
"; SQL statement:\n"
);
buff
.
append
(
sql
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/jdbcx/JdbcXAConnection.java
浏览文件 @
343e4cb9
...
...
@@ -415,7 +415,7 @@ implements XAConnection, XAResource
}
private
String
quoteXid
(
Xid
xid
)
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
buff
.
append
(
"\"f:"
);
buff
.
append
(
xid
.
getFormatId
());
buff
.
append
(
",bq:"
);
...
...
@@ -429,7 +429,7 @@ implements XAConnection, XAResource
}
private
String
quoteFlags
(
int
flags
)
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
if
((
flags
&
XAResource
.
TMENDRSCAN
)
!=
0
)
{
buff
.
append
(
"|XAResource.TMENDRSCAN"
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/jdbcx/JdbcXid.java
浏览文件 @
343e4cb9
...
...
@@ -53,7 +53,7 @@ implements Xid
* INTERNAL
*/
public
String
getAsString
()
{
StringBu
ffer
buff
=
new
StringBuff
er
(
PREFIX
);
StringBu
ilder
buff
=
new
StringBuild
er
(
PREFIX
);
buff
.
append
(
'_'
);
buff
.
append
(
formatId
);
buff
.
append
(
'_'
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/message/Trace.java
浏览文件 @
343e4cb9
...
...
@@ -214,7 +214,7 @@ public class Trace {
if
(!
isEnabled
(
TraceSystem
.
INFO
))
{
return
;
}
StringBu
ffer
buff
=
new
StringBuff
er
(
sql
.
length
()
+
params
.
length
()
+
20
);
StringBu
ilder
buff
=
new
StringBuild
er
(
sql
.
length
()
+
params
.
length
()
+
20
);
buff
.
append
(
lineSeparator
);
buff
.
append
(
"/*SQL"
);
boolean
space
=
false
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/message/TraceObject.java
浏览文件 @
343e4cb9
...
...
@@ -356,7 +356,7 @@ public class TraceObject {
if
(
map
.
size
()
==
0
)
{
return
"new Map()"
;
}
StringBu
ffer
buff
=
new
StringBuff
er
(
"new Map() /* "
);
StringBu
ilder
buff
=
new
StringBuild
er
(
"new Map() /* "
);
try
{
for
(
Map
.
Entry
<
String
,
Class
<
?
>>
entry
:
map
.
entrySet
())
{
String
key
=
entry
.
getKey
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/result/UpdatableRow.java
浏览文件 @
343e4cb9
...
...
@@ -150,7 +150,7 @@ public class UpdatableRow {
}
// public boolean isRowDeleted(Value[] row) throws SQLException {
// StringBu
ffer buff = new StringBuff
er();
// StringBu
ilder buff = new StringBuild
er();
// buff.append("SELECT COUNT(*) FROM ");
// buff.append(StringUtils.quoteIdentifier(tableName));
// appendKeyCondition(buff);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/schema/Constant.java
浏览文件 @
343e4cb9
...
...
@@ -38,7 +38,7 @@ public class Constant extends SchemaObjectBase {
}
public
String
getCreateSQL
()
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
buff
.
append
(
"CREATE CONSTANT "
);
buff
.
append
(
getSQL
());
buff
.
append
(
" VALUE "
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/schema/Schema.java
浏览文件 @
343e4cb9
...
...
@@ -88,7 +88,7 @@ public class Schema extends DbObjectBase {
if
(
system
)
{
return
null
;
}
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
buff
.
append
(
"CREATE SCHEMA IF NOT EXISTS "
);
buff
.
append
(
getSQL
());
buff
.
append
(
" AUTHORIZATION "
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/schema/Sequence.java
浏览文件 @
343e4cb9
...
...
@@ -69,7 +69,7 @@ public class Sequence extends SchemaObjectBase {
}
public
synchronized
String
getCreateSQL
()
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
buff
.
append
(
"CREATE SEQUENCE "
);
buff
.
append
(
getSQL
());
buff
.
append
(
" START WITH "
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/schema/TriggerObject.java
浏览文件 @
343e4cb9
...
...
@@ -229,7 +229,7 @@ public class TriggerObject extends SchemaObjectBase {
}
public
String
getCreateSQLForCopy
(
Table
table
,
String
quotedName
)
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
buff
.
append
(
"CREATE FORCE TRIGGER "
);
buff
.
append
(
quotedName
);
if
(
before
)
{
...
...
@@ -255,7 +255,7 @@ public class TriggerObject extends SchemaObjectBase {
}
public
String
getTypeNameList
()
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
if
((
typeMask
&
Trigger
.
INSERT
)
!=
0
)
{
buff
.
append
(
"INSERT"
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/web/PageParser.java
浏览文件 @
343e4cb9
...
...
@@ -21,14 +21,14 @@ public class PageParser {
private
int
pos
;
private
Map
<
String
,
Object
>
settings
;
private
int
len
;
private
StringBu
ff
er
result
;
private
StringBu
ild
er
result
;
private
PageParser
(
String
page
,
Map
<
String
,
Object
>
settings
,
int
pos
)
{
this
.
page
=
page
;
this
.
pos
=
pos
;
this
.
len
=
page
.
length
();
this
.
settings
=
settings
;
result
=
new
StringBu
ff
er
(
len
);
result
=
new
StringBu
ild
er
(
len
);
}
/**
...
...
@@ -46,7 +46,7 @@ public class PageParser {
private
void
setError
(
int
i
)
{
String
s
=
page
.
substring
(
0
,
i
)
+
"####BUG####"
+
page
.
substring
(
i
);
s
=
PageParser
.
escapeHtml
(
s
);
result
=
new
StringBu
ff
er
();
result
=
new
StringBu
ild
er
();
result
.
append
(
s
);
}
...
...
@@ -74,7 +74,7 @@ public class PageParser {
@SuppressWarnings
(
"unchecked"
)
private
void
parseAll
()
throws
ParseException
{
StringBu
ff
er
buff
=
result
;
StringBu
ild
er
buff
=
result
;
String
p
=
page
;
int
i
=
pos
;
for
(;
i
<
len
;
i
++)
{
...
...
@@ -242,7 +242,7 @@ public class PageParser {
return
" "
;
}
}
StringBu
ffer
buff
=
new
StringBuff
er
(
s
.
length
());
StringBu
ilder
buff
=
new
StringBuild
er
(
s
.
length
());
boolean
convertSpace
=
true
;
for
(
int
i
=
0
;
i
<
s
.
length
();
i
++)
{
char
c
=
s
.
charAt
(
i
);
...
...
@@ -311,7 +311,7 @@ public class PageParser {
if
(
s
.
length
()
==
0
)
{
return
""
;
}
StringBu
ffer
buff
=
new
StringBuff
er
(
s
.
length
());
StringBu
ilder
buff
=
new
StringBuild
er
(
s
.
length
());
for
(
int
i
=
0
;
i
<
s
.
length
();
i
++)
{
char
c
=
s
.
charAt
(
i
);
switch
(
c
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/web/WebThread.java
浏览文件 @
343e4cb9
...
...
@@ -286,7 +286,7 @@ class WebThread extends Thread implements DatabaseEventListener {
}
private
String
getComboBox
(
String
[]
elements
,
String
selected
)
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
for
(
String
value
:
elements
)
{
buff
.
append
(
"<option value=\""
);
buff
.
append
(
PageParser
.
escapeHtmlData
(
value
));
...
...
@@ -302,7 +302,7 @@ class WebThread extends Thread implements DatabaseEventListener {
}
private
String
getComboBox
(
String
[][]
elements
,
String
selected
)
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
for
(
String
[]
n
:
elements
)
{
buff
.
append
(
"<option value=\""
);
buff
.
append
(
PageParser
.
escapeHtmlData
(
n
[
0
]));
...
...
@@ -318,7 +318,7 @@ class WebThread extends Thread implements DatabaseEventListener {
}
private
String
readHeaderLine
()
throws
IOException
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
while
(
true
)
{
int
i
=
input
.
read
();
if
(
i
==
-
1
)
{
...
...
@@ -684,8 +684,8 @@ class WebThread extends Thread implements DatabaseEventListener {
return
"query.jsp"
;
}
private
int
addColumns
(
DbTableOrView
table
,
StringBu
ff
er
buff
,
int
treeIndex
,
boolean
showColumnTypes
,
StringBu
ff
er
columnsBuffer
)
{
private
int
addColumns
(
DbTableOrView
table
,
StringBu
ild
er
buff
,
int
treeIndex
,
boolean
showColumnTypes
,
StringBu
ild
er
columnsBuffer
)
{
DbColumn
[]
columns
=
table
.
columns
;
for
(
int
i
=
0
;
columns
!=
null
&&
i
<
columns
.
length
;
i
++)
{
DbColumn
column
=
columns
[
i
];
...
...
@@ -727,7 +727,7 @@ class WebThread extends Thread implements DatabaseEventListener {
String
columns
;
}
private
int
addIndexes
(
DatabaseMetaData
meta
,
String
table
,
String
schema
,
StringBu
ff
er
buff
,
int
treeIndex
)
private
int
addIndexes
(
DatabaseMetaData
meta
,
String
table
,
String
schema
,
StringBu
ild
er
buff
,
int
treeIndex
)
throws
SQLException
{
// index reading is very slow for oracle (2 seconds per index), so don't
// do it
...
...
@@ -778,7 +778,7 @@ class WebThread extends Thread implements DatabaseEventListener {
return
treeIndex
;
}
private
int
addTablesAndViews
(
DbSchema
schema
,
boolean
mainSchema
,
StringBu
ff
er
buff
,
int
treeIndex
)
private
int
addTablesAndViews
(
DbSchema
schema
,
boolean
mainSchema
,
StringBu
ild
er
buff
,
int
treeIndex
)
throws
SQLException
{
if
(
schema
==
null
)
{
return
treeIndex
;
...
...
@@ -808,7 +808,7 @@ class WebThread extends Thread implements DatabaseEventListener {
+
"', 'javascript:ins(\\'"
+
tab
+
"\\',true)');\n"
);
treeIndex
++;
if
(
mainSchema
)
{
StringBu
ffer
columnsBuffer
=
new
StringBuff
er
();
StringBu
ilder
columnsBuffer
=
new
StringBuild
er
();
treeIndex
=
addColumns
(
table
,
buff
,
treeIndex
,
notManyTables
,
columnsBuffer
);
if
(!
isOracle
&&
notManyTables
)
{
treeIndex
=
addIndexes
(
meta
,
table
.
name
,
schema
.
name
,
buff
,
treeIndex
);
...
...
@@ -832,7 +832,7 @@ class WebThread extends Thread implements DatabaseEventListener {
+
"', 'javascript:ins(\\'"
+
tab
+
"\\',true)');\n"
);
treeIndex
++;
if
(
mainSchema
)
{
StringBu
ffer
columnsBuffer
=
new
StringBuff
er
();
StringBu
ilder
columnsBuffer
=
new
StringBuild
er
();
treeIndex
=
addColumns
(
view
,
buff
,
treeIndex
,
notManyTables
,
columnsBuffer
);
if
(
schema
.
contents
.
isH2
)
{
PreparedStatement
prep
=
null
;
...
...
@@ -868,7 +868,7 @@ class WebThread extends Thread implements DatabaseEventListener {
DatabaseMetaData
meta
=
session
.
getMetaData
();
isH2
=
contents
.
isH2
;
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
buff
.
append
(
"setNode(0, 0, 0, 'database', '"
+
PageParser
.
escapeJavaScript
((
String
)
session
.
get
(
"url"
))
+
"', null);\n"
);
int
treeIndex
=
1
;
...
...
@@ -979,7 +979,7 @@ class WebThread extends Thread implements DatabaseEventListener {
private
String
linkToSource
(
String
s
)
{
try
{
StringBu
ffer
result
=
new
StringBuff
er
(
s
.
length
());
StringBu
ilder
result
=
new
StringBuild
er
(
s
.
length
());
int
idx
=
s
.
indexOf
(
"<br />"
);
result
.
append
(
s
.
substring
(
0
,
idx
));
while
(
true
)
{
...
...
@@ -1274,7 +1274,7 @@ class WebThread extends Thread implements DatabaseEventListener {
}
list
.
add
(
s
);
}
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
String
s
=
list
.
get
(
i
);
if
(!
s
.
startsWith
(
"@"
))
{
...
...
@@ -1642,7 +1642,7 @@ class WebThread extends Thread implements DatabaseEventListener {
private
String
getResult
(
Connection
conn
,
int
id
,
String
sql
,
boolean
allowEdit
,
boolean
forceEdit
)
{
try
{
sql
=
sql
.
trim
();
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
String
sqlUpper
=
StringUtils
.
toUpperEnglish
(
sql
);
if
(
sqlUpper
.
indexOf
(
"CREATE"
)
>=
0
||
sqlUpper
.
indexOf
(
"DROP"
)
>=
0
||
sqlUpper
.
indexOf
(
"ALTER"
)
>=
0
||
sqlUpper
.
indexOf
(
"RUNSCRIPT"
)
>=
0
)
{
...
...
@@ -1837,7 +1837,7 @@ class WebThread extends Thread implements DatabaseEventListener {
}
private
String
getHistoryString
()
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
ArrayList
<
String
>
history
=
session
.
getCommands
();
buff
.
append
(
"<table cellspacing=0 cellpadding=0>"
);
buff
.
append
(
"<tr><th></th><th>Command</th></tr>"
);
...
...
@@ -1857,7 +1857,7 @@ class WebThread extends Thread implements DatabaseEventListener {
}
private
String
getParameterResultSet
(
ParameterMetaData
meta
)
throws
SQLException
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
if
(
meta
==
null
)
{
return
"No parameter meta data"
;
}
...
...
@@ -1887,7 +1887,7 @@ class WebThread extends Thread implements DatabaseEventListener {
boolean
allowEdit
)
throws
SQLException
{
int
maxrows
=
getMaxrows
();
time
=
System
.
currentTimeMillis
()
-
time
;
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
if
(
edit
)
{
buff
.
append
(
"<form id=\"editing\" name=\"editing\" method=\"post\" "
+
"action=\"editResult.do?jsessionid=${sessionId}\" id=\"mainForm\" target=\"h2result\">"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/Column.java
浏览文件 @
343e4cb9
...
...
@@ -379,7 +379,7 @@ public class Column {
}
public
String
getCreateSQL
()
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
if
(
name
!=
null
)
{
buff
.
append
(
Parser
.
quoteIdentifier
(
name
)).
append
(
' '
);
}
...
...
@@ -396,7 +396,7 @@ public class Column {
case
Value
.
STRING_IGNORECASE
:
case
Value
.
STRING_FIXED
:
if
(
precision
<
Integer
.
MAX_VALUE
)
{
buff
.
append
(
'('
).
append
(
precision
).
append
(
")"
);
buff
.
append
(
'('
).
append
(
precision
).
append
(
')'
);
}
break
;
default
:
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/IndexColumn.java
浏览文件 @
343e4cb9
...
...
@@ -38,7 +38,7 @@ public class IndexColumn {
* @return the SQL snippet
*/
public
String
getSQL
()
{
StringBu
ffer
buff
=
new
StringBuff
er
(
column
.
getSQL
());
StringBu
ilder
buff
=
new
StringBuild
er
(
column
.
getSQL
());
if
((
sortType
&
SortOrder
.
DESCENDING
)
!=
0
)
{
buff
.
append
(
" DESC"
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/LinkSchema.java
浏览文件 @
343e4cb9
...
...
@@ -51,14 +51,14 @@ public class LinkSchema {
rs
=
c2
.
getMetaData
().
getTables
(
null
,
sourceSchema
,
null
,
null
);
while
(
rs
.
next
())
{
String
table
=
rs
.
getString
(
"TABLE_NAME"
);
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
buff
.
append
(
"DROP TABLE IF EXISTS "
);
buff
.
append
(
StringUtils
.
quoteIdentifier
(
targetSchema
));
buff
.
append
(
'.'
);
buff
.
append
(
StringUtils
.
quoteIdentifier
(
table
));
String
sql
=
buff
.
toString
();
stat
.
execute
(
sql
);
buff
=
new
StringBu
ff
er
();
buff
=
new
StringBu
ild
er
();
buff
.
append
(
"CREATE LINKED TABLE "
);
buff
.
append
(
StringUtils
.
quoteIdentifier
(
targetSchema
));
buff
.
append
(
'.'
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/MetaTable.java
浏览文件 @
343e4cb9
...
...
@@ -1341,7 +1341,7 @@ public class MetaTable extends Table {
}
String
columnList
=
null
;
if
(
columns
!=
null
)
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
for
(
int
j
=
0
;
j
<
columns
.
length
;
j
++)
{
if
(
j
>
0
)
{
buff
.
append
(
','
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/TableData.java
浏览文件 @
343e4cb9
...
...
@@ -458,7 +458,7 @@ public class TableData extends Table implements RecordReader {
}
private
String
getDeadlockDetails
(
ObjectArray
<
Session
>
sessions
)
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
for
(
Session
s
:
sessions
)
{
buff
.
append
(
'\n'
);
Table
lock
=
s
.
getWaitForLock
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/TableLink.java
浏览文件 @
343e4cb9
...
...
@@ -296,7 +296,7 @@ public class TableLink extends Table {
}
public
String
getCreateSQL
()
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
buff
.
append
(
"CREATE FORCE "
);
if
(
getTemporary
())
{
if
(
globalTemporary
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/TableView.java
浏览文件 @
343e4cb9
...
...
@@ -246,10 +246,8 @@ public class TableView extends Table {
public
String
getSQL
()
{
if
(
getTemporary
())
{
StringBuffer
buff
=
new
StringBuffer
(
querySQL
.
length
());
buff
.
append
(
"("
);
buff
.
append
(
querySQL
);
buff
.
append
(
")"
);
StringBuilder
buff
=
new
StringBuilder
(
querySQL
.
length
());
buff
.
append
(
'('
).
append
(
querySQL
).
append
(
')'
);
return
buff
.
toString
();
}
return
super
.
getSQL
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/ConvertTraceFile.java
浏览文件 @
343e4cb9
...
...
@@ -181,7 +181,7 @@ public class ConvertTraceFile extends Tool {
timeTotal
=
1
;
}
for
(
Stat
stat
:
list
)
{
StringBu
ffer
buff
=
new
StringBuff
er
(
100
);
StringBu
ilder
buff
=
new
StringBuild
er
(
100
);
buff
.
append
(
"-- "
);
buff
.
append
(
padNumberLeft
(
100
*
stat
.
time
/
timeTotal
,
3
));
buff
.
append
(
"% "
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/Csv.java
浏览文件 @
343e4cb9
...
...
@@ -267,7 +267,7 @@ public class Csv implements SimpleRowSource {
return
data
;
}
}
StringBu
ffer
buff
=
new
StringBuff
er
(
data
.
length
());
StringBu
ilder
buff
=
new
StringBuild
er
(
data
.
length
());
for
(
int
i
=
0
;
i
<
data
.
length
();
i
++)
{
char
ch
=
data
.
charAt
(
i
);
if
(
ch
==
fieldDelimiter
||
ch
==
escapeCharacter
)
{
...
...
@@ -352,7 +352,7 @@ public class Csv implements SimpleRowSource {
continue
;
}
else
if
(
ch
==
fieldDelimiter
)
{
// delimited value
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
boolean
containsEscape
=
false
;
while
(
true
)
{
ch
=
readChar
();
...
...
@@ -413,7 +413,7 @@ public class Csv implements SimpleRowSource {
break
;
}
else
{
// un-delimited value
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
buff
.
append
((
char
)
ch
);
while
(
true
)
{
ch
=
readChar
();
...
...
@@ -442,7 +442,7 @@ public class Csv implements SimpleRowSource {
}
private
String
unEscape
(
String
s
)
{
StringBu
ffer
buff
=
new
StringBuff
er
(
s
.
length
());
StringBu
ilder
buff
=
new
StringBuild
er
(
s
.
length
());
int
start
=
0
;
char
[]
chars
=
null
;
while
(
true
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/MultiDimension.java
浏览文件 @
343e4cb9
...
...
@@ -108,7 +108,7 @@ public class MultiDimension {
* @return the query
*/
public
String
generatePreparedQuery
(
String
table
,
String
scalarColumn
,
String
[]
columns
)
{
StringBu
ffer
buff
=
new
StringBuff
er
(
"SELECT D.* FROM "
);
StringBu
ilder
buff
=
new
StringBuild
er
(
"SELECT D.* FROM "
);
buff
.
append
(
StringUtils
.
quoteIdentifier
(
table
));
buff
.
append
(
" D, TABLE(_FROM_ BIGINT=?, _TO_ BIGINT=?) WHERE "
);
buff
.
append
(
StringUtils
.
quoteIdentifier
(
scalarColumn
));
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/Recover.java
浏览文件 @
343e4cb9
...
...
@@ -259,14 +259,14 @@ public class Recover extends Tool implements DataHandler {
byte
[]
salt
=
RandomUtils
.
getSecureBytes
(
Constants
.
SALT_LEN
);
byte
[]
passwordHash
=
sha
.
getHashWithSalt
(
userPasswordHash
,
salt
);
boolean
admin
=
sql
.
indexOf
(
"ADMIN"
)
>=
0
;
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
buff
.
append
(
"CREATE USER "
);
buff
.
append
(
Parser
.
quoteIdentifier
(
userName
));
buff
.
append
(
" SALT '"
);
buff
.
append
(
ByteUtils
.
convertBytesToString
(
salt
));
buff
.
append
(
"' HASH '"
);
buff
.
append
(
ByteUtils
.
convertBytesToString
(
passwordHash
));
buff
.
append
(
"'"
);
buff
.
append
(
'\''
);
if
(
admin
)
{
buff
.
append
(
" ADMIN"
);
}
...
...
@@ -331,7 +331,7 @@ public class Recover extends Tool implements DataHandler {
private
void
writeDataError
(
PrintWriter
writer
,
String
error
,
byte
[]
data
,
int
dumpBlocks
)
{
writer
.
println
(
"-- ERROR: "
+
error
+
" block:"
+
block
+
" blockCount:"
+
blockCount
+
" storageId:"
+
storageId
+
" recordLength:"
+
recordLength
+
" valueId:"
+
valueId
);
StringBu
ffer
sb
=
new
StringBuff
er
();
StringBu
ilder
sb
=
new
StringBuild
er
();
for
(
int
i
=
0
;
i
<
dumpBlocks
*
DiskFile
.
BLOCK_SIZE
;
i
++)
{
int
x
=
data
[
i
]
&
0xff
;
if
(
x
>=
' '
&&
x
<
128
)
{
...
...
@@ -341,7 +341,7 @@ public class Recover extends Tool implements DataHandler {
}
}
writer
.
println
(
"-- dump: "
+
sb
.
toString
());
sb
=
new
StringBu
ff
er
();
sb
=
new
StringBu
ild
er
();
for
(
int
i
=
0
;
i
<
dumpBlocks
*
DiskFile
.
BLOCK_SIZE
;
i
++)
{
int
x
=
data
[
i
]
&
0xff
;
sb
.
append
(
' '
);
...
...
@@ -407,7 +407,7 @@ public class Recover extends Tool implements DataHandler {
writeDataError
(
writer
,
"out of memory"
,
s
.
getBytes
(),
blockCount
);
return
;
}
StringBu
ffer
sb
=
new
StringBuff
er
();
StringBu
ilder
sb
=
new
StringBuild
er
();
sb
.
append
(
"// data: "
);
for
(
valueId
=
0
;
valueId
<
recordLength
;
valueId
++)
{
try
{
...
...
@@ -1024,12 +1024,12 @@ public class Recover extends Tool implements DataHandler {
byte
[]
userPasswordHash
=
sha
.
getKeyPasswordHash
(
userName
,
""
.
toCharArray
());
byte
[]
salt
=
RandomUtils
.
getSecureBytes
(
Constants
.
SALT_LEN
);
byte
[]
passwordHash
=
sha
.
getHashWithSalt
(
userPasswordHash
,
salt
);
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
buff
.
append
(
"SALT '"
);
buff
.
append
(
ByteUtils
.
convertBytesToString
(
salt
));
buff
.
append
(
"' HASH '"
);
buff
.
append
(
ByteUtils
.
convertBytesToString
(
passwordHash
));
buff
.
append
(
"'"
);
buff
.
append
(
'\''
);
byte
[]
replacement
=
buff
.
toString
().
getBytes
();
System
.
arraycopy
(
replacement
,
0
,
s
.
getBytes
(),
saltIndex
,
replacement
.
length
);
store
.
seek
(
pageSize
*
pageId
);
...
...
@@ -1062,7 +1062,7 @@ public class Recover extends Tool implements DataHandler {
}
private
void
writeRow
(
PrintWriter
writer
,
DataPage
s
,
Value
[]
data
)
{
StringBu
ffer
sb
=
new
StringBuff
er
();
StringBu
ilder
sb
=
new
StringBuild
er
();
sb
.
append
(
"INSERT INTO O_"
+
storageName
+
" VALUES("
);
for
(
valueId
=
0
;
valueId
<
recordLength
;
valueId
++)
{
try
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/RunScript.java
浏览文件 @
343e4cb9
...
...
@@ -116,7 +116,7 @@ public class RunScript extends Tool {
String
driver
=
args
[++
i
];
ClassUtils
.
loadUserClass
(
driver
);
}
else
if
(
arg
.
equals
(
"-options"
))
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
i
++;
for
(;
i
<
args
.
length
;
i
++)
{
buff
.
append
(
' '
);
...
...
@@ -218,7 +218,7 @@ public class RunScript extends Tool {
if
(
query
)
{
ResultSet
rs
=
stat
.
getResultSet
();
int
columns
=
rs
.
getMetaData
().
getColumnCount
();
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
while
(
rs
.
next
())
{
buff
.
append
(
"\n-->"
);
for
(
int
i
=
0
;
i
<
columns
;
i
++)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/Script.java
浏览文件 @
343e4cb9
...
...
@@ -69,8 +69,8 @@ public class Script extends Tool {
}
else
if
(
arg
.
equals
(
"-script"
))
{
file
=
args
[++
i
];
}
else
if
(
arg
.
equals
(
"-options"
))
{
StringBu
ffer
buff1
=
new
StringBuff
er
();
StringBu
ffer
buff2
=
new
StringBuff
er
();
StringBu
ilder
buff1
=
new
StringBuild
er
();
StringBu
ilder
buff2
=
new
StringBuild
er
();
i
++;
for
(;
i
<
args
.
length
;
i
++)
{
String
a
=
args
[
i
];
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/Server.java
浏览文件 @
343e4cb9
...
...
@@ -266,18 +266,16 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
* @return the status
*/
public
String
getStatus
()
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
if
(
isRunning
(
false
))
{
buff
.
append
(
service
.
getType
());
buff
.
append
(
" server running on "
);
buff
.
append
(
service
.
getURL
());
buff
.
append
(
" ("
);
buff
.
append
(
service
.
getType
()).
append
(
" server running on "
);
buff
.
append
(
service
.
getURL
()).
append
(
" ("
);
if
(
service
.
getAllowOthers
())
{
buff
.
append
(
"others can connect"
);
}
else
{
buff
.
append
(
"only local connections"
);
}
buff
.
append
(
")"
);
buff
.
append
(
')'
);
}
else
{
buff
.
append
(
"The "
+
service
.
getType
()
+
" server could not be started. Possible cause: another server is already running on "
);
buff
.
append
(
service
.
getURL
());
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/Shell.java
浏览文件 @
343e4cb9
...
...
@@ -448,7 +448,7 @@ public class Shell extends Tool {
longest
=
Math
.
max
(
longest
,
l
);
total
+=
l
;
}
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
if
(!
listMode
)
{
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
if
(
i
>
0
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/ScriptReader.java
浏览文件 @
343e4cb9
...
...
@@ -63,7 +63,7 @@ public class ScriptReader {
if
(
end
)
{
return
null
;
}
StringBu
ffer
buff
=
new
StringBuff
er
(
200
);
StringBu
ilder
buff
=
new
StringBuild
er
(
200
);
int
previous
=
0
;
int
c
=
read
();
while
(
true
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/StatementBuilder.java
浏览文件 @
343e4cb9
...
...
@@ -7,13 +7,14 @@
package
org
.
h2
.
util
;
/**
* A utility class to build a statement. In addition to the methods supported by StringBuilder,
* it allows to add a text only in the second iteration. This simplified constructs such as:
* A utility class to build a statement. In addition to the methods supported by
* StringBuilder, it allows to add a text only in the second iteration. This
* simplified constructs such as:
* <pre>
* StringBuilder buff = new StringBuilder();
* for (int i = 0; i < args.length; i++) {
* if (i > 0) {
* buff.append(
", "
);
* buff.append(
", "
);
* }
* buff.append(args[i]);
* }
...
...
@@ -22,7 +23,7 @@ package org.h2.util;
* <pre>
* StatementBuilder buff = new StatementBuilder();
* for (String s : args) {
* buff.appendExceptFirst(
", "
);
* buff.appendExceptFirst(
", "
);
* buff.append(a);
* }
*</pre>
...
...
@@ -116,4 +117,13 @@ public class StatementBuilder {
return
builder
.
toString
();
}
/**
* Get the length.
*
* @return the length
*/
public
int
length
()
{
return
builder
.
length
();
}
}
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/StringUtils.java
浏览文件 @
343e4cb9
...
...
@@ -76,7 +76,7 @@ public class StringUtils {
if
(
s
==
null
)
{
return
"NULL"
;
}
StringBu
ffer
buff
=
new
StringBuff
er
(
s
.
length
()
+
2
);
StringBu
ilder
buff
=
new
StringBuild
er
(
s
.
length
()
+
2
);
buff
.
append
(
'\''
);
for
(
int
i
=
0
;
i
<
s
.
length
();
i
++)
{
char
c
=
s
.
charAt
(
i
);
...
...
@@ -102,7 +102,7 @@ public class StringUtils {
* @return the Java representation
*/
public
static
String
javaEncode
(
String
s
)
{
StringBu
ffer
buff
=
new
StringBuff
er
(
s
.
length
());
StringBu
ilder
buff
=
new
StringBuild
er
(
s
.
length
());
for
(
int
i
=
0
;
i
<
s
.
length
();
i
++)
{
char
c
=
s
.
charAt
(
i
);
switch
(
c
)
{
...
...
@@ -181,7 +181,7 @@ public class StringUtils {
* @return the string
*/
public
static
String
javaDecode
(
String
s
)
throws
SQLException
{
StringBu
ffer
buff
=
new
StringBuff
er
(
s
.
length
());
StringBu
ilder
buff
=
new
StringBuild
er
(
s
.
length
());
for
(
int
i
=
0
;
i
<
s
.
length
();
i
++)
{
char
c
=
s
.
charAt
(
i
);
if
(
c
==
'"'
)
{
...
...
@@ -331,7 +331,7 @@ public class StringUtils {
buff
.
appendExceptFirst
(
", "
);
buff
.
append
(
quoteJavaString
(
a
));
}
return
buff
.
append
(
"}"
).
toString
();
return
buff
.
append
(
'}'
).
toString
();
}
/**
...
...
@@ -350,7 +350,7 @@ public class StringUtils {
buff
.
appendExceptFirst
(
", "
);
buff
.
append
(
a
);
}
return
buff
.
append
(
"}"
).
toString
();
return
buff
.
append
(
'}'
).
toString
();
}
/**
...
...
@@ -400,7 +400,7 @@ public class StringUtils {
*/
//## Java 1.4 end ##
// byte[] utf = utf8Encode(s);
// StringBu
ffer buff = new StringBuff
er(utf.length);
// StringBu
ilder buff = new StringBuild
er(utf.length);
// for(int i=0; i<utf.length; i++) {
//
// buff.append()
...
...
@@ -452,7 +452,7 @@ public class StringUtils {
return
new
String
[
0
];
}
ArrayList
<
String
>
list
=
New
.
arrayList
();
StringBu
ffer
buff
=
new
StringBuff
er
(
s
.
length
());
StringBu
ilder
buff
=
new
StringBuild
er
(
s
.
length
());
for
(
int
i
=
0
;
i
<
s
.
length
();
i
++)
{
char
c
=
s
.
charAt
(
i
);
if
(
c
==
separatorChar
)
{
...
...
@@ -608,7 +608,7 @@ public class StringUtils {
* @return the indented string
*/
private
static
String
indent
(
String
s
,
int
spaces
)
{
StringBu
ffer
buff
=
new
StringBuff
er
(
s
.
length
()
+
spaces
);
StringBu
ilder
buff
=
new
StringBuild
er
(
s
.
length
()
+
spaces
);
for
(
int
i
=
0
;
i
<
s
.
length
();)
{
for
(
int
j
=
0
;
j
<
spaces
;
j
++)
{
buff
.
append
(
' '
);
...
...
@@ -680,7 +680,7 @@ public class StringUtils {
* @return the escaped text
*/
public
static
String
xmlText
(
String
text
)
{
StringBu
ffer
buff
=
new
StringBuff
er
(
text
.
length
());
StringBu
ilder
buff
=
new
StringBuild
er
(
text
.
length
());
for
(
int
i
=
0
;
i
<
text
.
length
();
i
++)
{
char
ch
=
text
.
charAt
(
i
);
switch
(
ch
)
{
...
...
@@ -726,7 +726,7 @@ public class StringUtils {
* @return the string with the before string replaced
*/
public
static
String
replaceAll
(
String
s
,
String
before
,
String
after
)
{
StringBu
ffer
buff
=
new
StringBuff
er
(
s
.
length
());
StringBu
ilder
buff
=
new
StringBuild
er
(
s
.
length
());
int
index
=
0
;
while
(
true
)
{
int
next
=
s
.
indexOf
(
before
,
index
);
...
...
@@ -749,7 +749,7 @@ public class StringUtils {
* @return the double quoted text
*/
public
static
String
quoteIdentifier
(
String
s
)
{
StringBu
ffer
buff
=
new
StringBuff
er
(
s
.
length
()
+
2
);
StringBu
ilder
buff
=
new
StringBuild
er
(
s
.
length
()
+
2
);
buff
.
append
(
'\"'
);
for
(
int
i
=
0
;
i
<
s
.
length
();
i
++)
{
char
c
=
s
.
charAt
(
i
);
...
...
@@ -819,7 +819,7 @@ public class StringUtils {
}
else
{
paddingChar
=
padding
.
charAt
(
0
);
}
StringBu
ffer
buff
=
new
StringBuff
er
(
n
);
StringBu
ilder
buff
=
new
StringBuild
er
(
n
);
n
-=
string
.
length
();
if
(
right
)
{
buff
.
append
(
string
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/Tool.java
浏览文件 @
343e4cb9
...
...
@@ -60,7 +60,7 @@ public abstract class Tool {
* @param db the database name or null
*/
protected
void
printNoDatabaseFilesFound
(
String
dir
,
String
db
)
{
StringBu
ffer
buff
=
new
StringBuff
er
(
"No database files have been found"
);
StringBu
ilder
buff
=
new
StringBuild
er
(
"No database files have been found"
);
if
(
dir
!=
null
)
{
buff
.
append
(
" in directory "
);
buff
.
append
(
dir
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/Transfer.java
浏览文件 @
343e4cb9
...
...
@@ -237,9 +237,9 @@ public class Transfer {
if
(
len
==
-
1
)
{
return
null
;
}
// TODO optimize: StringBu
ff
er is synchronized, maybe use a char array
// TODO optimize: StringBu
ild
er is synchronized, maybe use a char array
// (but that means more memory)
StringBu
ffer
buff
=
new
StringBuff
er
(
len
);
StringBu
ilder
buff
=
new
StringBuild
er
(
len
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
buff
.
append
(
in
.
readChar
());
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/ValueLob.java
浏览文件 @
343e4cb9
...
...
@@ -680,7 +680,7 @@ public class ValueLob extends Value {
if
(
small
!=
null
&&
getPrecision
()
<=
SysProperties
.
MAX_TRACE_DATA_LENGTH
)
{
return
getSQL
();
}
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
if
(
type
==
Value
.
CLOB
)
{
buff
.
append
(
"SPACE("
);
buff
.
append
(
getPrecision
());
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/ValueUuid.java
浏览文件 @
343e4cb9
...
...
@@ -119,7 +119,7 @@ public class ValueUuid extends Value {
return
PRECISION
;
}
private
void
appendHex
(
StringBu
ff
er
buff
,
long
x
,
int
bytes
)
{
private
void
appendHex
(
StringBu
ild
er
buff
,
long
x
,
int
bytes
)
{
for
(
int
i
=
bytes
*
8
-
4
;
i
>=
0
;
i
-=
8
)
{
buff
.
append
(
Integer
.
toHexString
((
int
)
(
x
>>
i
)
&
0xf
));
buff
.
append
(
Integer
.
toHexString
((
int
)
(
x
>>
(
i
-
4
))
&
0xf
));
...
...
@@ -127,7 +127,7 @@ public class ValueUuid extends Value {
}
public
String
getString
()
{
StringBu
ffer
buff
=
new
StringBuff
er
(
36
);
StringBu
ilder
buff
=
new
StringBuild
er
(
36
);
appendHex
(
buff
,
high
>>
32
,
4
);
buff
.
append
(
'-'
);
appendHex
(
buff
,
high
>>
16
,
2
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
343e4cb9
...
...
@@ -295,11 +295,8 @@ java org.h2.test.TestAll timer
recover tool: move
alter table add constraint behind insert into select
i > 0 -> StatementBuidler
StringBuffer > StringBuilder
j > 0 -> StatementBuilder
buff.append... chain
SqlStatement.appendExceptFirst
append(".") > append('.')
BaseIndex or TableData should have its own compareMode
(default is: Database.compareMode when created).
...
...
@@ -669,7 +666,7 @@ kill -9 `jps -l | grep "org.h2.test.TestAll" | cut -d " " -f 1`
}
public
String
toString
()
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
appendIf
(
buff
,
big
,
"big"
);
appendIf
(
buff
,
networked
,
"net"
);
appendIf
(
buff
,
memory
,
"memory"
);
...
...
@@ -693,7 +690,7 @@ kill -9 `jps -l | grep "org.h2.test.TestAll" | cut -d " " -f 1`
return
buff
.
toString
();
}
private
void
appendIf
(
StringBu
ff
er
buff
,
boolean
flag
,
String
text
)
{
private
void
appendIf
(
StringBu
ild
er
buff
,
boolean
flag
,
String
text
)
{
if
(
flag
)
{
buff
.
append
(
text
);
buff
.
append
(
' '
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/TestBase.java
浏览文件 @
343e4cb9
...
...
@@ -945,7 +945,7 @@ public abstract class TestBase {
if
(
reader
==
null
)
{
return
null
;
}
StringBu
ffer
buffer
=
new
StringBuff
er
();
StringBu
ilder
buffer
=
new
StringBuild
er
();
try
{
while
(
true
)
{
int
c
=
reader
.
read
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/bench/BenchCRandom.java
浏览文件 @
343e4cb9
...
...
@@ -70,7 +70,7 @@ public class BenchCRandom {
*/
String
replace
(
String
text
,
String
replacement
)
{
int
pos
=
getInt
(
0
,
text
.
length
()
-
replacement
.
length
());
StringBu
ffer
buffer
=
new
StringBuff
er
(
text
);
StringBu
ilder
buffer
=
new
StringBuild
er
(
text
);
buffer
.
replace
(
pos
,
pos
+
7
,
replacement
);
return
buffer
.
toString
();
}
...
...
@@ -170,7 +170,7 @@ public class BenchCRandom {
String
getLastname
(
int
i
)
{
String
[]
n
=
{
"BAR"
,
"OUGHT"
,
"ABLE"
,
"PRI"
,
"PRES"
,
"ESE"
,
"ANTI"
,
"CALLY"
,
"ATION"
,
"EING"
};
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
buff
.
append
(
n
[
i
/
100
]);
buff
.
append
(
n
[(
i
/
10
)
%
10
]);
buff
.
append
(
n
[
i
%
10
]);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/coverage/Tokenizer.java
浏览文件 @
343e4cb9
...
...
@@ -26,7 +26,7 @@ public class Tokenizer {
private
static
final
byte
ALPHA
=
4
;
private
static
final
byte
QUOTE
=
8
;
private
StringBu
ff
er
buffer
;
private
StringBu
ild
er
buffer
;
private
Reader
reader
;
...
...
@@ -86,7 +86,7 @@ public class Tokenizer {
* Initialize the tokenizer.
*/
void
initToken
()
{
buffer
=
new
StringBu
ff
er
();
buffer
=
new
StringBu
ild
er
();
}
String
getToken
()
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestCases.java
浏览文件 @
343e4cb9
...
...
@@ -629,7 +629,7 @@ public class TestCases extends TestBase {
stat
.
execute
(
"CREATE TABLE TEST(A INT, B INT, C INT, DATA VARCHAR)"
);
int
increment
=
getSize
(
100
,
1
);
for
(
int
i
=
1
;
i
<
500
;
i
+=
increment
)
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
buff
.
append
(
"CREATE TABLE TEST"
);
for
(
int
j
=
0
;
j
<
i
;
j
++)
{
buff
.
append
(
'a'
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestCsv.java
浏览文件 @
343e4cb9
...
...
@@ -157,7 +157,7 @@ public class TestCsv extends TestBase {
return
null
;
}
int
len
=
random
.
nextInt
(
5
);
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
String
chars
=
"\\\'\",\r\n\t ;.-123456|#"
;
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
buff
.
append
(
chars
.
charAt
(
random
.
nextInt
(
chars
.
length
())));
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestFunctions.java
浏览文件 @
343e4cb9
...
...
@@ -572,7 +572,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
* @return the string, reversed
*/
public
static
String
reverse
(
String
s
)
{
return
new
StringBu
ff
er
(
s
).
reverse
().
toString
();
return
new
StringBu
ild
er
(
s
).
reverse
().
toString
();
}
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestIndex.java
浏览文件 @
343e4cb9
...
...
@@ -159,7 +159,7 @@ public class TestIndex extends TestBase {
}
private
String
getRandomString
(
int
len
)
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
buff
.
append
((
char
)
(
'a'
+
random
.
nextInt
(
26
)));
}
...
...
@@ -351,7 +351,7 @@ public class TestIndex extends TestBase {
ResultSet
rs
=
stat
.
executeQuery
(
sql
);
int
cols
=
rs
.
getMetaData
().
getColumnCount
();
while
(
rs
.
next
())
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
for
(
int
i
=
0
;
i
<
cols
;
i
++)
{
if
(
i
>
0
)
{
buff
.
append
(
", "
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestLob.java
浏览文件 @
343e4cb9
...
...
@@ -388,7 +388,7 @@ public class TestLob extends TestBase {
PreparedStatement
prep1
=
conn0
.
prepareStatement
(
"insert into CLOB_ENTITY (DATA, CLOB_DATA, ID) values (?, ?, ?)"
);
prep1
.
setNull
(
1
,
2005
);
StringBu
ffer
buff
=
new
StringBuff
er
(
10000
);
StringBu
ilder
buff
=
new
StringBuild
er
(
10000
);
for
(
int
i
=
0
;
i
<
10000
;
i
++)
{
buff
.
append
((
char
)
(
'0'
+
(
i
%
10
)));
}
...
...
@@ -453,7 +453,7 @@ public class TestLob extends TestBase {
assertFalse
(
rs
.
next
());
stat
.
execute
(
"create table test(text clob)"
);
stat
.
execute
(
"create table test2(text clob)"
);
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
buff
.
append
(
' '
);
}
...
...
@@ -490,7 +490,7 @@ public class TestLob extends TestBase {
if
(
config
.
networked
&&
config
.
big
)
{
len
=
5
;
}
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
buff
.
append
(
StringUtils
.
xmlNode
(
"content"
,
null
,
"This is a test "
+
i
));
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestScript.java
浏览文件 @
343e4cb9
...
...
@@ -41,7 +41,7 @@ public class TestScript extends TestBase {
private
PrintStream
out
;
private
ArrayList
<
String
[]>
result
=
New
.
arrayList
();
private
String
putBack
;
private
StringBu
ff
er
errors
;
private
StringBu
ild
er
errors
;
private
ArrayList
<
String
>
statements
;
private
String
fileName
=
"org/h2/test/test-"
+
Constants
.
VERSION_MAJOR
+
"."
+
Constants
.
VERSION_MINOR
+
".txt"
;
...
...
@@ -90,7 +90,7 @@ public class TestScript extends TestBase {
conn
=
getConnection
(
"script"
);
stat
=
conn
.
createStatement
();
out
=
new
PrintStream
(
new
FileOutputStream
(
outFile
));
errors
=
new
StringBu
ff
er
();
errors
=
new
StringBu
ild
er
();
testFile
(
inFile
);
conn
.
close
();
out
.
close
();
...
...
@@ -121,7 +121,7 @@ public class TestScript extends TestBase {
private
void
testFile
(
String
inFile
)
throws
Exception
{
InputStream
is
=
getClass
().
getClassLoader
().
getResourceAsStream
(
inFile
);
in
=
new
LineNumberReader
(
new
InputStreamReader
(
is
,
"Cp1252"
));
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
while
(
true
)
{
String
sql
=
readLine
();
if
(
sql
==
null
)
{
...
...
@@ -135,7 +135,7 @@ public class TestScript extends TestBase {
write
(
sql
);
buff
.
append
(
sql
.
substring
(
0
,
sql
.
length
()
-
1
));
sql
=
buff
.
toString
();
buff
=
new
StringBu
ff
er
();
buff
=
new
StringBu
ild
er
();
process
(
sql
);
}
else
{
write
(
sql
);
...
...
@@ -209,13 +209,13 @@ public class TestScript extends TestBase {
private
int
processPrepared
(
String
sql
,
PreparedStatement
prep
,
String
param
)
throws
Exception
{
try
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
int
index
=
0
;
for
(
int
i
=
0
;
i
<
param
.
length
();
i
++)
{
char
c
=
param
.
charAt
(
i
);
if
(
c
==
','
)
{
setParameter
(
prep
,
++
index
,
buff
.
toString
());
buff
=
new
StringBu
ff
er
();
buff
=
new
StringBu
ild
er
();
}
else
if
(
c
==
'"'
)
{
while
(
true
)
{
c
=
param
.
charAt
(++
i
);
...
...
@@ -305,7 +305,7 @@ public class TestScript extends TestBase {
private
String
format
(
String
[]
row
,
int
[]
max
)
{
int
length
=
max
.
length
;
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
if
(
i
>
0
)
{
buff
.
append
(
' '
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbc/TestNativeSQL.java
浏览文件 @
343e4cb9
...
...
@@ -81,8 +81,8 @@ public class TestNativeSQL extends TestBase {
Random
random
=
new
Random
(
1
);
String
s
=
"'\"$/-* \n"
;
for
(
int
i
=
0
;
i
<
200
;
i
++)
{
StringBu
ffer
buffQuoted
=
new
StringBuff
er
();
StringBu
ffer
buffRaw
=
new
StringBuff
er
();
StringBu
ilder
buffQuoted
=
new
StringBuild
er
();
StringBu
ilder
buffRaw
=
new
StringBuild
er
();
if
(
random
.
nextBoolean
())
{
buffQuoted
.
append
(
"'"
);
for
(
int
j
=
0
;
j
<
10
;
j
++)
{
...
...
@@ -118,7 +118,7 @@ public class TestNativeSQL extends TestBase {
private
void
testRandom
()
throws
SQLException
{
Random
random
=
new
Random
(
1
);
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
StringBu
ffer
buff
=
new
StringBuff
er
(
"{oj }"
);
StringBu
ilder
buff
=
new
StringBuild
er
(
"{oj }"
);
String
s
=
"{}\'\"-/*$ $-"
;
for
(
int
j
=
random
.
nextInt
(
30
);
j
>
0
;
j
--)
{
buff
.
append
(
s
.
charAt
(
random
.
nextInt
(
s
.
length
())));
...
...
@@ -132,7 +132,7 @@ public class TestNativeSQL extends TestBase {
}
String
smallest
=
null
;
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
StringBu
ffer
buff
=
new
StringBuff
er
(
"{oj }"
);
StringBu
ilder
buff
=
new
StringBuild
er
(
"{oj }"
);
for
(
int
j
=
random
.
nextInt
(
10
);
j
>
0
;
j
--)
{
String
s
;
switch
(
random
.
nextInt
(
7
))
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
浏览文件 @
343e4cb9
...
...
@@ -871,7 +871,7 @@ public class TestPreparedStatement extends TestBase {
PreparedStatement
prep
;
ResultSet
rs
;
stat
.
execute
(
"CREATE TABLE T_CLOB(ID INT PRIMARY KEY,V1 CLOB,V2 CLOB)"
);
StringBu
ffer
asciiBuffer
=
new
StringBuff
er
();
StringBu
ilder
asciiBuffer
=
new
StringBuild
er
();
int
len
=
getLength
();
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
asciiBuffer
.
append
((
char
)
(
'a'
+
(
i
%
20
)));
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbcx/TestXid.java
浏览文件 @
343e4cb9
...
...
@@ -54,10 +54,10 @@ public class TestXid implements Xid {
fGlobalTransactionId
=
new
byte
[
MAXGTRIDSIZE
];
fBranchQualifier
=
new
byte
[
MAXBQUALSIZE
];
StringBu
ff
er
sb
;
StringBu
ild
er
sb
;
byte
[]
ba
;
sb
=
new
StringBu
ff
er
();
sb
=
new
StringBu
ild
er
();
sb
.
append
(
host
);
sb
.
append
(
":"
);
sb
.
append
(
fId
);
...
...
@@ -73,7 +73,7 @@ public class TestXid implements Xid {
fGlobalTransactionId
[
i
]
=
ba
[
i
];
}
sb
=
new
StringBu
ff
er
(
NF
.
format
(
branch
));
sb
=
new
StringBu
ild
er
(
NF
.
format
(
branch
));
// System.out.println("branch qualifier: " + sb.toString());
ba
=
sb
.
toString
().
getBytes
();
for
(
int
i
=
0
;
i
<
MAXBQUALSIZE
;
i
++)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/OutputCatcher.java
浏览文件 @
343e4cb9
...
...
@@ -50,7 +50,7 @@ class OutputCatcher extends Thread {
}
public
void
run
()
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
while
(
true
)
{
try
{
int
x
=
in
.
read
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestBtreeIndex.java
浏览文件 @
343e4cb9
...
...
@@ -62,7 +62,7 @@ public class TestBtreeIndex extends TestBase {
prefixLength
=
random
.
nextInt
(
10
)
+
1
;
}
boolean
delete
=
random
.
nextBoolean
();
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
for
(
int
j
=
0
;
j
<
prefixLength
;
j
++)
{
buff
.
append
(
"x"
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestHalt.java
浏览文件 @
343e4cb9
...
...
@@ -339,7 +339,7 @@ public abstract class TestHalt extends TestBase {
* @return the random string
*/
protected
String
getRandomString
(
int
len
)
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
buff
.
append
(
'a'
+
random
.
nextInt
(
20
));
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestJoin.java
浏览文件 @
343e4cb9
...
...
@@ -30,7 +30,7 @@ public class TestJoin extends TestBase {
private
ArrayList
<
Connection
>
connections
=
New
.
arrayList
();
private
Random
random
;
private
int
paramCount
;
private
StringBu
ff
er
buff
;
private
StringBu
ild
er
buff
;
/**
* Run just this test.
...
...
@@ -103,7 +103,7 @@ public class TestJoin extends TestBase {
long
start
=
System
.
currentTimeMillis
();
for
(
int
i
=
0
;;
i
++)
{
paramCount
=
0
;
buff
=
new
StringBu
ff
er
();
buff
=
new
StringBu
ild
er
();
long
time
=
System
.
currentTimeMillis
();
if
(
time
-
start
>
5000
)
{
printTime
(
"i:"
+
i
);
...
...
@@ -279,7 +279,7 @@ public class TestJoin extends TestBase {
}
private
String
readResult
(
ResultSet
rs
)
throws
SQLException
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
ResultSetMetaData
meta
=
rs
.
getMetaData
();
int
columnCount
=
meta
.
getColumnCount
();
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
...
...
@@ -292,7 +292,7 @@ public class TestJoin extends TestBase {
String
result
=
buff
.
toString
();
ArrayList
<
String
>
list
=
New
.
arrayList
();
while
(
rs
.
next
())
{
buff
=
new
StringBu
ff
er
();
buff
=
new
StringBu
ild
er
();
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
if
(
i
>
0
)
{
buff
.
append
(
","
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestSimpleIndex.java
浏览文件 @
343e4cb9
...
...
@@ -47,7 +47,7 @@ public class TestSimpleIndex extends TestBase {
random
.
setSeed
(
seed
);
String
unique
=
random
.
nextBoolean
()
?
"UNIQUE "
:
""
;
int
len
=
random
.
getInt
(
2
)
+
1
;
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
if
(
i
>
0
)
{
buff
.
append
(
", "
);
...
...
@@ -100,7 +100,7 @@ public class TestSimpleIndex extends TestBase {
execute
(
"INSERT INTO TEST_M "
+
sql
);
execute
(
"INSERT INTO TEST_D "
+
sql
);
}
StringBu
ffer
buff
=
new
StringBuff
er
(
"WHERE 1=1"
);
StringBu
ilder
buff
=
new
StringBuild
er
(
"WHERE 1=1"
);
int
len
=
random
.
getLog
(
10
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
buff
.
append
(
" AND "
);
...
...
@@ -149,7 +149,7 @@ public class TestSimpleIndex extends TestBase {
private
String
getResult
(
String
sql
)
throws
SQLException
{
ResultSet
rs
=
stat
.
executeQuery
(
sql
);
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
while
(
rs
.
next
())
{
buff
.
append
(
rs
.
getString
(
1
));
buff
.
append
(
"; "
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/sql/RandomGen.java
浏览文件 @
343e4cb9
...
...
@@ -87,7 +87,7 @@ public class RandomGen {
* @return the string
*/
public
String
randomString
(
int
len
)
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
String
from
=
(
i
%
2
==
0
)
?
"bdfghklmnpqrst"
:
"aeiou"
;
buff
.
append
(
from
.
charAt
(
getInt
(
from
.
length
())));
...
...
@@ -227,7 +227,7 @@ public class RandomGen {
if
(
random
.
nextInt
(
10
)
==
0
)
{
return
null
;
}
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
buff
.
append
(
getInt
(
24
));
buff
.
append
(
':'
);
buff
.
append
(
getInt
(
24
));
...
...
@@ -246,7 +246,7 @@ public class RandomGen {
if
(
random
.
nextInt
(
10
)
==
0
)
{
return
null
;
}
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
buff
.
append
(
getInt
(
10
)
+
2000
);
buff
.
append
(
'-'
);
int
month
=
getInt
(
12
)
+
1
;
...
...
@@ -291,7 +291,7 @@ public class RandomGen {
if
(
random
.
nextInt
(
10
)
==
0
)
{
return
null
;
}
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
buff
.
append
(
getInt
(
10
)
+
2000
);
buff
.
append
(
'-'
);
buff
.
append
(
getInt
(
11
)
+
1
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/sql/Value.java
浏览文件 @
343e4cb9
...
...
@@ -120,8 +120,8 @@ public class Value {
private
String
getBlobSQL
()
{
byte
[]
bytes
=
(
byte
[])
data
;
// StringBu
ffer buff = new StringBuff
er("X'");
StringBu
ffer
buff
=
new
StringBuff
er
(
"'"
);
// StringBu
ilder buff = new StringBuild
er("X'");
StringBu
ilder
buff
=
new
StringBuild
er
(
"'"
);
for
(
byte
b
:
bytes
)
{
int
c
=
b
&
0xff
;
buff
.
append
(
Integer
.
toHexString
(
c
>>
4
&
0xf
));
...
...
@@ -275,7 +275,7 @@ public class Value {
if
(
len
==
0
)
{
len
++;
}
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
buff
.
append
((
char
)
(
'0'
+
config
.
random
().
getInt
(
10
)));
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/thread/TestMultiNews.java
浏览文件 @
343e4cb9
...
...
@@ -95,7 +95,7 @@ public class TestMultiNews extends TestMultiThread {
PreparedStatement
prep2
=
conn
.
prepareStatement
(
"INSERT INTO TEST (NAME) VALUES (?)"
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
int
x
=
random
.
nextInt
(
10
)
*
128
;
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
while
(
buff
.
length
()
<
x
)
{
buff
.
append
(
"Test "
);
buff
.
append
(
buff
.
length
());
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/thread/TestMultiOrder.java
浏览文件 @
343e4cb9
...
...
@@ -87,7 +87,7 @@ public class TestMultiOrder extends TestMultiThread {
}
private
String
getString
(
int
id
)
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
Random
rnd
=
new
Random
(
id
);
int
len
=
rnd
.
nextInt
(
40
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/trace/Statement.java
浏览文件 @
343e4cb9
...
...
@@ -96,7 +96,7 @@ class Statement {
}
public
String
toString
()
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
if
(
assignment
)
{
buff
.
append
(
assignClass
);
buff
.
append
(
' '
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestPattern.java
浏览文件 @
343e4cb9
...
...
@@ -51,7 +51,7 @@ public class TestPattern extends TestBase {
}
private
static
String
getRandomValue
()
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
int
len
=
(
int
)
(
Math
.
random
()
*
10
);
String
s
=
"AB_%\\"
;
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
...
...
@@ -61,7 +61,7 @@ public class TestPattern extends TestBase {
}
private
static
String
getRandomPattern
()
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
int
len
=
(
int
)
(
Math
.
random
()
*
4
);
String
s
=
"A%_\\"
;
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
...
...
@@ -78,7 +78,7 @@ public class TestPattern extends TestBase {
private
String
initPatternRegexp
(
String
pattern
,
char
escape
)
{
int
len
=
pattern
.
length
();
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
char
c
=
pattern
.
charAt
(
i
);
if
(
escape
==
c
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestScriptReader.java
浏览文件 @
343e4cb9
...
...
@@ -38,7 +38,7 @@ public class TestScriptReader extends TestBase {
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
int
l
=
random
.
nextInt
(
10
);
String
[]
sql
=
new
String
[
l
];
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
for
(
int
j
=
0
;
j
<
l
;
j
++)
{
sql
[
j
]
=
randomStatement
(
random
);
buff
.
append
(
sql
[
j
]);
...
...
@@ -62,7 +62,7 @@ public class TestScriptReader extends TestBase {
}
private
String
randomStatement
(
Random
random
)
{
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
int
len
=
random
.
nextInt
(
5
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
switch
(
random
.
nextInt
(
10
))
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestSecurity.java
浏览文件 @
343e4cb9
...
...
@@ -64,7 +64,7 @@ public class TestSecurity extends TestBase {
checkSHA256
(
"abcdefghijklmnopqrstuvwxyz"
,
"71C480DF93D6AE2F1EFAD1447C66C9525E316218CF51FC8D9ED832F2DAF18B73"
);
checkSHA256
(
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
,
"248D6A61D20638B8E5C026930C3E6039A33CE45964FF2167F6ECEDD419DB06C1"
);
checkSHA256
(
"12345678901234567890123456789012345678901234567890123456789012345678901234567890"
,
"F371BC4A311F2B009EEF952DD83CA80E2B60026C8E935592D0F9C308453C813E"
);
StringBu
ffer
buff
=
new
StringBuff
er
(
1000000
);
StringBu
ilder
buff
=
new
StringBuild
er
(
1000000
);
buff
.
append
(
'a'
);
checkSHA256
(
buff
.
toString
(),
"CA978112CA1BBDCAFAC231B39A23DC4DA786EFF8147C4E72B9807785AFEE48BB"
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestStringCache.java
浏览文件 @
343e4cb9
...
...
@@ -67,7 +67,7 @@ public class TestStringCache extends TestBase {
return
s
;
}
int
len
=
random
.
nextBoolean
()
?
random
.
nextInt
(
1000
)
:
random
.
nextInt
(
10
);
StringBu
ffer
buff
=
new
StringBuff
er
(
len
);
StringBu
ilder
buff
=
new
StringBuild
er
(
len
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
buff
.
append
(
random
.
nextInt
(
0xfff
));
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestStringUtils.java
浏览文件 @
343e4cb9
...
...
@@ -107,7 +107,7 @@ public class TestStringUtils extends TestBase {
Random
random
=
new
Random
(
1
);
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
int
len
=
random
.
nextInt
(
10
);
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
for
(
int
j
=
0
;
j
<
len
;
j
++)
{
if
(
random
.
nextBoolean
())
{
buff
.
append
((
char
)
random
.
nextInt
(
0x3000
));
...
...
@@ -128,7 +128,7 @@ public class TestStringUtils extends TestBase {
Random
random
=
new
Random
(
1
);
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
int
len
=
random
.
nextInt
(
10
);
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
for
(
int
j
=
0
;
j
<
len
;
j
++)
{
if
(
random
.
nextBoolean
())
{
buff
.
append
((
char
)
random
.
nextInt
(
0x3000
));
...
...
@@ -149,7 +149,7 @@ public class TestStringUtils extends TestBase {
Random
random
=
new
Random
(
1
);
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
int
len
=
random
.
nextInt
(
10
);
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
String
select
=
"abcd,"
;
for
(
int
j
=
0
;
j
<
len
;
j
++)
{
char
c
=
select
.
charAt
(
random
.
nextInt
(
select
.
length
()));
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/build/BuildBase.java
浏览文件 @
343e4cb9
...
...
@@ -441,7 +441,7 @@ public class BuildBase {
}
private
String
convertBytesToString
(
byte
[]
value
)
{
StringBu
ffer
buff
=
new
StringBuff
er
(
value
.
length
*
2
);
StringBu
ilder
buff
=
new
StringBuild
er
(
value
.
length
*
2
);
for
(
byte
c
:
value
)
{
int
x
=
c
&
0xff
;
buff
.
append
(
Integer
.
toString
(
x
>>
4
,
16
));
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/build/doc/MergeDocs.java
浏览文件 @
343e4cb9
...
...
@@ -37,7 +37,7 @@ public class MergeDocs {
String
[]
pages
=
{
"quickstart.html"
,
"installation.html"
,
"tutorial.html"
,
"features.html"
,
"performance.html"
,
"advanced.html"
,
"grammar.html"
,
"functions.html"
,
"datatypes.html"
,
"build.html"
,
"history.html"
,
"faq.html"
};
StringBu
ffer
buff
=
new
StringBuff
er
();
StringBu
ilder
buff
=
new
StringBuild
er
();
for
(
String
fileName
:
pages
)
{
String
text
=
getContent
(
fileName
);
for
(
String
page
:
pages
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/build/doc/SpellChecker.java
浏览文件 @
343e4cb9
差异被折叠。
点击展开。
h2/src/tools/org/h2/build/doclet/Doclet.java
浏览文件 @
343e4cb9
差异被折叠。
点击展开。
h2/src/tools/org/h2/build/doclet/ResourceDoclet.java
浏览文件 @
343e4cb9
差异被折叠。
点击展开。
h2/src/tools/org/h2/build/i18n/PrepareTranslation.java
浏览文件 @
343e4cb9
差异被折叠。
点击展开。
h2/src/tools/org/h2/build/i18n/PropertiesToUTF8.java
浏览文件 @
343e4cb9
差异被折叠。
点击展开。
h2/src/tools/org/h2/build/indexer/HtmlConverter.java
浏览文件 @
343e4cb9
差异被折叠。
点击展开。
h2/src/tools/org/h2/build/indexer/Indexer.java
浏览文件 @
343e4cb9
差异被折叠。
点击展开。
h2/src/tools/org/h2/dev/ftp/FtpClient.java
浏览文件 @
343e4cb9
差异被折叠。
点击展开。
h2/src/tools/org/h2/dev/ftp/server/FtpServer.java
浏览文件 @
343e4cb9
差异被折叠。
点击展开。
h2/src/tools/org/h2/dev/net/PgTcpRedirect.java
浏览文件 @
343e4cb9
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论