Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
d801bd5c
提交
d801bd5c
authored
7月 23, 2015
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Formatting / Javadocs
上级
99d6c3ee
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
39 行增加
和
26 行删除
+39
-26
changelog.html
h2/src/docsrc/html/changelog.html
+2
-1
Database.java
h2/src/main/org/h2/engine/Database.java
+15
-9
Schema.java
h2/src/main/org/h2/schema/Schema.java
+9
-4
MetaTable.java
h2/src/main/org/h2/table/MetaTable.java
+13
-12
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
d801bd5c
...
@@ -24,7 +24,8 @@ Change Log
...
@@ -24,7 +24,8 @@ Change Log
<li>
A thread deadlock detector (disabled by default) can help
<li>
A thread deadlock detector (disabled by default) can help
detect and analyze Java level deadlocks.
detect and analyze Java level deadlocks.
To enable, set the system property "h2.threadDeadlockDetector" to true.
To enable, set the system property "h2.threadDeadlockDetector" to true.
<li>
Performance improvement for metadata queries that join against the COLUMNS metatable
</li>
<li>
Performance improvement for metadata queries that join against the COLUMNS metadata table.
</li>
</li>
<li>
MVStore: power failure could corrupt the store, if writes were re-ordered.
<li>
MVStore: power failure could corrupt the store, if writes were re-ordered.
</li>
</li>
...
...
h2/src/main/org/h2/engine/Database.java
浏览文件 @
d801bd5c
...
@@ -1516,16 +1516,22 @@ public class Database implements DataHandler {
...
@@ -1516,16 +1516,22 @@ public class Database implements DataHandler {
return
list
;
return
list
;
}
}
/**
* Get the tables with the given name, if any.
*
* @param name the table name
* @return the list
*/
public
ArrayList
<
Table
>
getTableOrViewByName
(
String
name
)
{
public
ArrayList
<
Table
>
getTableOrViewByName
(
String
name
)
{
ArrayList
<
Table
>
list
=
New
.
arrayList
();
ArrayList
<
Table
>
list
=
New
.
arrayList
();
for
(
Schema
schema
:
schemas
.
values
())
{
for
(
Schema
schema
:
schemas
.
values
())
{
Table
table
=
schema
.
getTableOrViewByName
(
name
);
Table
table
=
schema
.
getTableOrViewByName
(
name
);
if
(
table
!=
null
)
{
if
(
table
!=
null
)
{
list
.
add
(
table
);
list
.
add
(
table
);
}
}
}
}
return
list
;
return
list
;
}
}
public
ArrayList
<
Schema
>
getAllSchemas
()
{
public
ArrayList
<
Schema
>
getAllSchemas
()
{
initMetaTables
();
initMetaTables
();
...
...
h2/src/main/org/h2/schema/Schema.java
浏览文件 @
d801bd5c
...
@@ -538,13 +538,18 @@ public class Schema extends DbObjectBase {
...
@@ -538,13 +538,18 @@ public class Schema extends DbObjectBase {
}
}
}
}
/**
* Get the table with the given name, if any.
*
* @param name the table name
* @return the table or null if not found
*/
public
Table
getTableOrViewByName
(
String
name
)
{
public
Table
getTableOrViewByName
(
String
name
)
{
synchronized
(
database
)
{
synchronized
(
database
)
{
return
tablesAndViews
.
get
(
name
);
return
tablesAndViews
.
get
(
name
);
}
}
}
}
/**
/**
* Remove an object from this schema.
* Remove an object from this schema.
*
*
...
...
h2/src/main/org/h2/table/MetaTable.java
浏览文件 @
d801bd5c
...
@@ -617,13 +617,13 @@ public class MetaTable extends Table {
...
@@ -617,13 +617,13 @@ public class MetaTable extends Table {
}
}
private
ArrayList
<
Table
>
getTablesByName
(
Session
session
,
String
tableName
)
{
private
ArrayList
<
Table
>
getTablesByName
(
Session
session
,
String
tableName
)
{
ArrayList
<
Table
>
tables
=
database
.
getTableOrViewByName
(
tableName
);
ArrayList
<
Table
>
tables
=
database
.
getTableOrViewByName
(
tableName
);
for
(
Table
temp
:
session
.
getLocalTempTables
())
{
for
(
Table
temp
:
session
.
getLocalTempTables
())
{
if
(
temp
.
getName
().
equals
(
tableName
))
{
if
(
temp
.
getName
().
equals
(
tableName
))
{
tables
.
add
(
temp
);
tables
.
add
(
temp
);
}
}
}
}
return
tables
;
return
tables
;
}
}
private
boolean
checkIndex
(
Session
session
,
String
value
,
Value
indexFrom
,
private
boolean
checkIndex
(
Session
session
,
String
value
,
Value
indexFrom
,
...
@@ -738,13 +738,14 @@ public class MetaTable extends Table {
...
@@ -738,13 +738,14 @@ public class MetaTable extends Table {
break
;
break
;
}
}
case
COLUMNS:
{
case
COLUMNS:
{
// reduce the number of tables to scan - makes some metadata queries 10x faster
// reduce the number of tables to scan - makes some metadata queries
final
ArrayList
<
Table
>
tablesToList
;
// 10x faster
final
ArrayList
<
Table
>
tablesToList
;
if
(
indexFrom
!=
null
&&
indexTo
!=
null
&&
indexFrom
.
equals
(
indexTo
))
{
if
(
indexFrom
!=
null
&&
indexTo
!=
null
&&
indexFrom
.
equals
(
indexTo
))
{
String
tableName
=
identifier
(
indexFrom
.
getString
());
String
tableName
=
identifier
(
indexFrom
.
getString
());
tablesToList
=
getTablesByName
(
session
,
tableName
);
tablesToList
=
getTablesByName
(
session
,
tableName
);
}
else
{
}
else
{
tablesToList
=
getAllTables
(
session
);
tablesToList
=
getAllTables
(
session
);
}
}
for
(
Table
table
:
tablesToList
)
{
for
(
Table
table
:
tablesToList
)
{
String
tableName
=
identifier
(
table
.
getName
());
String
tableName
=
identifier
(
table
.
getName
());
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论