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
ae117f23
Commit
ae117f23
authored
Sep 29, 2006
by
dlenev@mockturtle.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge mockturtle.local:/home/dlenev/src/mysql-5.0-bg20670-2
into mockturtle.local:/home/dlenev/src/mysql-5.1-bg20670
parents
5f149dde
091ed9fb
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
5 deletions
+63
-5
mysql-test/r/trigger.result
mysql-test/r/trigger.result
+12
-0
mysql-test/t/trigger.test
mysql-test/t/trigger.test
+19
-0
sql/sql_trigger.cc
sql/sql_trigger.cc
+32
-0
sql/sql_trigger.h
sql/sql_trigger.h
+0
-5
No files found.
mysql-test/r/trigger.result
View file @
ae117f23
...
@@ -1173,4 +1173,16 @@ TRIGGER t2_bi BEFORE INSERT ON t2 FOR EACH ROW SET @a = 2;
...
@@ -1173,4 +1173,16 @@ TRIGGER t2_bi BEFORE INSERT ON t2 FOR EACH ROW SET @a = 2;
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
DROP TABLE t1;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t2;
drop table if exists t1;
create table t1 (i int, j int key);
insert into t1 values (1,1), (2,2), (3,3);
create trigger t1_bu before update on t1 for each row
set new.j = new.j + 10;
update t1 set i= i+ 10 where j > 2;
select * from t1;
i j
1 1
2 2
13 13
drop table t1;
End of 5.0 tests
End of 5.0 tests
mysql-test/t/trigger.test
View file @
ae117f23
...
@@ -1421,4 +1421,23 @@ DROP TABLE t1;
...
@@ -1421,4 +1421,23 @@ DROP TABLE t1;
DROP
TABLE
t2
;
DROP
TABLE
t2
;
#
# Bug#20670 "UPDATE using key and invoking trigger that modifies
# this key does not stop"
#
--
disable_warnings
drop
table
if
exists
t1
;
--
enable_warnings
create
table
t1
(
i
int
,
j
int
key
);
insert
into
t1
values
(
1
,
1
),
(
2
,
2
),
(
3
,
3
);
create
trigger
t1_bu
before
update
on
t1
for
each
row
set
new
.
j
=
new
.
j
+
10
;
# This should not work indefinitely and should cause
# expected result
update
t1
set
i
=
i
+
10
where
j
>
2
;
select
*
from
t1
;
drop
table
t1
;
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
sql/sql_trigger.cc
View file @
ae117f23
...
@@ -1582,6 +1582,38 @@ void Table_triggers_list::mark_fields_used(trg_event_type event)
...
@@ -1582,6 +1582,38 @@ void Table_triggers_list::mark_fields_used(trg_event_type event)
}
}
/*
Check if field of subject table can be changed in before update trigger.
SYNOPSIS
is_updated_in_before_update_triggers()
field Field object for field to be checked
NOTE
Field passed to this function should be bound to the same
TABLE object as Table_triggers_list.
RETURN VALUE
TRUE Field is changed
FALSE Otherwise
*/
bool
Table_triggers_list
::
is_updated_in_before_update_triggers
(
Field
*
fld
)
{
Item_trigger_field
*
trg_fld
;
for
(
trg_fld
=
trigger_fields
[
TRG_EVENT_UPDATE
][
TRG_ACTION_BEFORE
];
trg_fld
!=
0
;
trg_fld
=
trg_fld
->
next_trg_field
)
{
if
(
trg_fld
->
get_settable_routine_parameter
()
&&
trg_fld
->
field_idx
!=
(
uint
)
-
1
&&
table
->
field
[
trg_fld
->
field_idx
]
->
eq
(
fld
))
return
TRUE
;
}
return
FALSE
;
}
/*
/*
Trigger BUG#14090 compatibility hook
Trigger BUG#14090 compatibility hook
...
...
sql/sql_trigger.h
View file @
ae117f23
...
@@ -116,11 +116,6 @@ public:
...
@@ -116,11 +116,6 @@ public:
bodies
[
TRG_EVENT_DELETE
][
TRG_ACTION_AFTER
]);
bodies
[
TRG_EVENT_DELETE
][
TRG_ACTION_AFTER
]);
}
}
bool
has_before_update_triggers
()
{
return
test
(
bodies
[
TRG_EVENT_UPDATE
][
TRG_ACTION_BEFORE
]);
}
void
set_table
(
TABLE
*
new_table
);
void
set_table
(
TABLE
*
new_table
);
void
mark_fields_used
(
trg_event_type
event
);
void
mark_fields_used
(
trg_event_type
event
);
...
...
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