Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
e662eb1d
提交
e662eb1d
authored
5月 27, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use StringBuilder instead of StringBuffer
上级
53a3af71
隐藏空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
120 行增加
和
143 行删除
+120
-143
Bnf.java
h2/src/main/org/h2/bnf/Bnf.java
+2
-3
AlterTableAlterColumn.java
h2/src/main/org/h2/command/ddl/AlterTableAlterColumn.java
+1
-2
ScriptCommand.java
h2/src/main/org/h2/command/dml/ScriptCommand.java
+3
-4
ConstraintReferential.java
h2/src/main/org/h2/constraint/ConstraintReferential.java
+4
-4
UpdatableRow.java
h2/src/main/org/h2/result/UpdatableRow.java
+2
-2
WebThread.java
h2/src/main/org/h2/server/web/WebThread.java
+69
-78
TableData.java
h2/src/main/org/h2/table/TableData.java
+1
-2
MultiDimension.java
h2/src/main/org/h2/tools/MultiDimension.java
+5
-7
Recover.java
h2/src/main/org/h2/tools/Recover.java
+12
-12
Server.java
h2/src/main/org/h2/tools/Server.java
+8
-4
Shell.java
h2/src/main/org/h2/tools/Shell.java
+2
-4
ScriptReader.java
h2/src/main/org/h2/util/ScriptReader.java
+3
-6
StringUtils.java
h2/src/main/org/h2/util/StringUtils.java
+4
-5
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+2
-8
BuildBase.java
h2/src/tools/org/h2/build/BuildBase.java
+2
-2
没有找到文件。
h2/src/main/org/h2/bnf/Bnf.java
浏览文件 @
e662eb1d
...
...
@@ -168,9 +168,8 @@ public class Bnf {
page
=
"functions.html"
;
}
String
link
=
StringUtils
.
urlEncode
(
found
.
getTopic
().
toLowerCase
());
buff
.
append
(
"<a href=\""
+
page
+
"#"
+
link
+
"\">"
);
buff
.
append
(
s
);
buff
.
append
(
"</a>"
);
buff
.
append
(
"<a href=\""
).
append
(
page
).
append
(
"#"
).
append
(
link
).
append
(
"\">"
).
append
(
s
).
append
(
"</a>"
);
}
return
buff
.
toString
();
}
...
...
h2/src/main/org/h2/command/ddl/AlterTableAlterColumn.java
浏览文件 @
e662eb1d
...
...
@@ -260,8 +260,7 @@ public class AlterTableAlterColumn extends SchemaCommand {
}
else
{
buff
.
append
(
columnList
);
}
buff
.
append
(
" FROM "
);
buff
.
append
(
table
.
getSQL
());
buff
.
append
(
" FROM "
).
append
(
table
.
getSQL
());
String
newTableSQL
=
buff
.
toString
();
execute
(
newTableSQL
,
true
);
newTable
=
(
TableData
)
newTable
.
getSchema
().
getTableOrView
(
session
,
newTable
.
getName
());
...
...
h2/src/main/org/h2/command/dml/ScriptCommand.java
浏览文件 @
e662eb1d
...
...
@@ -336,8 +336,7 @@ public class ScriptCommand extends ScriptBase {
if
(
len
<=
0
)
{
break
;
}
buff
.
append
(
ByteUtils
.
convertBytesToString
(
bytes
,
len
));
buff
.
append
(
"')"
);
buff
.
append
(
ByteUtils
.
convertBytesToString
(
bytes
,
len
)).
append
(
"')"
);
String
sql
=
buff
.
toString
();
add
(
sql
,
true
);
}
...
...
@@ -357,8 +356,8 @@ public class ScriptCommand extends ScriptBase {
if
(
len
<
0
)
{
break
;
}
buff
.
append
(
StringUtils
.
quoteStringSQL
(
new
String
(
chars
,
0
,
len
)))
;
buff
.
append
(
", NULL)"
);
buff
.
append
(
StringUtils
.
quoteStringSQL
(
new
String
(
chars
,
0
,
len
)))
.
append
(
", NULL)"
);
String
sql
=
buff
.
toString
();
add
(
sql
,
true
);
}
...
...
h2/src/main/org/h2/constraint/ConstraintReferential.java
浏览文件 @
e662eb1d
...
...
@@ -616,14 +616,14 @@ public class ConstraintReferential extends Constraint {
buff
.
appendExceptFirst
(
", "
);
buff
.
append
(
c
.
getSQL
());
}
buff
.
append
(
") C WHERE NOT EXISTS(SELECT 1 FROM "
)
;
buff
.
append
(
refTable
.
getSQL
()).
append
(
" P WHERE "
);
buff
.
append
(
") C WHERE NOT EXISTS(SELECT 1 FROM "
)
.
append
(
refTable
.
getSQL
()).
append
(
" P WHERE "
);
buff
.
resetCount
();
int
i
=
0
;
for
(
IndexColumn
c
:
columns
)
{
buff
.
appendExceptFirst
(
" AND "
);
buff
.
append
(
"C."
).
append
(
c
.
getSQL
()).
append
(
'='
)
;
buff
.
append
(
"P."
).
append
(
refColumns
[
i
++].
getSQL
());
buff
.
append
(
"C."
).
append
(
c
.
getSQL
()).
append
(
'='
)
.
append
(
"P."
).
append
(
refColumns
[
i
++].
getSQL
());
}
buff
.
append
(
')'
);
String
sql
=
buff
.
toString
();
...
...
h2/src/main/org/h2/result/UpdatableRow.java
浏览文件 @
e662eb1d
...
...
@@ -151,8 +151,8 @@ public class UpdatableRow {
// public boolean isRowDeleted(Value[] row) throws SQLException {
// StringBuilder buff = new StringBuilder();
// buff.append("SELECT COUNT(*) FROM ")
;
//
buff.
append(StringUtils.quoteIdentifier(tableName));
// buff.append("SELECT COUNT(*) FROM ")
.
//
append(StringUtils.quoteIdentifier(tableName));
// appendKeyCondition(buff);
// PreparedStatement prep = conn.prepareStatement(buff.toString());
// setKey(prep, 1, row);
...
...
h2/src/main/org/h2/server/web/WebThread.java
浏览文件 @
e662eb1d
...
...
@@ -304,15 +304,15 @@ class WebThread extends Thread implements DatabaseEventListener {
private
String
getComboBox
(
String
[][]
elements
,
String
selected
)
{
StringBuilder
buff
=
new
StringBuilder
();
for
(
String
[]
n
:
elements
)
{
buff
.
append
(
"<option value=\""
)
;
buff
.
append
(
PageParser
.
escapeHtmlData
(
n
[
0
]));
buff
.
append
(
"\""
);
buff
.
append
(
"<option value=\""
)
.
append
(
PageParser
.
escapeHtmlData
(
n
[
0
])).
append
(
"\""
);
if
(
n
[
0
].
equals
(
selected
))
{
buff
.
append
(
" selected"
);
}
buff
.
append
(
'>'
)
;
buff
.
append
(
PageParser
.
escapeHtml
(
n
[
1
]));
buff
.
append
(
"</option>"
);
buff
.
append
(
'>'
)
.
append
(
PageParser
.
escapeHtml
(
n
[
1
])).
append
(
"</option>"
);
}
return
buff
.
toString
();
}
...
...
@@ -1730,8 +1730,8 @@ class WebThread extends Thread implements DatabaseEventListener {
buff
.
append
(
getResultSet
(
sql
,
rs
,
metadata
,
list
,
edit
,
time
,
allowEdit
));
// SQLWarning warning = stat.getWarnings();
// if(warning != null) {
// buff.append("<br />Warning:<br />")
;
//
buff.
append(getStackTrace(id, warning));
// buff.append("<br />Warning:<br />")
.
// append(getStackTrace(id, warning));
// }
if
(!
edit
)
{
stat
.
close
();
...
...
@@ -1897,35 +1897,35 @@ class WebThread extends Thread implements DatabaseEventListener {
int
columns
=
meta
.
getColumnCount
();
int
rows
=
0
;
if
(
metadata
)
{
buff
.
append
(
"<tr><th>i</th><th>label</th><th>cat</th><th>schem</th>"
);
buff
.
append
(
"<th>tab</th><th>col</th><th>type</th><th>typeName</th><th>class</th>"
);
buff
.
append
(
"<th>prec</th><th>scale</th><th>size</th><th>autoInc</th>"
);
buff
.
append
(
"<th>case</th><th>currency</th><th>null</th><th>ro</th>"
);
buff
.
append
(
"<th>search</th><th>sig</th><th>w</th><th>defW</th></tr>"
);
buff
.
append
(
"<tr><th>i</th><th>label</th><th>cat</th><th>schem</th>"
+
"<th>tab</th><th>col</th><th>type</th><th>typeName</th><th>class</th>"
+
"<th>prec</th><th>scale</th><th>size</th><th>autoInc</th>"
+
"<th>case</th><th>currency</th><th>null</th><th>ro</th>"
+
"<th>search</th><th>sig</th><th>w</th><th>defW</th></tr>"
);
for
(
int
i
=
1
;
i
<=
columns
;
i
++)
{
buff
.
append
(
"<tr>"
)
;
buff
.
append
(
"<td>"
).
append
(
i
).
append
(
"</td>"
);
buff
.
append
(
"<td>"
).
append
(
PageParser
.
escapeHtml
(
meta
.
getColumnLabel
(
i
))).
append
(
"</td>"
);
buff
.
append
(
"<td>"
).
append
(
PageParser
.
escapeHtml
(
meta
.
getCatalogName
(
i
))).
append
(
"</td>"
);
buff
.
append
(
"<td>"
).
append
(
PageParser
.
escapeHtml
(
meta
.
getSchemaName
(
i
))).
append
(
"</td>"
);
buff
.
append
(
"<td>"
).
append
(
PageParser
.
escapeHtml
(
meta
.
getTableName
(
i
))).
append
(
"</td>"
);
buff
.
append
(
"<td>"
).
append
(
PageParser
.
escapeHtml
(
meta
.
getColumnName
(
i
))).
append
(
"</td>"
);
buff
.
append
(
"<td>"
).
append
(
meta
.
getColumnType
(
i
)).
append
(
"</td>"
);
buff
.
append
(
"<td>"
).
append
(
PageParser
.
escapeHtml
(
meta
.
getColumnTypeName
(
i
))).
append
(
"</td>"
);
buff
.
append
(
"<td>"
).
append
(
PageParser
.
escapeHtml
(
meta
.
getColumnClassName
(
i
))).
append
(
"</td>"
);
buff
.
append
(
"<td>"
).
append
(
meta
.
getPrecision
(
i
)).
append
(
"</td>"
);
buff
.
append
(
"<td>"
).
append
(
meta
.
getScale
(
i
)).
append
(
"</td>"
);
buff
.
append
(
"<td>"
).
append
(
meta
.
getColumnDisplaySize
(
i
)).
append
(
"</td>"
);
buff
.
append
(
"<td>"
).
append
(
meta
.
isAutoIncrement
(
i
)).
append
(
"</td>"
);
buff
.
append
(
"<td>"
).
append
(
meta
.
isCaseSensitive
(
i
)).
append
(
"</td>"
);
buff
.
append
(
"<td>"
).
append
(
meta
.
isCurrency
(
i
)).
append
(
"</td>"
);
buff
.
append
(
"<td>"
).
append
(
meta
.
isNullable
(
i
)).
append
(
"</td>"
);
buff
.
append
(
"<td>"
).
append
(
meta
.
isReadOnly
(
i
)).
append
(
"</td>"
);
buff
.
append
(
"<td>"
).
append
(
meta
.
isSearchable
(
i
)).
append
(
"</td>"
);
buff
.
append
(
"<td>"
).
append
(
meta
.
isSigned
(
i
)).
append
(
"</td>"
);
buff
.
append
(
"<td>"
).
append
(
meta
.
isWritable
(
i
)).
append
(
"</td>"
);
buff
.
append
(
"<td>"
).
append
(
meta
.
isDefinitelyWritable
(
i
)).
append
(
"</td>"
);
buff
.
append
(
"</tr>"
);
buff
.
append
(
"<tr>"
)
.
append
(
"<td>"
).
append
(
i
).
append
(
"</td>"
).
append
(
"<td>"
).
append
(
PageParser
.
escapeHtml
(
meta
.
getColumnLabel
(
i
))).
append
(
"</td>"
).
append
(
"<td>"
).
append
(
PageParser
.
escapeHtml
(
meta
.
getCatalogName
(
i
))).
append
(
"</td>"
).
append
(
"<td>"
).
append
(
PageParser
.
escapeHtml
(
meta
.
getSchemaName
(
i
))).
append
(
"</td>"
).
append
(
"<td>"
).
append
(
PageParser
.
escapeHtml
(
meta
.
getTableName
(
i
))).
append
(
"</td>"
).
append
(
"<td>"
).
append
(
PageParser
.
escapeHtml
(
meta
.
getColumnName
(
i
))).
append
(
"</td>"
).
append
(
"<td>"
).
append
(
meta
.
getColumnType
(
i
)).
append
(
"</td>"
).
append
(
"<td>"
).
append
(
PageParser
.
escapeHtml
(
meta
.
getColumnTypeName
(
i
))).
append
(
"</td>"
).
append
(
"<td>"
).
append
(
PageParser
.
escapeHtml
(
meta
.
getColumnClassName
(
i
))).
append
(
"</td>"
).
append
(
"<td>"
).
append
(
meta
.
getPrecision
(
i
)).
append
(
"</td>"
).
append
(
"<td>"
).
append
(
meta
.
getScale
(
i
)).
append
(
"</td>"
).
append
(
"<td>"
).
append
(
meta
.
getColumnDisplaySize
(
i
)).
append
(
"</td>"
).
append
(
"<td>"
).
append
(
meta
.
isAutoIncrement
(
i
)).
append
(
"</td>"
).
append
(
"<td>"
).
append
(
meta
.
isCaseSensitive
(
i
)).
append
(
"</td>"
).
append
(
"<td>"
).
append
(
meta
.
isCurrency
(
i
)).
append
(
"</td>"
).
append
(
"<td>"
).
append
(
meta
.
isNullable
(
i
)).
append
(
"</td>"
).
append
(
"<td>"
).
append
(
meta
.
isReadOnly
(
i
)).
append
(
"</td>"
).
append
(
"<td>"
).
append
(
meta
.
isSearchable
(
i
)).
append
(
"</td>"
).
append
(
"<td>"
).
append
(
meta
.
isSigned
(
i
)).
append
(
"</td>"
).
append
(
"<td>"
).
append
(
meta
.
isWritable
(
i
)).
append
(
"</td>"
).
append
(
"<td>"
).
append
(
meta
.
isDefinitelyWritable
(
i
)).
append
(
"</td>"
).
append
(
"</tr>"
);
}
}
else
if
(
list
)
{
buff
.
append
(
"<tr><th>Column</th><th>Data</th></tr><tr>"
);
...
...
@@ -1934,16 +1934,14 @@ class WebThread extends Thread implements DatabaseEventListener {
break
;
}
rows
++;
buff
.
append
(
"<tr><td>Row #</td><td>"
);
buff
.
append
(
rows
);
buff
.
append
(
"</tr>"
);
buff
.
append
(
"<tr><td>Row #</td><td>"
).
append
(
rows
).
append
(
"</tr>"
);
for
(
int
i
=
0
;
i
<
columns
;
i
++)
{
buff
.
append
(
"<tr><td>"
);
buff
.
append
(
PageParser
.
escapeHtml
(
meta
.
getColumnLabel
(
i
+
1
)));
buff
.
append
(
"</td>"
);
buff
.
append
(
"<td>"
);
buff
.
append
(
escapeData
(
rs
,
i
+
1
));
buff
.
append
(
"</td></tr>"
);
buff
.
append
(
"<tr><td>"
).
append
(
PageParser
.
escapeHtml
(
meta
.
getColumnLabel
(
i
+
1
))).
append
(
"</td><td>"
).
append
(
escapeData
(
rs
,
i
+
1
)).
append
(
"</td></tr>"
);
}
}
}
else
{
...
...
@@ -1952,9 +1950,9 @@ class WebThread extends Thread implements DatabaseEventListener {
buff
.
append
(
"<th>Action</th>"
);
}
for
(
int
i
=
0
;
i
<
columns
;
i
++)
{
buff
.
append
(
"<th>"
)
;
buff
.
append
(
PageParser
.
escapeHtml
(
meta
.
getColumnLabel
(
i
+
1
)));
buff
.
append
(
"</th>"
);
buff
.
append
(
"<th>"
)
.
append
(
PageParser
.
escapeHtml
(
meta
.
getColumnLabel
(
i
+
1
))).
append
(
"</th>"
);
}
buff
.
append
(
"</tr>"
);
while
(
rs
.
next
())
{
...
...
@@ -1964,22 +1962,20 @@ class WebThread extends Thread implements DatabaseEventListener {
rows
++;
buff
.
append
(
"<tr>"
);
if
(
edit
)
{
buff
.
append
(
"<td>"
);
buff
.
append
(
"<img onclick=\"javascript:editRow("
);
buff
.
append
(
rs
.
getRow
());
buff
.
append
(
",'${sessionId}', '${text.resultEdit.save}', '${text.resultEdit.cancel}'"
);
buff
.
append
(
")\" width=16 height=16 src=\"ico_write.gif\" onmouseover = \"this.className ='icon_hover'\" onmouseout = \"this.className ='icon'\" class=\"icon\" alt=\"${text.resultEdit.edit}\" title=\"${text.resultEdit.edit}\" border=\"1\"/>"
);
buff
.
append
(
"<a href=\"editResult.do?op=2&row="
);
buff
.
append
(
rs
.
getRow
());
buff
.
append
(
"&jsessionid=${sessionId}\" target=\"h2result\" ><img width=16 height=16 src=\"ico_remove.gif\" onmouseover = \"this.className ='icon_hover'\" onmouseout = \"this.className ='icon'\" class=\"icon\" alt=\"${text.resultEdit.delete}\" title=\"${text.resultEdit.delete}\" border=\"1\" /></a>"
);
buff
.
append
(
"</td>"
);
buff
.
append
(
"<td>"
).
append
(
"<img onclick=\"javascript:editRow("
).
append
(
rs
.
getRow
()).
append
(
",'${sessionId}', '${text.resultEdit.save}', '${text.resultEdit.cancel}'"
).
append
(
")\" width=16 height=16 src=\"ico_write.gif\" onmouseover = \"this.className ='icon_hover'\" onmouseout = \"this.className ='icon'\" class=\"icon\" alt=\"${text.resultEdit.edit}\" title=\"${text.resultEdit.edit}\" border=\"1\"/>"
).
append
(
"<a href=\"editResult.do?op=2&row="
).
append
(
rs
.
getRow
()).
append
(
"&jsessionid=${sessionId}\" target=\"h2result\" ><img width=16 height=16 src=\"ico_remove.gif\" onmouseover = \"this.className ='icon_hover'\" onmouseout = \"this.className ='icon'\" class=\"icon\" alt=\"${text.resultEdit.delete}\" title=\"${text.resultEdit.delete}\" border=\"1\" /></a>"
).
append
(
"</td>"
);
}
for
(
int
i
=
0
;
i
<
columns
;
i
++)
{
buff
.
append
(
"<td>"
)
;
buff
.
append
(
escapeData
(
rs
,
i
+
1
));
buff
.
append
(
"</td>"
);
buff
.
append
(
"<td>"
)
.
append
(
escapeData
(
rs
,
i
+
1
)).
append
(
"</td>"
);
}
buff
.
append
(
"</tr>"
);
}
...
...
@@ -2002,12 +1998,10 @@ class WebThread extends Thread implements DatabaseEventListener {
rs
.
close
();
}
if
(
edit
)
{
buff
.
append
(
"<tr><td>"
);
buff
.
append
(
"<img onclick=\"javascript:editRow(-1, '${sessionId}', '${text.resultEdit.save}', '${text.resultEdit.cancel}'"
);
buff
.
append
(
")\" width=16 height=16 src=\"ico_add.gif\" onmouseover = \"this.className ='icon_hover'\" onmouseout = \"this.className ='icon'\" class=\"icon\" alt=\"${text.resultEdit.add}\" title=\"${text.resultEdit.add}\" border=\"1\"/>"
);
buff
.
append
(
"</td>"
);
buff
.
append
(
"<tr><td>"
).
append
(
"<img onclick=\"javascript:editRow(-1, '${sessionId}', '${text.resultEdit.save}', '${text.resultEdit.cancel}'"
).
append
(
")\" width=16 height=16 src=\"ico_add.gif\" onmouseover = \"this.className ='icon_hover'\" onmouseout = \"this.className ='icon'\" class=\"icon\" alt=\"${text.resultEdit.add}\" title=\"${text.resultEdit.add}\" border=\"1\"/>"
).
append
(
"</td>"
);
for
(
int
i
=
0
;
i
<
columns
;
i
++)
{
buff
.
append
(
"<td></td>"
);
}
...
...
@@ -2022,20 +2016,17 @@ class WebThread extends Thread implements DatabaseEventListener {
}
else
if
(
rows
==
1
)
{
buff
.
append
(
"(${text.result.1row}"
);
}
else
{
buff
.
append
(
'('
);
buff
.
append
(
rows
);
buff
.
append
(
" ${text.result.rows}"
);
buff
.
append
(
'('
).
append
(
rows
).
append
(
" ${text.result.rows}"
);
}
buff
.
append
(
", "
);
time
=
System
.
currentTimeMillis
()
-
time
;
buff
.
append
(
time
);
buff
.
append
(
" ms)"
);
buff
.
append
(
time
).
append
(
" ms)"
);
if
(!
edit
&&
isUpdatable
&&
allowEdit
)
{
buff
.
append
(
"<br /><br /><form name=\"editResult\" method=\"post\" action=\"query.do?jsessionid=${sessionId}\" target=\"h2result\">"
);
buff
.
append
(
"<input type=\"submit\" class=\"button\" value=\"${text.resultEdit.editResult}\" />"
);
buff
.
append
(
"<input type=\"hidden\" name=\"sql\" value=\"@EDIT "
+
PageParser
.
escapeHtml
(
sql
)
+
"\" />"
);
buff
.
append
(
"
</form>"
);
buff
.
append
(
"<br /><br /><form name=\"editResult\" method=\"post\" action=\"query.do?jsessionid=${sessionId}\" target=\"h2result\">"
+
"<input type=\"submit\" class=\"button\" value=\"${text.resultEdit.editResult}\" />"
+
"<input type=\"hidden\" name=\"sql\" value=\"@EDIT "
).
append
(
PageParser
.
escapeHtml
(
sql
)).
append
(
"\" />
</form>"
);
}
return
buff
.
toString
();
}
...
...
h2/src/main/org/h2/table/TableData.java
浏览文件 @
e662eb1d
...
...
@@ -551,8 +551,7 @@ public class TableData extends Table implements RecordReader {
}
else
{
buff
.
append
(
"MEMORY "
);
}
buff
.
append
(
"TABLE "
);
buff
.
append
(
getSQL
());
buff
.
append
(
"TABLE "
).
append
(
getSQL
());
if
(
comment
!=
null
)
{
buff
.
append
(
" COMMENT "
).
append
(
StringUtils
.
quoteStringSQL
(
comment
));
}
...
...
h2/src/main/org/h2/tools/MultiDimension.java
浏览文件 @
e662eb1d
...
...
@@ -109,14 +109,12 @@ public class MultiDimension {
*/
public
String
generatePreparedQuery
(
String
table
,
String
scalarColumn
,
String
[]
columns
)
{
StringBuilder
buff
=
new
StringBuilder
(
"SELECT D.* FROM "
);
buff
.
append
(
StringUtils
.
quoteIdentifier
(
table
))
;
buff
.
append
(
" D, TABLE(_FROM_ BIGINT=?, _TO_ BIGINT=?) WHERE "
);
buff
.
append
(
StringUtils
.
quoteIdentifier
(
scalarColumn
));
buff
.
append
(
" BETWEEN _FROM_ AND _TO_"
);
buff
.
append
(
StringUtils
.
quoteIdentifier
(
table
))
.
append
(
" D, TABLE(_FROM_ BIGINT=?, _TO_ BIGINT=?) WHERE "
).
append
(
StringUtils
.
quoteIdentifier
(
scalarColumn
)).
append
(
" BETWEEN _FROM_ AND _TO_"
);
for
(
String
col
:
columns
)
{
buff
.
append
(
" AND "
);
buff
.
append
(
StringUtils
.
quoteIdentifier
(
col
));
buff
.
append
(
"+1 BETWEEN ?+1 AND ?+1"
);
buff
.
append
(
" AND "
).
append
(
StringUtils
.
quoteIdentifier
(
col
)).
append
(
"+1 BETWEEN ?+1 AND ?+1"
);
}
return
buff
.
toString
();
}
...
...
h2/src/main/org/h2/tools/Recover.java
浏览文件 @
e662eb1d
...
...
@@ -260,13 +260,13 @@ public class Recover extends Tool implements DataHandler {
byte
[]
passwordHash
=
sha
.
getHashWithSalt
(
userPasswordHash
,
salt
);
boolean
admin
=
sql
.
indexOf
(
"ADMIN"
)
>=
0
;
StringBuilder
buff
=
new
StringBuilder
();
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
(
"CREATE USER "
)
.
append
(
Parser
.
quoteIdentifier
(
userName
)).
append
(
" SALT '"
).
append
(
ByteUtils
.
convertBytesToString
(
salt
)).
append
(
"' HASH '"
).
append
(
ByteUtils
.
convertBytesToString
(
passwordHash
)).
append
(
'\''
);
if
(
admin
)
{
buff
.
append
(
" ADMIN"
);
}
...
...
@@ -1025,11 +1025,11 @@ public class Recover extends Tool implements DataHandler {
byte
[]
salt
=
RandomUtils
.
getSecureBytes
(
Constants
.
SALT_LEN
);
byte
[]
passwordHash
=
sha
.
getHashWithSalt
(
userPasswordHash
,
salt
);
StringBuilder
buff
=
new
StringBuilder
();
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
(
'\''
);
byte
[]
replacement
=
buff
.
toString
().
getBytes
();
System
.
arraycopy
(
replacement
,
0
,
s
.
getBytes
(),
saltIndex
,
replacement
.
length
);
store
.
seek
(
pageSize
*
pageId
);
...
...
h2/src/main/org/h2/tools/Server.java
浏览文件 @
e662eb1d
...
...
@@ -268,8 +268,10 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
public
String
getStatus
()
{
StringBuilder
buff
=
new
StringBuilder
();
if
(
isRunning
(
false
))
{
buff
.
append
(
service
.
getType
()).
append
(
" server running on "
);
buff
.
append
(
service
.
getURL
()).
append
(
" ("
);
buff
.
append
(
service
.
getType
()).
append
(
" server running on "
).
append
(
service
.
getURL
()).
append
(
" ("
);
if
(
service
.
getAllowOthers
())
{
buff
.
append
(
"others can connect"
);
}
else
{
...
...
@@ -277,8 +279,10 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
}
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
());
buff
.
append
(
"The "
).
append
(
service
.
getType
()).
append
(
" server could not be started. Possible cause: another server is already running on "
).
append
(
service
.
getURL
());
}
return
buff
.
toString
();
}
...
...
h2/src/main/org/h2/tools/Shell.java
浏览文件 @
e662eb1d
...
...
@@ -482,8 +482,7 @@ public class Shell extends Tool {
for
(
int
j
=
label
.
length
();
j
<
longest
;
j
++)
{
buff
.
append
(
' '
);
}
buff
.
append
(
": "
);
buff
.
append
(
rs
.
getString
(
i
+
1
));
buff
.
append
(
": "
).
append
(
rs
.
getString
(
i
+
1
));
}
}
else
{
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
...
...
@@ -512,8 +511,7 @@ public class Shell extends Tool {
}
if
(
rowCount
==
0
&&
listMode
)
{
for
(
String
label
:
columns
)
{
buff
.
append
(
label
);
buff
.
append
(
'\n'
);
buff
.
append
(
label
).
append
(
'\n'
);
}
println
(
buff
.
toString
());
}
...
...
h2/src/main/org/h2/util/ScriptReader.java
浏览文件 @
e662eb1d
...
...
@@ -141,8 +141,7 @@ public class ScriptReader {
insideRemark
=
true
;
blockRemark
=
true
;
if
(!
skipRemarks
)
{
buff
.
append
((
char
)
last
);
buff
.
append
((
char
)
c
);
buff
.
append
((
char
)
last
).
append
((
char
)
c
);
}
while
(
true
)
{
c
=
read
();
...
...
@@ -173,8 +172,7 @@ public class ScriptReader {
insideRemark
=
true
;
blockRemark
=
false
;
if
(!
skipRemarks
)
{
buff
.
append
((
char
)
last
);
buff
.
append
((
char
)
c
);
buff
.
append
((
char
)
last
).
append
((
char
)
c
);
}
while
(
true
)
{
c
=
read
();
...
...
@@ -205,8 +203,7 @@ public class ScriptReader {
insideRemark
=
true
;
blockRemark
=
false
;
if
(!
skipRemarks
)
{
buff
.
append
((
char
)
last
);
buff
.
append
((
char
)
c
);
buff
.
append
((
char
)
last
).
append
((
char
)
c
);
}
while
(
true
)
{
c
=
read
();
...
...
h2/src/main/org/h2/util/StringUtils.java
浏览文件 @
e662eb1d
...
...
@@ -706,9 +706,9 @@ public class StringUtils {
break
;
default
:
if
(
ch
<
' '
||
ch
>
127
)
{
buff
.
append
(
"&#x"
)
;
buff
.
append
(
Integer
.
toHexString
(
ch
));
buff
.
append
(
';'
);
buff
.
append
(
"&#x"
)
.
append
(
Integer
.
toHexString
(
ch
)).
append
(
';'
);
}
else
{
buff
.
append
(
ch
);
}
...
...
@@ -734,8 +734,7 @@ public class StringUtils {
buff
.
append
(
s
.
substring
(
index
));
break
;
}
buff
.
append
(
s
.
substring
(
index
,
next
));
buff
.
append
(
after
);
buff
.
append
(
s
.
substring
(
index
,
next
)).
append
(
after
);
index
=
next
+
before
.
length
();
}
return
buff
.
toString
();
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
e662eb1d
...
...
@@ -292,11 +292,8 @@ java org.h2.test.TestAll timer
/*
recover tool: move
alter table add constraint behind insert into select
j > 0 -> StatementBuilder
buff.append... chain
shell tool: document encoding problem. mac: use
java -Dfile.encoding=UTF-8;
BaseIndex or TableData should have its own compareMode
(default is: Database.compareMode when created).
...
...
@@ -307,9 +304,6 @@ this mean changing the collation is allowed if there are tables.
test case for running out of disk space (using a special file system)
shell tool: document encoding problem. mac: use
java -Dfile.encoding=UTF-8
auto-build: prepare release
documentation: rolling review at roadmap.html: done
...
...
h2/src/tools/org/h2/build/BuildBase.java
浏览文件 @
e662eb1d
...
...
@@ -444,8 +444,8 @@ public class BuildBase {
StringBuilder
buff
=
new
StringBuilder
(
value
.
length
*
2
);
for
(
byte
c
:
value
)
{
int
x
=
c
&
0xff
;
buff
.
append
(
Integer
.
toString
(
x
>>
4
,
16
))
;
buff
.
append
(
Integer
.
toString
(
x
&
0xf
,
16
));
buff
.
append
(
Integer
.
toString
(
x
>>
4
,
16
))
.
append
(
Integer
.
toString
(
x
&
0xf
,
16
));
}
return
buff
.
toString
();
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论