Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
9150d35a
Unverified
提交
9150d35a
authored
1月 13, 2018
作者:
Noel Grandin
提交者:
GitHub
1月 13, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #758 from katzyn/misc
Allocate less amount of garbage
上级
6d3600e2
5acc65e8
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
144 行增加
和
134 行删除
+144
-134
Parser.java
h2/src/main/org/h2/command/Parser.java
+4
-4
ScriptCommand.java
h2/src/main/org/h2/command/dml/ScriptCommand.java
+6
-5
SetTypes.java
h2/src/main/org/h2/command/dml/SetTypes.java
+7
-11
ConnectionInfo.java
h2/src/main/org/h2/engine/ConnectionInfo.java
+5
-5
Aggregate.java
h2/src/main/org/h2/expression/Aggregate.java
+4
-2
FreeSpaceBitSet.java
h2/src/main/org/h2/mvstore/FreeSpaceBitSet.java
+3
-3
Page.java
h2/src/main/org/h2/mvstore/Page.java
+4
-4
ObjectDataType.java
h2/src/main/org/h2/mvstore/type/ObjectDataType.java
+1
-3
RowImpl.java
h2/src/main/org/h2/result/RowImpl.java
+1
-1
SimpleRow.java
h2/src/main/org/h2/result/SimpleRow.java
+1
-1
WebApp.java
h2/src/main/org/h2/server/web/WebApp.java
+89
-79
TableLink.java
h2/src/main/org/h2/table/TableLink.java
+1
-1
Recover.java
h2/src/main/org/h2/tools/Recover.java
+1
-1
AbbaLockingDetector.java
h2/src/main/org/h2/util/AbbaLockingDetector.java
+17
-14
没有找到文件。
h2/src/main/org/h2/command/Parser.java
浏览文件 @
9150d35a
...
...
@@ -1154,10 +1154,10 @@ public class Parser {
TableFilter
sourceTableFilter
=
readSimpleTableFilterWithAliasExcludes
(
0
,
excludeIdentifiers
);
command
.
setSourceTableFilter
(
sourceTableFilter
);
StringBuilder
buff
=
new
StringBuilder
(
"SELECT * FROM "
+
sourceTableFilter
.
getTable
().
getName
());
StringBuilder
buff
=
new
StringBuilder
(
"SELECT * FROM "
)
.
append
(
sourceTableFilter
.
getTable
().
getName
());
if
(
sourceTableFilter
.
getTableAlias
()
!=
null
)
{
buff
.
append
(
" AS "
+
sourceTableFilter
.
getTableAlias
());
buff
.
append
(
" AS "
).
append
(
sourceTableFilter
.
getTableAlias
());
}
Prepared
preparedQuery
=
prepare
(
session
,
buff
.
toString
(),
null
/*paramValues*/
);
command
.
setQuery
((
Select
)
preparedQuery
);
...
...
@@ -1208,7 +1208,7 @@ public class Parser {
" AS "
+
command
.
getTargetTableFilter
().
getTableAlias
());
}
targetMatchQuerySQL
.
append
(
" WHERE "
+
command
.
getOnCondition
().
getSQL
());
.
append
(
" WHERE "
).
append
(
command
.
getOnCondition
().
getSQL
());
command
.
setTargetMatchQuery
(
(
Select
)
parse
(
targetMatchQuerySQL
.
toString
()));
...
...
h2/src/main/org/h2/command/dml/ScriptCommand.java
浏览文件 @
9150d35a
...
...
@@ -423,10 +423,10 @@ public class ScriptCommand extends ScriptBase {
int
id
;
if
(
v
.
getType
()
==
Value
.
CLOB
)
{
id
=
writeLobStream
(
v
);
buff
.
append
(
"SYSTEM_COMBINE_CLOB("
+
id
+
")"
);
buff
.
append
(
"SYSTEM_COMBINE_CLOB("
).
append
(
id
).
append
(
')'
);
}
else
if
(
v
.
getType
()
==
Value
.
BLOB
)
{
id
=
writeLobStream
(
v
);
buff
.
append
(
"SYSTEM_COMBINE_BLOB("
+
id
+
")"
);
buff
.
append
(
"SYSTEM_COMBINE_BLOB("
).
append
(
id
).
append
(
')'
);
}
else
{
buff
.
append
(
v
.
getSQL
());
}
...
...
@@ -471,8 +471,8 @@ public class ScriptCommand extends ScriptBase {
try
(
InputStream
input
=
v
.
getInputStream
())
{
for
(
int
i
=
0
;;
i
++)
{
StringBuilder
buff
=
new
StringBuilder
(
lobBlockSize
*
2
);
buff
.
append
(
"INSERT INTO SYSTEM_LOB_STREAM VALUES("
+
id
+
", "
+
i
+
", NULL, '"
);
buff
.
append
(
"INSERT INTO SYSTEM_LOB_STREAM VALUES("
).
append
(
id
)
.
append
(
", "
).
append
(
i
).
append
(
", NULL, '"
);
int
len
=
IOUtils
.
readFully
(
input
,
bytes
,
lobBlockSize
);
if
(
len
<=
0
)
{
break
;
...
...
@@ -490,7 +490,8 @@ public class ScriptCommand extends ScriptBase {
try
(
Reader
reader
=
v
.
getReader
())
{
for
(
int
i
=
0
;;
i
++)
{
StringBuilder
buff
=
new
StringBuilder
(
lobBlockSize
*
2
);
buff
.
append
(
"INSERT INTO SYSTEM_LOB_STREAM VALUES("
+
id
+
", "
+
i
+
", "
);
buff
.
append
(
"INSERT INTO SYSTEM_LOB_STREAM VALUES("
).
append
(
id
).
append
(
", "
).
append
(
i
)
.
append
(
", "
);
int
len
=
IOUtils
.
readFully
(
reader
,
chars
,
lobBlockSize
);
if
(
len
==
0
)
{
break
;
...
...
h2/src/main/org/h2/command/dml/SetTypes.java
浏览文件 @
9150d35a
...
...
@@ -6,7 +6,6 @@
package
org
.
h2
.
command
.
dml
;
import
java.util.ArrayList
;
import
org.h2.util.New
;
/**
* The list of setting for a SET statement.
...
...
@@ -247,20 +246,22 @@ public class SetTypes {
* The type of SET BUILTIN_ALIAS_OVERRIDE statement.
*/
public
static
final
int
BUILTIN_ALIAS_OVERRIDE
=
47
;
/**
* The type of a SET COLUMN_NAME_RULES statement.
*/
public
static
final
int
COLUMN_NAME_RULES
=
48
;
private
static
final
int
COUNT
=
COLUMN_NAME_RULES
+
1
;
private
static
final
ArrayList
<
String
>
TYPES
=
New
.
arrayList
()
;
private
static
final
ArrayList
<
String
>
TYPES
;
private
SetTypes
()
{
// utility class
}
static
{
ArrayList
<
String
>
list
=
TYPES
;
ArrayList
<
String
>
list
=
new
ArrayList
<>(
COUNT
)
;
list
.
add
(
null
);
list
.
add
(
IGNORECASE
,
"IGNORECASE"
);
list
.
add
(
MAX_LOG_SIZE
,
"MAX_LOG_SIZE"
);
...
...
@@ -310,7 +311,7 @@ public class SetTypes {
list
.
add
(
LAZY_QUERY_EXECUTION
,
"LAZY_QUERY_EXECUTION"
);
list
.
add
(
BUILTIN_ALIAS_OVERRIDE
,
"BUILTIN_ALIAS_OVERRIDE"
);
list
.
add
(
COLUMN_NAME_RULES
,
"COLUMN_NAME_RULES"
);
TYPES
=
list
;
}
/**
...
...
@@ -320,12 +321,7 @@ public class SetTypes {
* @return the number
*/
public
static
int
getType
(
String
name
)
{
for
(
int
i
=
0
;
i
<
getTypes
().
size
();
i
++)
{
if
(
name
.
equals
(
getTypes
().
get
(
i
)))
{
return
i
;
}
}
return
-
1
;
return
TYPES
.
indexOf
(
name
);
}
public
static
ArrayList
<
String
>
getTypes
()
{
...
...
@@ -339,7 +335,7 @@ public class SetTypes {
* @return the name
*/
public
static
String
getTypeName
(
int
type
)
{
return
getTypes
()
.
get
(
type
);
return
TYPES
.
get
(
type
);
}
}
h2/src/main/org/h2/engine/ConnectionInfo.java
浏览文件 @
9150d35a
...
...
@@ -28,7 +28,7 @@ import org.h2.util.Utils;
* Encapsulates the connection settings, including user name and password.
*/
public
class
ConnectionInfo
implements
Cloneable
{
private
static
final
HashSet
<
String
>
KNOWN_SETTINGS
=
New
.
hashSet
()
;
private
static
final
HashSet
<
String
>
KNOWN_SETTINGS
;
private
Properties
prop
=
new
Properties
();
private
String
originalURL
;
...
...
@@ -93,19 +93,19 @@ public class ConnectionInfo implements Cloneable {
static
{
ArrayList
<
String
>
list
=
SetTypes
.
getTypes
();
HashSet
<
String
>
set
=
KNOWN_SETTINGS
;
set
.
addAll
(
list
);
String
[]
connectionTime
=
{
"ACCESS_MODE_DATA"
,
"AUTOCOMMIT"
,
"CIPHER"
,
"CREATE"
,
"CACHE_TYPE"
,
"FILE_LOCK"
,
"IGNORE_UNKNOWN_SETTINGS"
,
"IFEXISTS"
,
"INIT"
,
"PASSWORD"
,
"RECOVER"
,
"RECOVER_TEST"
,
"USER"
,
"AUTO_SERVER"
,
"AUTO_SERVER_PORT"
,
"NO_UPGRADE"
,
"AUTO_RECONNECT"
,
"OPEN_NEW"
,
"PAGE_SIZE"
,
"PASSWORD_HASH"
,
"JMX"
};
HashSet
<
String
>
set
=
new
HashSet
<>(
list
.
size
()
+
connectionTime
.
length
);
set
.
addAll
(
list
);
for
(
String
key
:
connectionTime
)
{
if
(
SysProperties
.
CHECK
&&
set
.
contains
(
key
)
)
{
if
(
!
set
.
add
(
key
)
&&
SysProperties
.
CHECK
)
{
DbException
.
throwInternalError
(
key
);
}
set
.
add
(
key
);
}
KNOWN_SETTINGS
=
set
;
}
private
static
boolean
isKnownSetting
(
String
s
)
{
...
...
h2/src/main/org/h2/expression/Aggregate.java
浏览文件 @
9150d35a
...
...
@@ -22,7 +22,6 @@ import org.h2.table.Column;
import
org.h2.table.ColumnResolver
;
import
org.h2.table.Table
;
import
org.h2.table.TableFilter
;
import
org.h2.util.New
;
import
org.h2.util.StatementBuilder
;
import
org.h2.util.StringUtils
;
import
org.h2.value.DataType
;
...
...
@@ -125,7 +124,7 @@ public class Aggregate extends Expression {
*/
static
final
int
HISTOGRAM
=
16
;
private
static
final
HashMap
<
String
,
Integer
>
AGGREGATES
=
New
.
hashMap
(
);
private
static
final
HashMap
<
String
,
Integer
>
AGGREGATES
=
new
HashMap
<>(
24
);
private
final
int
type
;
private
final
Select
select
;
...
...
@@ -156,6 +155,9 @@ public class Aggregate extends Expression {
}
static
{
/*
* Update initial size of AGGREGATES after editing the following list.
*/
addAggregate
(
"COUNT"
,
COUNT
);
addAggregate
(
"SUM"
,
SUM
);
addAggregate
(
"MIN"
,
MIN
);
...
...
h2/src/main/org/h2/mvstore/FreeSpaceBitSet.java
浏览文件 @
9150d35a
...
...
@@ -197,9 +197,9 @@ public class FreeSpaceBitSet {
on
=
0
;
}
}
buff
.
append
(
"\n"
);
buff
.
append
(
" on "
+
onCount
+
" off "
+
offCount
);
buff
.
append
(
" "
+
100
*
onCount
/
(
onCount
+
offCount
)
+
"% used "
);
buff
.
append
(
'\n'
)
.
append
(
" on "
).
append
(
onCount
).
append
(
" off "
).
append
(
offCount
)
.
append
(
' '
).
append
(
100
*
onCount
/
(
onCount
+
offCount
)).
append
(
"% used "
);
}
buff
.
append
(
'['
);
for
(
int
i
=
0
;;)
{
...
...
h2/src/main/org/h2/mvstore/Page.java
浏览文件 @
9150d35a
...
...
@@ -259,18 +259,18 @@ public class Page {
public
String
toString
()
{
StringBuilder
buff
=
new
StringBuilder
();
buff
.
append
(
"id: "
).
append
(
System
.
identityHashCode
(
this
)).
append
(
'\n'
);
buff
.
append
(
"version: "
).
append
(
Long
.
toHexString
(
version
)).
append
(
"\n"
);
buff
.
append
(
"pos: "
).
append
(
Long
.
toHexString
(
pos
)).
append
(
"\n"
);
buff
.
append
(
"version: "
).
append
(
Long
.
toHexString
(
version
)).
append
(
'\n'
);
buff
.
append
(
"pos: "
).
append
(
Long
.
toHexString
(
pos
)).
append
(
'\n'
);
if
(
pos
!=
0
)
{
int
chunkId
=
DataUtils
.
getPageChunkId
(
pos
);
buff
.
append
(
"chunk: "
).
append
(
Long
.
toHexString
(
chunkId
)).
append
(
"\n"
);
buff
.
append
(
"chunk: "
).
append
(
Long
.
toHexString
(
chunkId
)).
append
(
'\n'
);
}
for
(
int
i
=
0
;
i
<=
keys
.
length
;
i
++)
{
if
(
i
>
0
)
{
buff
.
append
(
" "
);
}
if
(
children
!=
null
)
{
buff
.
append
(
"["
+
Long
.
toHexString
(
children
[
i
].
pos
)
+
"] "
);
buff
.
append
(
'['
).
append
(
Long
.
toHexString
(
children
[
i
].
pos
)).
append
(
"] "
);
}
if
(
i
<
keys
.
length
)
{
buff
.
append
(
keys
[
i
]);
...
...
h2/src/main/org/h2/mvstore/type/ObjectDataType.java
浏览文件 @
9150d35a
...
...
@@ -19,7 +19,6 @@ import java.util.HashMap;
import
java.util.UUID
;
import
org.h2.mvstore.DataUtils
;
import
org.h2.mvstore.WriteBuffer
;
import
org.h2.util.New
;
/**
* A data type implementation for the most common data types, including
...
...
@@ -94,8 +93,7 @@ public class ObjectDataType implements DataType {
Float
.
class
,
Double
.
class
,
BigDecimal
.
class
,
String
.
class
,
UUID
.
class
,
Date
.
class
};
private
static
final
HashMap
<
Class
<?>,
Integer
>
COMMON_CLASSES_MAP
=
New
.
hashMap
();
private
static
final
HashMap
<
Class
<?>,
Integer
>
COMMON_CLASSES_MAP
=
new
HashMap
<>(
COMMON_CLASSES
.
length
);
private
AutoDetectDataType
last
=
new
StringType
(
this
);
...
...
h2/src/main/org/h2/result/RowImpl.java
浏览文件 @
9150d35a
...
...
@@ -134,7 +134,7 @@ public class RowImpl implements Row {
StatementBuilder
buff
=
new
StatementBuilder
(
"( /* key:"
);
buff
.
append
(
getKey
());
if
(
version
!=
0
)
{
buff
.
append
(
" v:"
+
version
);
buff
.
append
(
" v:"
).
append
(
version
);
}
if
(
isDeleted
())
{
buff
.
append
(
" deleted"
);
...
...
h2/src/main/org/h2/result/SimpleRow.java
浏览文件 @
9150d35a
...
...
@@ -64,7 +64,7 @@ public class SimpleRow implements SearchRow {
StatementBuilder
buff
=
new
StatementBuilder
(
"( /* key:"
);
buff
.
append
(
getKey
());
if
(
version
!=
0
)
{
buff
.
append
(
" v:"
+
version
);
buff
.
append
(
" v:"
).
append
(
version
);
}
buff
.
append
(
" */ "
);
for
(
Value
v
:
data
)
{
...
...
h2/src/main/org/h2/server/web/WebApp.java
浏览文件 @
9150d35a
差异被折叠。
点击展开。
h2/src/main/org/h2/table/TableLink.java
浏览文件 @
9150d35a
...
...
@@ -387,7 +387,7 @@ public class TableLink extends Table {
if
(
readOnly
)
{
buff
.
append
(
" READONLY"
);
}
buff
.
append
(
" /*"
+
JdbcSQLException
.
HIDE_SQL
+
"*/"
);
buff
.
append
(
" /*"
).
append
(
JdbcSQLException
.
HIDE_SQL
).
append
(
"*/"
);
return
buff
.
toString
();
}
...
...
h2/src/main/org/h2/tools/Recover.java
浏览文件 @
9150d35a
...
...
@@ -1477,7 +1477,7 @@ public class Recover extends Tool implements DataHandler {
private
void
writeRow
(
PrintWriter
writer
,
Data
s
,
Value
[]
data
)
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"INSERT INTO "
+
storageName
+
" VALUES("
);
sb
.
append
(
"INSERT INTO "
).
append
(
storageName
).
append
(
" VALUES("
);
for
(
valueId
=
0
;
valueId
<
recordLength
;
valueId
++)
{
try
{
Value
v
=
s
.
readValue
();
...
...
h2/src/main/org/h2/util/AbbaLockingDetector.java
浏览文件 @
9150d35a
...
...
@@ -184,15 +184,15 @@ public class AbbaLockingDetector implements Runnable {
* stack frames)
*/
private
static
String
getStackTraceForThread
(
ThreadInfo
info
)
{
StringBuilder
sb
=
new
StringBuilder
(
"\""
+
info
.
getThreadName
()
+
"\""
+
" Id="
+
info
.
getThreadId
()
+
" "
+
info
.
getThreadState
());
StringBuilder
sb
=
new
StringBuilder
(
).
append
(
'"'
)
.
append
(
info
.
getThreadName
()).
append
(
"\""
+
" Id="
)
.
append
(
info
.
getThreadId
()).
append
(
' '
).
append
(
info
.
getThreadState
());
if
(
info
.
getLockName
()
!=
null
)
{
sb
.
append
(
" on "
+
info
.
getLockName
());
sb
.
append
(
" on "
).
append
(
info
.
getLockName
());
}
if
(
info
.
getLockOwnerName
()
!=
null
)
{
sb
.
append
(
" owned by \""
+
info
.
getLockOwnerName
()
+
"\" Id="
+
info
.
getLockOwnerId
());
sb
.
append
(
" owned by \""
).
append
(
info
.
getLockOwnerName
())
.
append
(
"\" Id="
).
append
(
info
.
getLockOwnerId
());
}
if
(
info
.
isSuspended
())
{
sb
.
append
(
" (suspended)"
);
...
...
@@ -229,22 +229,25 @@ public class AbbaLockingDetector implements Runnable {
private
static
void
dumpStackTraceElement
(
ThreadInfo
info
,
StringBuilder
sb
,
int
i
,
StackTraceElement
e
)
{
sb
.
append
(
'\t'
).
append
(
"at "
).
append
(
e
.
toString
());
sb
.
append
(
'\n'
);
sb
.
append
(
'\t'
).
append
(
"at "
).
append
(
e
)
.
append
(
'\n'
);
if
(
i
==
0
&&
info
.
getLockInfo
()
!=
null
)
{
Thread
.
State
ts
=
info
.
getThreadState
();
switch
(
ts
)
{
case
BLOCKED:
sb
.
append
(
"\t- blocked on "
+
info
.
getLockInfo
());
sb
.
append
(
'\n'
);
sb
.
append
(
"\t- blocked on "
)
.
append
(
info
.
getLockInfo
())
.
append
(
'\n'
);
break
;
case
WAITING:
sb
.
append
(
"\t- waiting on "
+
info
.
getLockInfo
());
sb
.
append
(
'\n'
);
sb
.
append
(
"\t- waiting on "
)
.
append
(
info
.
getLockInfo
())
.
append
(
'\n'
);
break
;
case
TIMED_WAITING:
sb
.
append
(
"\t- waiting on "
+
info
.
getLockInfo
());
sb
.
append
(
'\n'
);
sb
.
append
(
"\t- waiting on "
)
.
append
(
info
.
getLockInfo
())
.
append
(
'\n'
);
break
;
default
:
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论