Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
26b991b4
提交
26b991b4
authored
7 年前
作者:
Niklas Mehner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove unused variable "resolvedTable"
上级
bb06b10c
master
noel-pr1
stumc-Issue#576
version-1.4.198
version-1.4.197
无相关合并请求
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
28 行增加
和
31 行删除
+28
-31
Delete.java
h2/src/main/org/h2/command/dml/Delete.java
+8
-9
Replace.java
h2/src/main/org/h2/command/dml/Replace.java
+5
-6
Update.java
h2/src/main/org/h2/command/dml/Update.java
+15
-16
没有找到文件。
h2/src/main/org/h2/command/dml/Delete.java
浏览文件 @
26b991b4
...
...
@@ -55,9 +55,8 @@ public class Delete extends Prepared {
tableFilter
.
reset
();
Table
table
=
tableFilter
.
getTable
();
session
.
getUser
().
checkRight
(
table
,
Right
.
DELETE
);
Table
resolvedTable
=
table
;
resolvedTable
.
fire
(
session
,
Trigger
.
DELETE
,
true
);
resolvedTable
.
lock
(
session
,
true
,
false
);
table
.
fire
(
session
,
Trigger
.
DELETE
,
true
);
table
.
lock
(
session
,
true
,
false
);
RowList
rows
=
new
RowList
(
session
);
int
limitRows
=
-
1
;
if
(
limitExpr
!=
null
)
{
...
...
@@ -75,8 +74,8 @@ public class Delete extends Prepared {
condition
.
getBooleanValue
(
session
)))
{
Row
row
=
tableFilter
.
get
();
boolean
done
=
false
;
if
(
resolvedT
able
.
fireRow
())
{
done
=
resolvedT
able
.
fireBeforeRow
(
session
,
row
,
null
);
if
(
t
able
.
fireRow
())
{
done
=
t
able
.
fireBeforeRow
(
session
,
row
,
null
);
}
if
(!
done
)
{
rows
.
add
(
row
);
...
...
@@ -93,16 +92,16 @@ public class Delete extends Prepared {
checkCanceled
();
}
Row
row
=
rows
.
next
();
resolvedT
able
.
removeRow
(
session
,
row
);
t
able
.
removeRow
(
session
,
row
);
session
.
log
(
table
,
UndoLogRecord
.
DELETE
,
row
);
}
if
(
resolvedT
able
.
fireRow
())
{
if
(
t
able
.
fireRow
())
{
for
(
rows
.
reset
();
rows
.
hasNext
();)
{
Row
row
=
rows
.
next
();
resolvedT
able
.
fireAfterRow
(
session
,
row
,
null
,
false
);
t
able
.
fireAfterRow
(
session
,
row
,
null
,
false
);
}
}
resolvedT
able
.
fire
(
session
,
Trigger
.
DELETE
,
false
);
t
able
.
fire
(
session
,
Trigger
.
DELETE
,
false
);
return
count
;
}
finally
{
rows
.
close
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/dml/Replace.java
浏览文件 @
26b991b4
...
...
@@ -82,13 +82,12 @@ public class Replace extends Prepared {
session
.
getUser
().
checkRight
(
table
,
Right
.
INSERT
);
session
.
getUser
().
checkRight
(
table
,
Right
.
UPDATE
);
setCurrentRowNumber
(
0
);
Table
resolvedTable
=
table
;
if
(
list
.
size
()
>
0
)
{
count
=
0
;
for
(
int
x
=
0
,
size
=
list
.
size
();
x
<
size
;
x
++)
{
setCurrentRowNumber
(
x
+
1
);
Expression
[]
expr
=
list
.
get
(
x
);
Row
newRow
=
resolvedT
able
.
getTemplateRow
();
Row
newRow
=
t
able
.
getTemplateRow
();
for
(
int
i
=
0
,
len
=
columns
.
length
;
i
<
len
;
i
++)
{
Column
c
=
columns
[
i
];
int
index
=
c
.
getColumnId
();
...
...
@@ -109,12 +108,12 @@ public class Replace extends Prepared {
}
else
{
ResultInterface
rows
=
query
.
query
(
0
);
count
=
0
;
resolvedT
able
.
fire
(
session
,
Trigger
.
UPDATE
|
Trigger
.
INSERT
,
true
);
resolvedT
able
.
lock
(
session
,
true
,
false
);
t
able
.
fire
(
session
,
Trigger
.
UPDATE
|
Trigger
.
INSERT
,
true
);
t
able
.
lock
(
session
,
true
,
false
);
while
(
rows
.
next
())
{
count
++;
Value
[]
r
=
rows
.
currentRow
();
Row
newRow
=
resolvedT
able
.
getTemplateRow
();
Row
newRow
=
t
able
.
getTemplateRow
();
setCurrentRowNumber
(
count
);
for
(
int
j
=
0
;
j
<
columns
.
length
;
j
++)
{
Column
c
=
columns
[
j
];
...
...
@@ -129,7 +128,7 @@ public class Replace extends Prepared {
replace
(
newRow
);
}
rows
.
close
();
resolvedT
able
.
fire
(
session
,
Trigger
.
UPDATE
|
Trigger
.
INSERT
,
false
);
t
able
.
fire
(
session
,
Trigger
.
UPDATE
|
Trigger
.
INSERT
,
false
);
}
return
count
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/dml/Update.java
浏览文件 @
26b991b4
...
...
@@ -85,14 +85,13 @@ public class Update extends Prepared {
try
{
Table
table
=
tableFilter
.
getTable
();
session
.
getUser
().
checkRight
(
table
,
Right
.
UPDATE
);
Table
resolvedTable
=
table
;
resolvedTable
.
fire
(
session
,
Trigger
.
UPDATE
,
true
);
resolvedTable
.
lock
(
session
,
true
,
false
);
int
columnCount
=
resolvedTable
.
getColumns
().
length
;
table
.
fire
(
session
,
Trigger
.
UPDATE
,
true
);
table
.
lock
(
session
,
true
,
false
);
int
columnCount
=
table
.
getColumns
().
length
;
// get the old rows, compute the new rows
setCurrentRowNumber
(
0
);
int
count
=
0
;
Column
[]
columns
=
resolvedT
able
.
getColumns
();
Column
[]
columns
=
t
able
.
getColumns
();
int
limitRows
=
-
1
;
if
(
limitExpr
!=
null
)
{
Value
v
=
limitExpr
.
getValue
(
session
);
...
...
@@ -108,25 +107,25 @@ public class Update extends Prepared {
if
(
condition
==
null
||
Boolean
.
TRUE
.
equals
(
condition
.
getBooleanValue
(
session
)))
{
Row
oldRow
=
tableFilter
.
get
();
Row
newRow
=
resolvedT
able
.
getTemplateRow
();
Row
newRow
=
t
able
.
getTemplateRow
();
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
Expression
newExpr
=
expressionMap
.
get
(
columns
[
i
]);
Value
newValue
;
if
(
newExpr
==
null
)
{
newValue
=
oldRow
.
getValue
(
i
);
}
else
if
(
newExpr
==
ValueExpression
.
getDefault
())
{
Column
column
=
resolvedT
able
.
getColumn
(
i
);
newValue
=
resolvedT
able
.
getDefaultValue
(
session
,
column
);
Column
column
=
t
able
.
getColumn
(
i
);
newValue
=
t
able
.
getDefaultValue
(
session
,
column
);
}
else
{
Column
column
=
resolvedT
able
.
getColumn
(
i
);
Column
column
=
t
able
.
getColumn
(
i
);
newValue
=
column
.
convert
(
newExpr
.
getValue
(
session
));
}
newRow
.
setValue
(
i
,
newValue
);
}
resolvedT
able
.
validateConvertUpdateSequence
(
session
,
newRow
);
t
able
.
validateConvertUpdateSequence
(
session
,
newRow
);
boolean
done
=
false
;
if
(
resolvedT
able
.
fireRow
())
{
done
=
resolvedT
able
.
fireBeforeRow
(
session
,
oldRow
,
newRow
);
if
(
t
able
.
fireRow
())
{
done
=
t
able
.
fireBeforeRow
(
session
,
oldRow
,
newRow
);
}
if
(!
done
)
{
rows
.
add
(
oldRow
);
...
...
@@ -143,16 +142,16 @@ public class Update extends Prepared {
// we need to update all indexes) before row triggers
// the cached row is already updated - we need the old values
resolvedT
able
.
updateRows
(
this
,
session
,
rows
);
if
(
resolvedT
able
.
fireRow
())
{
t
able
.
updateRows
(
this
,
session
,
rows
);
if
(
t
able
.
fireRow
())
{
rows
.
invalidateCache
();
for
(
rows
.
reset
();
rows
.
hasNext
();)
{
Row
o
=
rows
.
next
();
Row
n
=
rows
.
next
();
resolvedT
able
.
fireAfterRow
(
session
,
o
,
n
,
false
);
t
able
.
fireAfterRow
(
session
,
o
,
n
,
false
);
}
}
resolvedT
able
.
fire
(
session
,
Trigger
.
UPDATE
,
false
);
t
able
.
fire
(
session
,
Trigger
.
UPDATE
,
false
);
return
count
;
}
finally
{
rows
.
close
();
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论