Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
ed7740d3
提交
ed7740d3
authored
1月 23, 2010
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Triggers: INSTEAD OF triggers are now supported.
上级
4f50daa8
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
50 行增加
和
21 行删除
+50
-21
Parser.java
h2/src/main/org/h2/command/Parser.java
+13
-2
CreateTrigger.java
h2/src/main/org/h2/command/ddl/CreateTrigger.java
+6
-0
Delete.java
h2/src/main/org/h2/command/dml/Delete.java
+5
-2
Insert.java
h2/src/main/org/h2/command/dml/Insert.java
+13
-9
Merge.java
h2/src/main/org/h2/command/dml/Merge.java
+7
-5
Update.java
h2/src/main/org/h2/command/dml/Update.java
+6
-3
没有找到文件。
h2/src/main/org/h2/command/Parser.java
浏览文件 @
ed7740d3
...
...
@@ -3105,6 +3105,10 @@ public class Parser {
if
(
len
==
0
)
{
throw
getSyntaxError
();
}
if
(!
identifiersToUpper
)
{
// if not yet converted to uppercase, do it now
s
=
StringUtils
.
toUpperEnglish
(
s
);
}
return
getSaveTokenType
(
s
,
database
.
getMode
().
supportOffsetFetch
);
}
...
...
@@ -3732,11 +3736,17 @@ public class Parser {
boolean
ifNotExists
=
readIfNoExists
();
String
triggerName
=
readIdentifierWithSchema
(
null
);
Schema
schema
=
getSchema
();
boolean
isBefore
;
if
(
readIf
(
"BEFORE"
))
{
boolean
insteadOf
,
isBefore
;
if
(
readIf
(
"INSTEAD"
))
{
read
(
"OF"
);
isBefore
=
true
;
insteadOf
=
true
;
}
else
if
(
readIf
(
"BEFORE"
))
{
insteadOf
=
false
;
isBefore
=
true
;
}
else
{
read
(
"AFTER"
);
insteadOf
=
false
;
isBefore
=
false
;
}
int
typeMask
=
0
;
...
...
@@ -3763,6 +3773,7 @@ public class Parser {
command
.
setForce
(
force
);
command
.
setTriggerName
(
triggerName
);
command
.
setIfNotExists
(
ifNotExists
);
command
.
setInsteadOf
(
insteadOf
);
command
.
setBefore
(
isBefore
);
command
.
setOnRollback
(
onRollback
);
command
.
setTypeMask
(
typeMask
);
...
...
h2/src/main/org/h2/command/ddl/CreateTrigger.java
浏览文件 @
ed7740d3
...
...
@@ -25,6 +25,7 @@ public class CreateTrigger extends SchemaCommand {
private
String
triggerName
;
private
boolean
ifNotExists
;
private
boolean
insteadOf
;
private
boolean
before
;
private
int
typeMask
;
private
boolean
rowBased
;
...
...
@@ -39,6 +40,10 @@ public class CreateTrigger extends SchemaCommand {
super
(
session
,
schema
);
}
public
void
setInsteadOf
(
boolean
insteadOf
)
{
this
.
insteadOf
=
insteadOf
;
}
public
void
setBefore
(
boolean
before
)
{
this
.
before
=
before
;
}
...
...
@@ -87,6 +92,7 @@ public class CreateTrigger extends SchemaCommand {
int
id
=
getObjectId
(
false
,
true
);
Table
table
=
getSchema
().
getTableOrView
(
session
,
tableName
);
TriggerObject
trigger
=
new
TriggerObject
(
getSchema
(),
id
,
triggerName
,
table
);
trigger
.
setInsteadOf
(
insteadOf
);
trigger
.
setBefore
(
before
);
trigger
.
setNoWait
(
noWait
);
trigger
.
setQueueSize
(
queueSize
);
...
...
h2/src/main/org/h2/command/dml/Delete.java
浏览文件 @
ed7740d3
...
...
@@ -56,10 +56,13 @@ public class Delete extends Prepared {
setCurrentRowNumber
(
rows
.
size
()
+
1
);
if
(
condition
==
null
||
Boolean
.
TRUE
.
equals
(
condition
.
getBooleanValue
(
session
)))
{
Row
row
=
tableFilter
.
get
();
boolean
done
=
false
;
if
(
table
.
fireRow
())
{
table
.
fireBeforeRow
(
session
,
row
,
null
);
done
=
table
.
fireBeforeRow
(
session
,
row
,
null
);
}
if
(!
done
)
{
rows
.
add
(
row
);
}
rows
.
add
(
row
);
}
}
int
rowScanCount
=
0
;
...
...
h2/src/main/org/h2/command/dml/Insert.java
浏览文件 @
ed7740d3
...
...
@@ -114,11 +114,13 @@ public class Insert extends Prepared {
}
}
table
.
validateConvertUpdateSequence
(
session
,
newRow
);
table
.
fireBeforeRow
(
session
,
null
,
newRow
);
table
.
lock
(
session
,
true
,
false
);
table
.
addRow
(
session
,
newRow
);
session
.
log
(
table
,
UndoLogRecord
.
INSERT
,
newRow
);
table
.
fireAfterRow
(
session
,
null
,
newRow
,
false
);
boolean
done
=
table
.
fireBeforeRow
(
session
,
null
,
newRow
);
if
(!
done
)
{
table
.
lock
(
session
,
true
,
false
);
table
.
addRow
(
session
,
newRow
);
session
.
log
(
table
,
UndoLogRecord
.
INSERT
,
newRow
);
table
.
fireAfterRow
(
session
,
null
,
newRow
,
false
);
}
count
++;
}
}
else
{
...
...
@@ -141,10 +143,12 @@ public class Insert extends Prepared {
}
}
table
.
validateConvertUpdateSequence
(
session
,
newRow
);
table
.
fireBeforeRow
(
session
,
null
,
newRow
);
table
.
addRow
(
session
,
newRow
);
session
.
log
(
table
,
UndoLogRecord
.
INSERT
,
newRow
);
table
.
fireAfterRow
(
session
,
null
,
newRow
,
false
);
boolean
done
=
table
.
fireBeforeRow
(
session
,
null
,
newRow
);
if
(!
done
)
{
table
.
addRow
(
session
,
newRow
);
session
.
log
(
table
,
UndoLogRecord
.
INSERT
,
newRow
);
table
.
fireAfterRow
(
session
,
null
,
newRow
,
false
);
}
}
rows
.
close
();
}
...
...
h2/src/main/org/h2/command/dml/Merge.java
浏览文件 @
ed7740d3
...
...
@@ -175,11 +175,13 @@ public class Merge extends Prepared {
if
(
count
==
0
)
{
try
{
table
.
validateConvertUpdateSequence
(
session
,
row
);
table
.
fireBeforeRow
(
session
,
null
,
row
);
table
.
lock
(
session
,
true
,
false
);
table
.
addRow
(
session
,
row
);
session
.
log
(
table
,
UndoLogRecord
.
INSERT
,
row
);
table
.
fireAfterRow
(
session
,
null
,
row
,
false
);
boolean
done
=
table
.
fireBeforeRow
(
session
,
null
,
row
);
if
(!
done
)
{
table
.
lock
(
session
,
true
,
false
);
table
.
addRow
(
session
,
row
);
session
.
log
(
table
,
UndoLogRecord
.
INSERT
,
row
);
table
.
fireAfterRow
(
session
,
null
,
row
,
false
);
}
}
catch
(
SQLException
e
)
{
if
(
e
.
getErrorCode
()
==
ErrorCode
.
DUPLICATE_KEY_1
)
{
// concurrent merge or insert
...
...
h2/src/main/org/h2/command/dml/Update.java
浏览文件 @
ed7740d3
...
...
@@ -104,11 +104,14 @@ public class Update extends Prepared {
newRow
.
setValue
(
i
,
newValue
);
}
table
.
validateConvertUpdateSequence
(
session
,
newRow
);
boolean
done
=
false
;
if
(
table
.
fireRow
())
{
table
.
fireBeforeRow
(
session
,
oldRow
,
newRow
);
done
=
table
.
fireBeforeRow
(
session
,
oldRow
,
newRow
);
}
if
(!
done
)
{
rows
.
add
(
oldRow
);
rows
.
add
(
newRow
);
}
rows
.
add
(
oldRow
);
rows
.
add
(
newRow
);
count
++;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论