Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
d5847eb1
Commit
d5847eb1
authored
Feb 19, 2008
by
davi@endora.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into mysql.com:/Users/davi/mysql/mysql-5.1-runtime
parents
72495c96
84a0d7c5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
17 deletions
+88
-17
mysql-test/r/trigger.result
mysql-test/r/trigger.result
+38
-0
mysql-test/t/trigger.test
mysql-test/t/trigger.test
+33
-0
sql/sql_update.cc
sql/sql_update.cc
+17
-17
No files found.
mysql-test/r/trigger.result
View file @
d5847eb1
...
@@ -2016,4 +2016,42 @@ i j
...
@@ -2016,4 +2016,42 @@ i j
10 10
10 10
unlock tables;
unlock tables;
drop table t1;
drop table t1;
drop table if exists t1, t2;
drop trigger if exists trg1;
drop trigger if exists trg2;
create table t1 (a int);
create table t2 (b int);
create trigger trg1 after update on t1 for each row set @a= @a+1;
create trigger trg2 after update on t2 for each row set @b= @b+1;
insert into t1 values (1), (2), (3);
insert into t2 values (1), (2), (3);
set @a= 0;
set @b= 0;
update t1, t2 set t1.a= t1.a, t2.b= t2.b;
select @a, @b;
@a @b
3 3
update t1, t2 set t1.a= t2.b, t2.b= t1.a;
select @a, @b;
@a @b
6 6
update t1 set a= a;
select @a, @b;
@a @b
9 6
update t2 set b= b;
select @a, @b;
@a @b
9 9
update t1 set a= 1;
select @a, @b;
@a @b
12 9
update t2 set b= 1;
select @a, @b;
@a @b
12 12
drop trigger trg1;
drop trigger trg2;
drop table t1, t2;
End of 5.1 tests.
End of 5.1 tests.
mysql-test/t/trigger.test
View file @
d5847eb1
...
@@ -2304,4 +2304,37 @@ unlock tables;
...
@@ -2304,4 +2304,37 @@ unlock tables;
drop
table
t1
;
drop
table
t1
;
#
# Bug#23771 AFTER UPDATE trigger not invoked when there are no changes of the data
#
--
disable_warnings
drop
table
if
exists
t1
,
t2
;
drop
trigger
if
exists
trg1
;
drop
trigger
if
exists
trg2
;
--
enable_warnings
create
table
t1
(
a
int
);
create
table
t2
(
b
int
);
create
trigger
trg1
after
update
on
t1
for
each
row
set
@
a
=
@
a
+
1
;
create
trigger
trg2
after
update
on
t2
for
each
row
set
@
b
=
@
b
+
1
;
insert
into
t1
values
(
1
),
(
2
),
(
3
);
insert
into
t2
values
(
1
),
(
2
),
(
3
);
set
@
a
=
0
;
set
@
b
=
0
;
update
t1
,
t2
set
t1
.
a
=
t1
.
a
,
t2
.
b
=
t2
.
b
;
select
@
a
,
@
b
;
update
t1
,
t2
set
t1
.
a
=
t2
.
b
,
t2
.
b
=
t1
.
a
;
select
@
a
,
@
b
;
update
t1
set
a
=
a
;
select
@
a
,
@
b
;
update
t2
set
b
=
b
;
select
@
a
,
@
b
;
update
t1
set
a
=
1
;
select
@
a
,
@
b
;
update
t2
set
b
=
1
;
select
@
a
,
@
b
;
drop
trigger
trg1
;
drop
trigger
trg2
;
drop
table
t1
,
t2
;
--
echo
End
of
5.1
tests
.
--
echo
End
of
5.1
tests
.
sql/sql_update.cc
View file @
d5847eb1
...
@@ -643,14 +643,6 @@ int mysql_update(THD *thd,
...
@@ -643,14 +643,6 @@ int mysql_update(THD *thd,
updated
++
;
updated
++
;
else
else
error
=
0
;
error
=
0
;
if
(
table
->
triggers
&&
table
->
triggers
->
process_triggers
(
thd
,
TRG_EVENT_UPDATE
,
TRG_ACTION_AFTER
,
TRUE
))
{
error
=
1
;
break
;
}
}
}
else
if
(
!
ignore
||
else
if
(
!
ignore
||
table
->
file
->
is_fatal_error
(
error
,
HA_CHECK_DUP_KEY
))
table
->
file
->
is_fatal_error
(
error
,
HA_CHECK_DUP_KEY
))
...
@@ -669,6 +661,14 @@ int mysql_update(THD *thd,
...
@@ -669,6 +661,14 @@ int mysql_update(THD *thd,
}
}
}
}
if
(
table
->
triggers
&&
table
->
triggers
->
process_triggers
(
thd
,
TRG_EVENT_UPDATE
,
TRG_ACTION_AFTER
,
TRUE
))
{
error
=
1
;
break
;
}
if
(
!--
limit
&&
using_limit
)
if
(
!--
limit
&&
using_limit
)
{
{
/*
/*
...
@@ -1633,13 +1633,13 @@ bool multi_update::send_data(List<Item> ¬_used_values)
...
@@ -1633,13 +1633,13 @@ bool multi_update::send_data(List<Item> ¬_used_values)
trans_safe
=
0
;
trans_safe
=
0
;
thd
->
transaction
.
stmt
.
modified_non_trans_table
=
TRUE
;
thd
->
transaction
.
stmt
.
modified_non_trans_table
=
TRUE
;
}
}
}
}
if
(
table
->
triggers
&&
if
(
table
->
triggers
&&
table
->
triggers
->
process_triggers
(
thd
,
TRG_EVENT_UPDATE
,
table
->
triggers
->
process_triggers
(
thd
,
TRG_EVENT_UPDATE
,
TRG_ACTION_AFTER
,
TRUE
))
TRG_ACTION_AFTER
,
TRUE
))
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
}
}
}
}
else
else
{
{
int
error
;
int
error
;
...
@@ -1860,13 +1860,13 @@ int multi_update::do_updates()
...
@@ -1860,13 +1860,13 @@ int multi_update::do_updates()
updated
++
;
updated
++
;
else
else
local_error
=
0
;
local_error
=
0
;
}
if
(
table
->
triggers
&&
if
(
table
->
triggers
&&
table
->
triggers
->
process_triggers
(
thd
,
TRG_EVENT_UPDATE
,
table
->
triggers
->
process_triggers
(
thd
,
TRG_EVENT_UPDATE
,
TRG_ACTION_AFTER
,
TRUE
))
TRG_ACTION_AFTER
,
TRUE
))
goto
err2
;
goto
err2
;
}
}
}
if
(
updated
!=
org_updated
)
if
(
updated
!=
org_updated
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment