Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
ff7d9f9a
提交
ff7d9f9a
authored
11月 16, 2016
作者:
Noel Grandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
convert Table Type to enum
上级
e4440728
显示空白字符变更
内嵌
并排
正在显示
20 个修改的文件
包含
102 行增加
和
73 行删除
+102
-73
Analyze.java
h2/src/main/org/h2/command/ddl/Analyze.java
+2
-1
CreateView.java
h2/src/main/org/h2/command/ddl/CreateView.java
+2
-1
DropDatabase.java
h2/src/main/org/h2/command/ddl/DropDatabase.java
+5
-4
DropView.java
h2/src/main/org/h2/command/ddl/DropView.java
+2
-1
ScriptCommand.java
h2/src/main/org/h2/command/dml/ScriptCommand.java
+3
-2
Database.java
h2/src/main/org/h2/engine/Database.java
+2
-1
Session.java
h2/src/main/org/h2/engine/Session.java
+4
-3
User.java
h2/src/main/org/h2/engine/User.java
+3
-3
IndexCondition.java
h2/src/main/org/h2/index/IndexCondition.java
+2
-2
MVTable.java
h2/src/main/org/h2/mvstore/db/MVTable.java
+3
-3
PageStore.java
h2/src/main/org/h2/store/PageStore.java
+2
-2
FunctionTable.java
h2/src/main/org/h2/table/FunctionTable.java
+1
-2
MetaTable.java
h2/src/main/org/h2/table/MetaTable.java
+9
-9
RangeTable.java
h2/src/main/org/h2/table/RangeTable.java
+1
-2
RegularTable.java
h2/src/main/org/h2/table/RegularTable.java
+2
-2
Table.java
h2/src/main/org/h2/table/Table.java
+1
-26
TableLink.java
h2/src/main/org/h2/table/TableLink.java
+2
-2
TableType.java
h2/src/main/org/h2/table/TableType.java
+48
-0
TableView.java
h2/src/main/org/h2/table/TableView.java
+3
-3
TestTableEngines.java
h2/src/test/org/h2/test/db/TestTableEngines.java
+5
-4
没有找到文件。
h2/src/main/org/h2/command/ddl/Analyze.java
浏览文件 @
ff7d9f9a
...
@@ -15,6 +15,7 @@ import org.h2.expression.Parameter;
...
@@ -15,6 +15,7 @@ import org.h2.expression.Parameter;
import
org.h2.result.ResultInterface
;
import
org.h2.result.ResultInterface
;
import
org.h2.table.Column
;
import
org.h2.table.Column
;
import
org.h2.table.Table
;
import
org.h2.table.Table
;
import
org.h2.table.TableType
;
import
org.h2.util.StatementBuilder
;
import
org.h2.util.StatementBuilder
;
import
org.h2.value.Value
;
import
org.h2.value.Value
;
import
org.h2.value.ValueInt
;
import
org.h2.value.ValueInt
;
...
@@ -57,7 +58,7 @@ public class Analyze extends DefineCommand {
...
@@ -57,7 +58,7 @@ public class Analyze extends DefineCommand {
*/
*/
public
static
void
analyzeTable
(
Session
session
,
Table
table
,
int
sample
,
public
static
void
analyzeTable
(
Session
session
,
Table
table
,
int
sample
,
boolean
manual
)
{
boolean
manual
)
{
if
(
!(
table
.
getTableType
().
equals
(
Table
.
TABLE
))
||
if
(
table
.
getTableType
()
!=
TableType
.
TABLE
||
table
.
isHidden
()
||
session
==
null
)
{
table
.
isHidden
()
||
session
==
null
)
{
return
;
return
;
}
}
...
...
h2/src/main/org/h2/command/ddl/CreateView.java
浏览文件 @
ff7d9f9a
...
@@ -17,6 +17,7 @@ import org.h2.message.DbException;
...
@@ -17,6 +17,7 @@ import org.h2.message.DbException;
import
org.h2.schema.Schema
;
import
org.h2.schema.Schema
;
import
org.h2.table.Column
;
import
org.h2.table.Column
;
import
org.h2.table.Table
;
import
org.h2.table.Table
;
import
org.h2.table.TableType
;
import
org.h2.table.TableView
;
import
org.h2.table.TableView
;
import
org.h2.value.Value
;
import
org.h2.value.Value
;
...
@@ -82,7 +83,7 @@ public class CreateView extends SchemaCommand {
...
@@ -82,7 +83,7 @@ public class CreateView extends SchemaCommand {
if
(
ifNotExists
)
{
if
(
ifNotExists
)
{
return
0
;
return
0
;
}
}
if
(!
orReplace
||
!
Table
.
VIEW
.
equals
(
old
.
getTableType
()
))
{
if
(!
orReplace
||
TableType
.
VIEW
!=
old
.
getTableType
(
))
{
throw
DbException
.
get
(
ErrorCode
.
VIEW_ALREADY_EXISTS_1
,
viewName
);
throw
DbException
.
get
(
ErrorCode
.
VIEW_ALREADY_EXISTS_1
,
viewName
);
}
}
view
=
(
TableView
)
old
;
view
=
(
TableView
)
old
;
...
...
h2/src/main/org/h2/command/ddl/DropDatabase.java
浏览文件 @
ff7d9f9a
...
@@ -15,6 +15,7 @@ import org.h2.engine.User;
...
@@ -15,6 +15,7 @@ import org.h2.engine.User;
import
org.h2.schema.Schema
;
import
org.h2.schema.Schema
;
import
org.h2.schema.SchemaObject
;
import
org.h2.schema.SchemaObject
;
import
org.h2.table.Table
;
import
org.h2.table.Table
;
import
org.h2.table.TableType
;
import
org.h2.util.New
;
import
org.h2.util.New
;
/**
/**
...
@@ -55,26 +56,26 @@ public class DropDatabase extends DefineCommand {
...
@@ -55,26 +56,26 @@ public class DropDatabase extends DefineCommand {
ArrayList
<
Table
>
toRemove
=
New
.
arrayList
();
ArrayList
<
Table
>
toRemove
=
New
.
arrayList
();
for
(
Table
t
:
tables
)
{
for
(
Table
t
:
tables
)
{
if
(
t
.
getName
()
!=
null
&&
if
(
t
.
getName
()
!=
null
&&
Table
.
VIEW
.
equals
(
t
.
getTableType
()
))
{
Table
Type
.
VIEW
==
t
.
getTableType
(
))
{
toRemove
.
add
(
t
);
toRemove
.
add
(
t
);
}
}
}
}
for
(
Table
t
:
tables
)
{
for
(
Table
t
:
tables
)
{
if
(
t
.
getName
()
!=
null
&&
if
(
t
.
getName
()
!=
null
&&
Table
.
TABLE_LINK
.
equals
(
t
.
getTableType
()
))
{
Table
Type
.
TABLE_LINK
==
t
.
getTableType
(
))
{
toRemove
.
add
(
t
);
toRemove
.
add
(
t
);
}
}
}
}
for
(
Table
t
:
tables
)
{
for
(
Table
t
:
tables
)
{
if
(
t
.
getName
()
!=
null
&&
if
(
t
.
getName
()
!=
null
&&
Table
.
TABLE
.
equals
(
t
.
getTableType
()
)
&&
Table
Type
.
TABLE
==
t
.
getTableType
(
)
&&
!
t
.
isHidden
())
{
!
t
.
isHidden
())
{
toRemove
.
add
(
t
);
toRemove
.
add
(
t
);
}
}
}
}
for
(
Table
t
:
tables
)
{
for
(
Table
t
:
tables
)
{
if
(
t
.
getName
()
!=
null
&&
if
(
t
.
getName
()
!=
null
&&
Table
.
EXTERNAL_TABLE_ENGINE
.
equals
(
t
.
getTableType
()
)
&&
Table
Type
.
EXTERNAL_TABLE_ENGINE
==
t
.
getTableType
(
)
&&
!
t
.
isHidden
())
{
!
t
.
isHidden
())
{
toRemove
.
add
(
t
);
toRemove
.
add
(
t
);
}
}
...
...
h2/src/main/org/h2/command/ddl/DropView.java
浏览文件 @
ff7d9f9a
...
@@ -14,6 +14,7 @@ import org.h2.engine.Session;
...
@@ -14,6 +14,7 @@ import org.h2.engine.Session;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.schema.Schema
;
import
org.h2.schema.Schema
;
import
org.h2.table.Table
;
import
org.h2.table.Table
;
import
org.h2.table.TableType
;
import
org.h2.table.TableView
;
import
org.h2.table.TableView
;
/**
/**
...
@@ -54,7 +55,7 @@ public class DropView extends SchemaCommand {
...
@@ -54,7 +55,7 @@ public class DropView extends SchemaCommand {
throw
DbException
.
get
(
ErrorCode
.
VIEW_NOT_FOUND_1
,
viewName
);
throw
DbException
.
get
(
ErrorCode
.
VIEW_NOT_FOUND_1
,
viewName
);
}
}
}
else
{
}
else
{
if
(
!
Table
.
VIEW
.
equals
(
view
.
getTableType
()
))
{
if
(
TableType
.
VIEW
!=
view
.
getTableType
(
))
{
throw
DbException
.
get
(
ErrorCode
.
VIEW_NOT_FOUND_1
,
viewName
);
throw
DbException
.
get
(
ErrorCode
.
VIEW_NOT_FOUND_1
,
viewName
);
}
}
session
.
getUser
().
checkRight
(
view
,
Right
.
ALL
);
session
.
getUser
().
checkRight
(
view
,
Right
.
ALL
);
...
...
h2/src/main/org/h2/command/dml/ScriptCommand.java
浏览文件 @
ff7d9f9a
...
@@ -52,6 +52,7 @@ import org.h2.schema.TriggerObject;
...
@@ -52,6 +52,7 @@ import org.h2.schema.TriggerObject;
import
org.h2.table.Column
;
import
org.h2.table.Column
;
import
org.h2.table.PlanItem
;
import
org.h2.table.PlanItem
;
import
org.h2.table.Table
;
import
org.h2.table.Table
;
import
org.h2.table.TableType
;
import
org.h2.util.IOUtils
;
import
org.h2.util.IOUtils
;
import
org.h2.util.MathUtils
;
import
org.h2.util.MathUtils
;
import
org.h2.util.StatementBuilder
;
import
org.h2.util.StatementBuilder
;
...
@@ -277,7 +278,7 @@ public class ScriptCommand extends ScriptBase {
...
@@ -277,7 +278,7 @@ public class ScriptCommand extends ScriptBase {
// null for metadata tables
// null for metadata tables
continue
;
continue
;
}
}
final
String
tableType
=
table
.
getTableType
();
final
TableType
tableType
=
table
.
getTableType
();
add
(
createTableSql
,
false
);
add
(
createTableSql
,
false
);
final
ArrayList
<
Constraint
>
constraints
=
table
.
getConstraints
();
final
ArrayList
<
Constraint
>
constraints
=
table
.
getConstraints
();
if
(
constraints
!=
null
)
{
if
(
constraints
!=
null
)
{
...
@@ -288,7 +289,7 @@ public class ScriptCommand extends ScriptBase {
...
@@ -288,7 +289,7 @@ public class ScriptCommand extends ScriptBase {
}
}
}
}
}
}
if
(
Table
.
TABLE
.
equals
(
tableType
)
)
{
if
(
Table
Type
.
TABLE
==
tableType
)
{
if
(
table
.
canGetRowCount
())
{
if
(
table
.
canGetRowCount
())
{
String
rowcount
=
"-- "
+
String
rowcount
=
"-- "
+
table
.
getRowCountApproximation
()
+
table
.
getRowCountApproximation
()
+
...
...
h2/src/main/org/h2/engine/Database.java
浏览文件 @
ff7d9f9a
...
@@ -54,6 +54,7 @@ import org.h2.table.IndexColumn;
...
@@ -54,6 +54,7 @@ import org.h2.table.IndexColumn;
import
org.h2.table.MetaTable
;
import
org.h2.table.MetaTable
;
import
org.h2.table.Table
;
import
org.h2.table.Table
;
import
org.h2.table.TableLinkConnection
;
import
org.h2.table.TableLinkConnection
;
import
org.h2.table.TableType
;
import
org.h2.table.TableView
;
import
org.h2.table.TableView
;
import
org.h2.tools.DeleteDbFiles
;
import
org.h2.tools.DeleteDbFiles
;
import
org.h2.tools.Server
;
import
org.h2.tools.Server
;
...
@@ -1798,7 +1799,7 @@ public class Database implements DataHandler {
...
@@ -1798,7 +1799,7 @@ public class Database implements DataHandler {
for
(
Table
t
:
getAllTablesAndViews
(
false
))
{
for
(
Table
t
:
getAllTablesAndViews
(
false
))
{
if
(
except
==
t
)
{
if
(
except
==
t
)
{
continue
;
continue
;
}
else
if
(
Table
.
VIEW
.
equals
(
t
.
getTableType
()
))
{
}
else
if
(
Table
Type
.
VIEW
==
t
.
getTableType
(
))
{
continue
;
continue
;
}
}
set
.
clear
();
set
.
clear
();
...
...
h2/src/main/org/h2/engine/Session.java
浏览文件 @
ff7d9f9a
...
@@ -39,6 +39,7 @@ import org.h2.store.LobStorageFrontend;
...
@@ -39,6 +39,7 @@ import org.h2.store.LobStorageFrontend;
import
org.h2.table.SubQueryInfo
;
import
org.h2.table.SubQueryInfo
;
import
org.h2.table.Table
;
import
org.h2.table.Table
;
import
org.h2.table.TableFilter
;
import
org.h2.table.TableFilter
;
import
org.h2.table.TableType
;
import
org.h2.util.New
;
import
org.h2.util.New
;
import
org.h2.util.SmallLRUCache
;
import
org.h2.util.SmallLRUCache
;
import
org.h2.value.Value
;
import
org.h2.value.Value
;
...
@@ -864,10 +865,10 @@ public class Session extends SessionWithState {
...
@@ -864,10 +865,10 @@ public class Session extends SessionWithState {
int
lockMode
=
database
.
getLockMode
();
int
lockMode
=
database
.
getLockMode
();
if
(
lockMode
!=
Constants
.
LOCK_MODE_OFF
&&
if
(
lockMode
!=
Constants
.
LOCK_MODE_OFF
&&
!
database
.
isMultiVersion
())
{
!
database
.
isMultiVersion
())
{
String
tableType
=
log
.
getTable
().
getTableType
();
TableType
tableType
=
log
.
getTable
().
getTableType
();
if
(
locks
.
indexOf
(
log
.
getTable
())
<
0
if
(
locks
.
indexOf
(
log
.
getTable
())
<
0
&&
!
Table
.
TABLE_LINK
.
equals
(
tableType
)
&&
TableType
.
TABLE_LINK
!=
tableType
&&
!
Table
.
EXTERNAL_TABLE_ENGINE
.
equals
(
tableType
)
)
{
&&
TableType
.
EXTERNAL_TABLE_ENGINE
!=
tableType
)
{
DbException
.
throwInternalError
();
DbException
.
throwInternalError
();
}
}
}
}
...
...
h2/src/main/org/h2/engine/User.java
浏览文件 @
ff7d9f9a
...
@@ -7,7 +7,6 @@ package org.h2.engine;
...
@@ -7,7 +7,6 @@ package org.h2.engine;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.ErrorCode
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.message.Trace
;
import
org.h2.message.Trace
;
...
@@ -16,6 +15,7 @@ import org.h2.security.SHA256;
...
@@ -16,6 +15,7 @@ import org.h2.security.SHA256;
import
org.h2.table.MetaTable
;
import
org.h2.table.MetaTable
;
import
org.h2.table.RangeTable
;
import
org.h2.table.RangeTable
;
import
org.h2.table.Table
;
import
org.h2.table.Table
;
import
org.h2.table.TableType
;
import
org.h2.table.TableView
;
import
org.h2.table.TableView
;
import
org.h2.util.MathUtils
;
import
org.h2.util.MathUtils
;
import
org.h2.util.New
;
import
org.h2.util.New
;
...
@@ -128,8 +128,8 @@ public class User extends RightOwner {
...
@@ -128,8 +128,8 @@ public class User extends RightOwner {
if
(
hasRight
(
null
,
Right
.
ALTER_ANY_SCHEMA
))
{
if
(
hasRight
(
null
,
Right
.
ALTER_ANY_SCHEMA
))
{
return
true
;
return
true
;
}
}
String
tableType
=
table
.
getTableType
();
TableType
tableType
=
table
.
getTableType
();
if
(
Table
.
VIEW
.
equals
(
tableType
)
)
{
if
(
Table
Type
.
VIEW
==
tableType
)
{
TableView
v
=
(
TableView
)
table
;
TableView
v
=
(
TableView
)
table
;
if
(
v
.
getOwner
()
==
this
)
{
if
(
v
.
getOwner
()
==
this
)
{
// the owner of a view has access:
// the owner of a view has access:
...
...
h2/src/main/org/h2/index/IndexCondition.java
浏览文件 @
ff7d9f9a
...
@@ -19,7 +19,7 @@ import org.h2.expression.ExpressionVisitor;
...
@@ -19,7 +19,7 @@ import org.h2.expression.ExpressionVisitor;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.result.ResultInterface
;
import
org.h2.result.ResultInterface
;
import
org.h2.table.Column
;
import
org.h2.table.Column
;
import
org.h2.table.Table
;
import
org.h2.table.Table
Type
;
import
org.h2.util.StatementBuilder
;
import
org.h2.util.StatementBuilder
;
import
org.h2.value.CompareMode
;
import
org.h2.value.CompareMode
;
import
org.h2.value.Value
;
import
org.h2.value.Value
;
...
@@ -248,7 +248,7 @@ public class IndexCondition {
...
@@ -248,7 +248,7 @@ public class IndexCondition {
case
Comparison
.
IN_LIST
:
case
Comparison
.
IN_LIST
:
case
Comparison
.
IN_QUERY
:
case
Comparison
.
IN_QUERY
:
if
(
indexConditions
.
size
()
>
1
)
{
if
(
indexConditions
.
size
()
>
1
)
{
if
(
!
Table
.
TABLE
.
equals
(
column
.
getTable
().
getTableType
()
))
{
if
(
TableType
.
TABLE
!=
column
.
getTable
().
getTableType
(
))
{
// if combined with other conditions,
// if combined with other conditions,
// IN(..) can only be used for regular tables
// IN(..) can only be used for regular tables
// test case:
// test case:
...
...
h2/src/main/org/h2/mvstore/db/MVTable.java
浏览文件 @
ff7d9f9a
...
@@ -11,7 +11,6 @@ import java.util.Collections;
...
@@ -11,7 +11,6 @@ import java.util.Collections;
import
java.util.Comparator
;
import
java.util.Comparator
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
import
org.h2.api.DatabaseEventListener
;
import
org.h2.api.DatabaseEventListener
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.ErrorCode
;
import
org.h2.command.ddl.Analyze
;
import
org.h2.command.ddl.Analyze
;
...
@@ -38,6 +37,7 @@ import org.h2.table.Column;
...
@@ -38,6 +37,7 @@ import org.h2.table.Column;
import
org.h2.table.IndexColumn
;
import
org.h2.table.IndexColumn
;
import
org.h2.table.Table
;
import
org.h2.table.Table
;
import
org.h2.table.TableBase
;
import
org.h2.table.TableBase
;
import
org.h2.table.TableType
;
import
org.h2.util.DebuggingThreadLocal
;
import
org.h2.util.DebuggingThreadLocal
;
import
org.h2.util.MathUtils
;
import
org.h2.util.MathUtils
;
import
org.h2.util.New
;
import
org.h2.util.New
;
...
@@ -744,8 +744,8 @@ public class MVTable extends TableBase {
...
@@ -744,8 +744,8 @@ public class MVTable extends TableBase {
}
}
@Override
@Override
public
String
getTableType
()
{
public
TableType
getTableType
()
{
return
Table
.
TABLE
;
return
Table
Type
.
TABLE
;
}
}
@Override
@Override
...
...
h2/src/main/org/h2/store/PageStore.java
浏览文件 @
ff7d9f9a
...
@@ -11,7 +11,6 @@ import java.util.ArrayList;
...
@@ -11,7 +11,6 @@ import java.util.ArrayList;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.zip.CRC32
;
import
java.util.zip.CRC32
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.ErrorCode
;
import
org.h2.command.CommandInterface
;
import
org.h2.command.CommandInterface
;
import
org.h2.command.ddl.CreateTableData
;
import
org.h2.command.ddl.CreateTableData
;
...
@@ -41,6 +40,7 @@ import org.h2.table.Column;
...
@@ -41,6 +40,7 @@ import org.h2.table.Column;
import
org.h2.table.IndexColumn
;
import
org.h2.table.IndexColumn
;
import
org.h2.table.RegularTable
;
import
org.h2.table.RegularTable
;
import
org.h2.table.Table
;
import
org.h2.table.Table
;
import
org.h2.table.TableType
;
import
org.h2.util.BitField
;
import
org.h2.util.BitField
;
import
org.h2.util.Cache
;
import
org.h2.util.Cache
;
import
org.h2.util.CacheLRU
;
import
org.h2.util.CacheLRU
;
...
@@ -557,7 +557,7 @@ public class PageStore implements CacheWriter {
...
@@ -557,7 +557,7 @@ public class PageStore implements CacheWriter {
recordPageReads
=
true
;
recordPageReads
=
true
;
Session
sysSession
=
database
.
getSystemSession
();
Session
sysSession
=
database
.
getSystemSession
();
for
(
Table
table
:
tables
)
{
for
(
Table
table
:
tables
)
{
if
(!
table
.
isTemporary
()
&&
Table
.
TABLE
.
equals
(
table
.
getTableType
()
))
{
if
(!
table
.
isTemporary
()
&&
Table
Type
.
TABLE
==
table
.
getTableType
(
))
{
Index
scanIndex
=
table
.
getScanIndex
(
sysSession
);
Index
scanIndex
=
table
.
getScanIndex
(
sysSession
);
Cursor
cursor
=
scanIndex
.
find
(
sysSession
,
null
,
null
);
Cursor
cursor
=
scanIndex
.
find
(
sysSession
,
null
,
null
);
while
(
cursor
.
next
())
{
while
(
cursor
.
next
())
{
...
...
h2/src/main/org/h2/table/FunctionTable.java
浏览文件 @
ff7d9f9a
...
@@ -9,7 +9,6 @@ import java.sql.ResultSet;
...
@@ -9,7 +9,6 @@ import java.sql.ResultSet;
import
java.sql.ResultSetMetaData
;
import
java.sql.ResultSetMetaData
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.ErrorCode
;
import
org.h2.engine.Session
;
import
org.h2.engine.Session
;
import
org.h2.expression.Expression
;
import
org.h2.expression.Expression
;
...
@@ -140,7 +139,7 @@ public class FunctionTable extends Table {
...
@@ -140,7 +139,7 @@ public class FunctionTable extends Table {
}
}
@Override
@Override
public
String
getTableType
()
{
public
TableType
getTableType
()
{
return
null
;
return
null
;
}
}
...
...
h2/src/main/org/h2/table/MetaTable.java
浏览文件 @
ff7d9f9a
...
@@ -718,7 +718,7 @@ public class MetaTable extends Table {
...
@@ -718,7 +718,7 @@ public class MetaTable extends Table {
// TABLE_NAME
// TABLE_NAME
tableName
,
tableName
,
// TABLE_TYPE
// TABLE_TYPE
table
.
getTableType
(),
table
.
getTableType
()
.
toString
()
,
// STORAGE_TYPE
// STORAGE_TYPE
storageType
,
storageType
,
// SQL
// SQL
...
@@ -920,11 +920,11 @@ public class MetaTable extends Table {
...
@@ -920,11 +920,11 @@ public class MetaTable extends Table {
break
;
break
;
}
}
case
TABLE_TYPES:
{
case
TABLE_TYPES:
{
add
(
rows
,
Table
.
TABLE
);
add
(
rows
,
Table
Type
.
TABLE
.
toString
()
);
add
(
rows
,
Table
.
TABLE_LINK
);
add
(
rows
,
Table
Type
.
TABLE_LINK
.
toString
()
);
add
(
rows
,
Table
.
SYSTEM_TABLE
);
add
(
rows
,
Table
Type
.
SYSTEM_TABLE
.
toString
()
);
add
(
rows
,
Table
.
VIEW
);
add
(
rows
,
Table
Type
.
VIEW
.
toString
()
);
add
(
rows
,
Table
.
EXTERNAL_TABLE_ENGINE
);
add
(
rows
,
Table
Type
.
EXTERNAL_TABLE_ENGINE
.
toString
()
);
break
;
break
;
}
}
case
CATALOGS:
{
case
CATALOGS:
{
...
@@ -1470,7 +1470,7 @@ public class MetaTable extends Table {
...
@@ -1470,7 +1470,7 @@ public class MetaTable extends Table {
}
}
case
VIEWS:
{
case
VIEWS:
{
for
(
Table
table
:
getAllTables
(
session
))
{
for
(
Table
table
:
getAllTables
(
session
))
{
if
(
!
table
.
getTableType
().
equals
(
Table
.
VIEW
)
)
{
if
(
table
.
getTableType
()
!=
TableType
.
VIEW
)
{
continue
;
continue
;
}
}
String
tableName
=
identifier
(
table
.
getName
());
String
tableName
=
identifier
(
table
.
getName
());
...
@@ -2014,8 +2014,8 @@ public class MetaTable extends Table {
...
@@ -2014,8 +2014,8 @@ public class MetaTable extends Table {
}
}
@Override
@Override
public
String
getTableType
()
{
public
TableType
getTableType
()
{
return
Table
.
SYSTEM_TABLE
;
return
Table
Type
.
SYSTEM_TABLE
;
}
}
@Override
@Override
...
...
h2/src/main/org/h2/table/RangeTable.java
浏览文件 @
ff7d9f9a
...
@@ -6,7 +6,6 @@
...
@@ -6,7 +6,6 @@
package
org
.
h2
.
table
;
package
org
.
h2
.
table
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.ErrorCode
;
import
org.h2.engine.Session
;
import
org.h2.engine.Session
;
import
org.h2.expression.Expression
;
import
org.h2.expression.Expression
;
...
@@ -144,7 +143,7 @@ public class RangeTable extends Table {
...
@@ -144,7 +143,7 @@ public class RangeTable extends Table {
}
}
@Override
@Override
public
String
getTableType
()
{
public
TableType
getTableType
()
{
throw
DbException
.
throwInternalError
();
throw
DbException
.
throwInternalError
();
}
}
...
...
h2/src/main/org/h2/table/RegularTable.java
浏览文件 @
ff7d9f9a
...
@@ -760,8 +760,8 @@ public class RegularTable extends TableBase {
...
@@ -760,8 +760,8 @@ public class RegularTable extends TableBase {
}
}
@Override
@Override
public
String
getTableType
()
{
public
TableType
getTableType
()
{
return
Table
.
TABLE
;
return
Table
Type
.
TABLE
;
}
}
@Override
@Override
...
...
h2/src/main/org/h2/table/Table.java
浏览文件 @
ff7d9f9a
...
@@ -55,31 +55,6 @@ public abstract class Table extends SchemaObjectBase {
...
@@ -55,31 +55,6 @@ public abstract class Table extends SchemaObjectBase {
*/
*/
public
static
final
int
TYPE_MEMORY
=
1
;
public
static
final
int
TYPE_MEMORY
=
1
;
/**
* The table type name for linked tables.
*/
public
static
final
String
TABLE_LINK
=
"TABLE LINK"
;
/**
* The table type name for system tables.
*/
public
static
final
String
SYSTEM_TABLE
=
"SYSTEM TABLE"
;
/**
* The table type name for regular data tables.
*/
public
static
final
String
TABLE
=
"TABLE"
;
/**
* The table type name for views.
*/
public
static
final
String
VIEW
=
"VIEW"
;
/**
* The table type name for external table engines.
*/
public
static
final
String
EXTERNAL_TABLE_ENGINE
=
"EXTERNAL"
;
/**
/**
* The columns of this table.
* The columns of this table.
*/
*/
...
@@ -230,7 +205,7 @@ public abstract class Table extends SchemaObjectBase {
...
@@ -230,7 +205,7 @@ public abstract class Table extends SchemaObjectBase {
*
*
* @return the table type name
* @return the table type name
*/
*/
public
abstract
String
getTableType
();
public
abstract
TableType
getTableType
();
/**
/**
* Get the scan index to iterate through all rows.
* Get the scan index to iterate through all rows.
...
...
h2/src/main/org/h2/table/TableLink.java
浏览文件 @
ff7d9f9a
...
@@ -566,8 +566,8 @@ public class TableLink extends Table {
...
@@ -566,8 +566,8 @@ public class TableLink extends Table {
}
}
@Override
@Override
public
String
getTableType
()
{
public
TableType
getTableType
()
{
return
Table
.
TABLE_LINK
;
return
Table
Type
.
TABLE_LINK
;
}
}
@Override
@Override
...
...
h2/src/main/org/h2/table/TableType.java
0 → 100644
浏览文件 @
ff7d9f9a
/*
* Copyright 2004-2014 H2 Group. Multiple-Licensed under the MPL 2.0,
* and the EPL 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
table
;
public
enum
TableType
{
/**
* The table type name for linked tables.
*/
TABLE_LINK
,
/**
* The table type name for system tables. (aka. MetaTable)
*/
SYSTEM_TABLE
,
/**
* The table type name for regular data tables.
*/
TABLE
,
/**
* The table type name for views.
*/
VIEW
,
/**
* The table type name for external table engines.
*/
EXTERNAL_TABLE_ENGINE
;
@Override
public
String
toString
()
{
if
(
this
==
EXTERNAL_TABLE_ENGINE
)
{
return
"EXTERNAL"
;
}
else
if
(
this
==
SYSTEM_TABLE
)
{
return
"SYSTEM TABLE"
;
}
else
if
(
this
==
TABLE_LINK
)
{
return
"TABLE LINK"
;
}
else
{
return
super
.
toString
();
}
}
}
h2/src/main/org/h2/table/TableView.java
浏览文件 @
ff7d9f9a
...
@@ -404,8 +404,8 @@ public class TableView extends Table {
...
@@ -404,8 +404,8 @@ public class TableView extends Table {
}
}
@Override
@Override
public
String
getTableType
()
{
public
TableType
getTableType
()
{
return
Table
.
VIEW
;
return
Table
Type
.
VIEW
;
}
}
@Override
@Override
...
@@ -615,7 +615,7 @@ public class TableView extends Table {
...
@@ -615,7 +615,7 @@ public class TableView extends Table {
super
.
addDependencies
(
dependencies
);
super
.
addDependencies
(
dependencies
);
if
(
tables
!=
null
)
{
if
(
tables
!=
null
)
{
for
(
Table
t
:
tables
)
{
for
(
Table
t
:
tables
)
{
if
(
!
Table
.
VIEW
.
equals
(
t
.
getTableType
()
))
{
if
(
TableType
.
VIEW
!=
t
.
getTableType
(
))
{
t
.
addDependencies
(
dependencies
);
t
.
addDependencies
(
dependencies
);
}
}
}
}
...
...
h2/src/test/org/h2/test/db/TestTableEngines.java
浏览文件 @
ff7d9f9a
...
@@ -47,6 +47,7 @@ import org.h2.table.SubQueryInfo;
...
@@ -47,6 +47,7 @@ import org.h2.table.SubQueryInfo;
import
org.h2.table.Table
;
import
org.h2.table.Table
;
import
org.h2.table.TableBase
;
import
org.h2.table.TableBase
;
import
org.h2.table.TableFilter
;
import
org.h2.table.TableFilter
;
import
org.h2.table.TableType
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestBase
;
import
org.h2.util.DoneFuture
;
import
org.h2.util.DoneFuture
;
import
org.h2.util.New
;
import
org.h2.util.New
;
...
@@ -1009,8 +1010,8 @@ public class TestTableEngines extends TestBase {
...
@@ -1009,8 +1010,8 @@ public class TestTableEngines extends TestBase {
}
}
@Override
@Override
public
String
getTableType
()
{
public
TableType
getTableType
()
{
return
EXTERNAL_TABLE_ENGINE
;
return
TableType
.
EXTERNAL_TABLE_ENGINE
;
}
}
@Override
@Override
...
@@ -1260,8 +1261,8 @@ public class TestTableEngines extends TestBase {
...
@@ -1260,8 +1261,8 @@ public class TestTableEngines extends TestBase {
}
}
@Override
@Override
public
String
getTableType
()
{
public
TableType
getTableType
()
{
return
EXTERNAL_TABLE_ENGINE
;
return
TableType
.
EXTERNAL_TABLE_ENGINE
;
}
}
@Override
@Override
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论