Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
b235890e
提交
b235890e
authored
7月 02, 2017
作者:
Niklas Mehner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Incorporate "easy to fix" review comments
上级
c7be5be2
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
11 行增加
和
20 行删除
+11
-20
CreateSynonym.java
h2/src/main/org/h2/command/ddl/CreateSynonym.java
+1
-0
FunctionSynonym.java
h2/src/main/org/h2/engine/FunctionSynonym.java
+0
-7
Schema.java
h2/src/main/org/h2/schema/Schema.java
+4
-4
TableSynonym.java
h2/src/main/org/h2/table/TableSynonym.java
+2
-7
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+2
-0
TestSynonymForTable.java
h2/src/test/org/h2/test/db/TestSynonymForTable.java
+2
-2
没有找到文件。
h2/src/main/org/h2/command/ddl/CreateSynonym.java
浏览文件 @
b235890e
...
...
@@ -82,6 +82,7 @@ public class CreateSynonym extends SchemaCommand {
table
=
(
TableSynonym
)
old
;
data
.
schema
=
table
.
getSchema
();
table
.
updateData
(
data
);
table
.
setComment
(
comment
);
table
.
setModified
();
}
else
{
data
.
id
=
getObjectId
();
...
...
h2/src/main/org/h2/engine/FunctionSynonym.java
deleted
100644 → 0
浏览文件 @
c7be5be2
package
org
.
h2
.
engine
;
/**
* Created by jiriki on 24.04.16.
*/
public
class
FunctionSynonym
{
}
h2/src/main/org/h2/schema/Schema.java
浏览文件 @
b235890e
...
...
@@ -236,12 +236,12 @@ public class Schema extends DbObjectBase {
*/
public
void
add
(
SchemaObject
obj
)
{
if
(
SysProperties
.
CHECK
&&
obj
.
getSchema
()
!=
this
)
{
throw
DbException
.
throwInternalError
(
"wrong schema"
);
DbException
.
throwInternalError
(
"wrong schema"
);
}
String
name
=
obj
.
getName
();
Map
<
String
,
SchemaObject
>
map
=
getMap
(
obj
.
getType
());
if
(
SysProperties
.
CHECK
&&
map
.
get
(
name
)
!=
null
)
{
throw
DbException
.
throwInternalError
(
"object already exists: "
+
name
);
DbException
.
throwInternalError
(
"object already exists: "
+
name
);
}
map
.
put
(
name
,
obj
);
freeUniqueName
(
name
);
...
...
@@ -258,10 +258,10 @@ public class Schema extends DbObjectBase {
Map
<
String
,
SchemaObject
>
map
=
getMap
(
type
);
if
(
SysProperties
.
CHECK
)
{
if
(!
map
.
containsKey
(
obj
.
getName
()))
{
throw
DbException
.
throwInternalError
(
"not found: "
+
obj
.
getName
());
DbException
.
throwInternalError
(
"not found: "
+
obj
.
getName
());
}
if
(
obj
.
getName
().
equals
(
newName
)
||
map
.
containsKey
(
newName
))
{
throw
DbException
.
throwInternalError
(
"object already exists: "
+
newName
);
DbException
.
throwInternalError
(
"object already exists: "
+
newName
);
}
}
obj
.
checkRename
();
...
...
h2/src/main/org/h2/table/TableSynonym.java
浏览文件 @
b235890e
...
...
@@ -12,7 +12,7 @@ import java.util.ArrayList;
import
java.util.HashSet
;
/**
* Sy
s
onym for an existing table or view. All DML requests are forwarded to the backing table. Adding indices
* Sy
n
onym for an existing table or view. All DML requests are forwarded to the backing table. Adding indices
* to a synonym or altering the table is not supported.
*/
public
class
TableSynonym
extends
Table
{
...
...
@@ -182,12 +182,7 @@ public class TableSynonym extends Table {
}
public
boolean
isInvalid
()
{
try
{
getSynonymFor
();
return
false
;
}
catch
(
DbException
e
)
{
return
true
;
}
return
data
.
synonymForSchema
.
findTableOrView
(
data
.
session
,
data
.
synonymFor
)
!=
null
;
}
}
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
b235890e
...
...
@@ -72,6 +72,7 @@ import org.h2.test.db.TestShow;
import
org.h2.test.db.TestSpaceReuse
;
import
org.h2.test.db.TestSpatial
;
import
org.h2.test.db.TestSpeed
;
import
org.h2.test.db.TestSynonymForTable
;
import
org.h2.test.db.TestTableEngines
;
import
org.h2.test.db.TestTempTables
;
import
org.h2.test.db.TestTransaction
;
...
...
@@ -761,6 +762,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
addTest
(
new
TestViewAlterTable
());
addTest
(
new
TestViewDropView
());
addTest
(
new
TestReplace
());
addTest
(
new
TestSynonymForTable
());
// jaqu
addTest
(
new
AliasMapTest
());
...
...
h2/src/test/org/h2/test/db/TestSynonymForTable.java
浏览文件 @
b235890e
...
...
@@ -91,7 +91,7 @@ public class TestSynonymForTable extends TestBase {
assertEquals
(
"INVALID"
,
synonyms
.
getString
(
"STATUS"
));
conn
.
close
();
// Reopen
d
ing should work with invalid synonym
// Reopening should work with invalid synonym
Connection
conn2
=
getConnection
(
"synonym"
);
assertThrows
(
JdbcSQLException
.
class
,
stat
).
execute
(
"SELECT id FROM testsynonym"
);
conn2
.
close
();
...
...
@@ -110,7 +110,7 @@ public class TestSynonymForTable extends TestBase {
// Dropping with "if exists" should succeed even if the synonym does not exist anymore.
stat
.
execute
(
"DROP SYNONYM IF EXISTS testsynonym"
);
// Without "if exists" the command should fail.
// Without "if exists" the command should fail
if the synonym does not exist
.
assertThrows
(
JdbcSQLException
.
class
,
stat
).
execute
(
"DROP SYNONYM testsynonym"
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论