Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
5aa56d98
提交
5aa56d98
authored
5月 23, 2016
作者:
Noel Grandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
readIfNoExists->readIfNotExists
上级
a6ec7f8f
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
17 行增加
和
18 行删除
+17
-18
Parser.java
h2/src/main/org/h2/command/Parser.java
+17
-18
没有找到文件。
h2/src/main/org/h2/command/Parser.java
浏览文件 @
5aa56d98
...
@@ -16,7 +16,6 @@ import java.util.ArrayList;
...
@@ -16,7 +16,6 @@ import java.util.ArrayList;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.Comparator
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.Trigger
;
import
org.h2.api.Trigger
;
import
org.h2.command.ddl.AlterIndexRename
;
import
org.h2.command.ddl.AlterIndexRename
;
...
@@ -4248,7 +4247,7 @@ public class Parser {
...
@@ -4248,7 +4247,7 @@ public class Parser {
}
}
primaryKey
=
true
;
primaryKey
=
true
;
if
(!
isToken
(
"ON"
))
{
if
(!
isToken
(
"ON"
))
{
ifNotExists
=
readIfNoExists
();
ifNotExists
=
readIfNo
t
Exists
();
indexName
=
readIdentifierWithSchema
(
null
);
indexName
=
readIdentifierWithSchema
(
null
);
oldSchema
=
getSchema
();
oldSchema
=
getSchema
();
}
}
...
@@ -4264,7 +4263,7 @@ public class Parser {
...
@@ -4264,7 +4263,7 @@ public class Parser {
}
}
if
(
readIf
(
"INDEX"
))
{
if
(
readIf
(
"INDEX"
))
{
if
(!
isToken
(
"ON"
))
{
if
(!
isToken
(
"ON"
))
{
ifNotExists
=
readIfNoExists
();
ifNotExists
=
readIfNo
t
Exists
();
indexName
=
readIdentifierWithSchema
(
null
);
indexName
=
readIdentifierWithSchema
(
null
);
oldSchema
=
getSchema
();
oldSchema
=
getSchema
();
}
}
...
@@ -4480,14 +4479,14 @@ public class Parser {
...
@@ -4480,14 +4479,14 @@ public class Parser {
private
CreateRole
parseCreateRole
()
{
private
CreateRole
parseCreateRole
()
{
CreateRole
command
=
new
CreateRole
(
session
);
CreateRole
command
=
new
CreateRole
(
session
);
command
.
setIfNotExists
(
readIfNoExists
());
command
.
setIfNotExists
(
readIfNo
t
Exists
());
command
.
setRoleName
(
readUniqueIdentifier
());
command
.
setRoleName
(
readUniqueIdentifier
());
return
command
;
return
command
;
}
}
private
CreateSchema
parseCreateSchema
()
{
private
CreateSchema
parseCreateSchema
()
{
CreateSchema
command
=
new
CreateSchema
(
session
);
CreateSchema
command
=
new
CreateSchema
(
session
);
command
.
setIfNotExists
(
readIfNoExists
());
command
.
setIfNotExists
(
readIfNo
t
Exists
());
command
.
setSchemaName
(
readUniqueIdentifier
());
command
.
setSchemaName
(
readUniqueIdentifier
());
if
(
readIf
(
"AUTHORIZATION"
))
{
if
(
readIf
(
"AUTHORIZATION"
))
{
command
.
setAuthorization
(
readUniqueIdentifier
());
command
.
setAuthorization
(
readUniqueIdentifier
());
...
@@ -4498,7 +4497,7 @@ public class Parser {
...
@@ -4498,7 +4497,7 @@ public class Parser {
}
}
private
CreateSequence
parseCreateSequence
()
{
private
CreateSequence
parseCreateSequence
()
{
boolean
ifNotExists
=
readIfNoExists
();
boolean
ifNotExists
=
readIfNo
t
Exists
();
String
sequenceName
=
readIdentifierWithSchema
();
String
sequenceName
=
readIdentifierWithSchema
();
CreateSequence
command
=
new
CreateSequence
(
session
,
getSchema
());
CreateSequence
command
=
new
CreateSequence
(
session
,
getSchema
());
command
.
setIfNotExists
(
ifNotExists
);
command
.
setIfNotExists
(
ifNotExists
);
...
@@ -4547,7 +4546,7 @@ public class Parser {
...
@@ -4547,7 +4546,7 @@ public class Parser {
return
command
;
return
command
;
}
}
private
boolean
readIfNoExists
()
{
private
boolean
readIfNo
t
Exists
()
{
if
(
readIf
(
"IF"
))
{
if
(
readIf
(
"IF"
))
{
read
(
"NOT"
);
read
(
"NOT"
);
read
(
"EXISTS"
);
read
(
"EXISTS"
);
...
@@ -4557,7 +4556,7 @@ public class Parser {
...
@@ -4557,7 +4556,7 @@ public class Parser {
}
}
private
CreateConstant
parseCreateConstant
()
{
private
CreateConstant
parseCreateConstant
()
{
boolean
ifNotExists
=
readIfNoExists
();
boolean
ifNotExists
=
readIfNo
t
Exists
();
String
constantName
=
readIdentifierWithSchema
();
String
constantName
=
readIdentifierWithSchema
();
Schema
schema
=
getSchema
();
Schema
schema
=
getSchema
();
if
(
isKeyword
(
constantName
))
{
if
(
isKeyword
(
constantName
))
{
...
@@ -4574,7 +4573,7 @@ public class Parser {
...
@@ -4574,7 +4573,7 @@ public class Parser {
}
}
private
CreateAggregate
parseCreateAggregate
(
boolean
force
)
{
private
CreateAggregate
parseCreateAggregate
(
boolean
force
)
{
boolean
ifNotExists
=
readIfNoExists
();
boolean
ifNotExists
=
readIfNo
t
Exists
();
CreateAggregate
command
=
new
CreateAggregate
(
session
);
CreateAggregate
command
=
new
CreateAggregate
(
session
);
command
.
setForce
(
force
);
command
.
setForce
(
force
);
String
name
=
readIdentifierWithSchema
();
String
name
=
readIdentifierWithSchema
();
...
@@ -4592,7 +4591,7 @@ public class Parser {
...
@@ -4592,7 +4591,7 @@ public class Parser {
}
}
private
CreateUserDataType
parseCreateUserDataType
()
{
private
CreateUserDataType
parseCreateUserDataType
()
{
boolean
ifNotExists
=
readIfNoExists
();
boolean
ifNotExists
=
readIfNo
t
Exists
();
CreateUserDataType
command
=
new
CreateUserDataType
(
session
);
CreateUserDataType
command
=
new
CreateUserDataType
(
session
);
command
.
setTypeName
(
readUniqueIdentifier
());
command
.
setTypeName
(
readUniqueIdentifier
());
read
(
"AS"
);
read
(
"AS"
);
...
@@ -4608,7 +4607,7 @@ public class Parser {
...
@@ -4608,7 +4607,7 @@ public class Parser {
}
}
private
CreateTrigger
parseCreateTrigger
(
boolean
force
)
{
private
CreateTrigger
parseCreateTrigger
(
boolean
force
)
{
boolean
ifNotExists
=
readIfNoExists
();
boolean
ifNotExists
=
readIfNo
t
Exists
();
String
triggerName
=
readIdentifierWithSchema
(
null
);
String
triggerName
=
readIdentifierWithSchema
(
null
);
Schema
schema
=
getSchema
();
Schema
schema
=
getSchema
();
boolean
insteadOf
,
isBefore
;
boolean
insteadOf
,
isBefore
;
...
@@ -4675,7 +4674,7 @@ public class Parser {
...
@@ -4675,7 +4674,7 @@ public class Parser {
private
CreateUser
parseCreateUser
()
{
private
CreateUser
parseCreateUser
()
{
CreateUser
command
=
new
CreateUser
(
session
);
CreateUser
command
=
new
CreateUser
(
session
);
command
.
setIfNotExists
(
readIfNoExists
());
command
.
setIfNotExists
(
readIfNo
t
Exists
());
command
.
setUserName
(
readUniqueIdentifier
());
command
.
setUserName
(
readUniqueIdentifier
());
command
.
setComment
(
readCommentIf
());
command
.
setComment
(
readCommentIf
());
if
(
readIf
(
"PASSWORD"
))
{
if
(
readIf
(
"PASSWORD"
))
{
...
@@ -4699,7 +4698,7 @@ public class Parser {
...
@@ -4699,7 +4698,7 @@ public class Parser {
}
}
private
CreateFunctionAlias
parseCreateFunctionAlias
(
boolean
force
)
{
private
CreateFunctionAlias
parseCreateFunctionAlias
(
boolean
force
)
{
boolean
ifNotExists
=
readIfNoExists
();
boolean
ifNotExists
=
readIfNo
t
Exists
();
String
aliasName
=
readIdentifierWithSchema
();
String
aliasName
=
readIdentifierWithSchema
();
if
(
isKeyword
(
aliasName
)
||
if
(
isKeyword
(
aliasName
)
||
Function
.
getFunction
(
database
,
aliasName
)
!=
null
||
Function
.
getFunction
(
database
,
aliasName
)
!=
null
||
...
@@ -4787,7 +4786,7 @@ public class Parser {
...
@@ -4787,7 +4786,7 @@ public class Parser {
}
}
private
CreateView
parseCreateView
(
boolean
force
,
boolean
orReplace
)
{
private
CreateView
parseCreateView
(
boolean
force
,
boolean
orReplace
)
{
boolean
ifNotExists
=
readIfNoExists
();
boolean
ifNotExists
=
readIfNo
t
Exists
();
String
viewName
=
readIdentifierWithSchema
();
String
viewName
=
readIdentifierWithSchema
();
CreateView
command
=
new
CreateView
(
session
,
getSchema
());
CreateView
command
=
new
CreateView
(
session
,
getSchema
());
this
.
createView
=
command
;
this
.
createView
=
command
;
...
@@ -5717,7 +5716,7 @@ public class Parser {
...
@@ -5717,7 +5716,7 @@ public class Parser {
read
(
")"
);
read
(
")"
);
command
.
setNewColumns
(
columnsToAdd
);
command
.
setNewColumns
(
columnsToAdd
);
}
else
{
}
else
{
boolean
ifNotExists
=
readIfNoExists
();
boolean
ifNotExists
=
readIfNo
t
Exists
();
command
.
setIfNotExists
(
ifNotExists
);
command
.
setIfNotExists
(
ifNotExists
);
String
columnName
=
readColumnIdentifier
();
String
columnName
=
readColumnIdentifier
();
Column
column
=
parseColumnForTable
(
columnName
,
true
);
Column
column
=
parseColumnForTable
(
columnName
,
true
);
...
@@ -5765,7 +5764,7 @@ public class Parser {
...
@@ -5765,7 +5764,7 @@ public class Parser {
boolean
ifNotExists
=
false
;
boolean
ifNotExists
=
false
;
boolean
allowIndexDefinition
=
database
.
getMode
().
indexDefinitionInCreateTable
;
boolean
allowIndexDefinition
=
database
.
getMode
().
indexDefinitionInCreateTable
;
if
(
readIf
(
"CONSTRAINT"
))
{
if
(
readIf
(
"CONSTRAINT"
))
{
ifNotExists
=
readIfNoExists
();
ifNotExists
=
readIfNo
t
Exists
();
constraintName
=
readIdentifierWithSchema
(
schema
.
getName
());
constraintName
=
readIdentifierWithSchema
(
schema
.
getName
());
checkSchema
(
schema
);
checkSchema
(
schema
);
comment
=
readCommentIf
();
comment
=
readCommentIf
();
...
@@ -5904,7 +5903,7 @@ public class Parser {
...
@@ -5904,7 +5903,7 @@ public class Parser {
private
CreateLinkedTable
parseCreateLinkedTable
(
boolean
temp
,
private
CreateLinkedTable
parseCreateLinkedTable
(
boolean
temp
,
boolean
globalTemp
,
boolean
force
)
{
boolean
globalTemp
,
boolean
force
)
{
read
(
"TABLE"
);
read
(
"TABLE"
);
boolean
ifNotExists
=
readIfNoExists
();
boolean
ifNotExists
=
readIfNo
t
Exists
();
String
tableName
=
readIdentifierWithSchema
();
String
tableName
=
readIdentifierWithSchema
();
CreateLinkedTable
command
=
new
CreateLinkedTable
(
session
,
getSchema
());
CreateLinkedTable
command
=
new
CreateLinkedTable
(
session
,
getSchema
());
command
.
setTemporary
(
temp
);
command
.
setTemporary
(
temp
);
...
@@ -5940,7 +5939,7 @@ public class Parser {
...
@@ -5940,7 +5939,7 @@ public class Parser {
private
CreateTable
parseCreateTable
(
boolean
temp
,
boolean
globalTemp
,
private
CreateTable
parseCreateTable
(
boolean
temp
,
boolean
globalTemp
,
boolean
persistIndexes
)
{
boolean
persistIndexes
)
{
boolean
ifNotExists
=
readIfNoExists
();
boolean
ifNotExists
=
readIfNo
t
Exists
();
String
tableName
=
readIdentifierWithSchema
();
String
tableName
=
readIdentifierWithSchema
();
if
(
temp
&&
globalTemp
&&
equalsToken
(
"SESSION"
,
schemaName
))
{
if
(
temp
&&
globalTemp
&&
equalsToken
(
"SESSION"
,
schemaName
))
{
// support weird syntax: declare global temporary table session.xy
// support weird syntax: declare global temporary table session.xy
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论