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
23340f3f
Commit
23340f3f
authored
Jun 26, 2006
by
andrey@lmy004
Browse files
Options
Browse Files
Download
Plain Diff
Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into lmy004.:/work/mysql-5.1-runtime-bug16992
parents
d617241c
c59a58c4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
133 additions
and
90 deletions
+133
-90
mysql-test/r/events.result
mysql-test/r/events.result
+6
-6
mysql-test/r/events_grant.result
mysql-test/r/events_grant.result
+39
-39
mysql-test/r/information_schema.result
mysql-test/r/information_schema.result
+1
-1
mysql-test/t/events.test
mysql-test/t/events.test
+3
-3
mysql-test/t/events_grant.test
mysql-test/t/events_grant.test
+9
-9
sql/sql_show.cc
sql/sql_show.cc
+75
-32
No files found.
mysql-test/r/events.result
View file @
23340f3f
...
...
@@ -365,19 +365,19 @@ on schedule every 10 hour
disable
do
select 1;
select event_schema, event_name, definer, event_
body
from information_schema.events where event_name='white_space';
event_schema event_name definer event_
body
select event_schema, event_name, definer, event_
definition
from information_schema.events where event_name='white_space';
event_schema event_name definer event_
definition
events_test white_space root@localhost select 1
drop event white_space;
create event white_space on schedule every 10 hour disable do
select 2;
select event_schema, event_name, definer, event_
body
from information_schema.events where event_name='white_space';
event_schema event_name definer event_
body
select event_schema, event_name, definer, event_
definition
from information_schema.events where event_name='white_space';
event_schema event_name definer event_
definition
events_test white_space root@localhost select 2
drop event white_space;
create event white_space on schedule every 10 hour disable do select 3;
select event_schema, event_name, definer, event_
body
from information_schema.events where event_name='white_space';
event_schema event_name definer event_
body
select event_schema, event_name, definer, event_
definition
from information_schema.events where event_name='white_space';
event_schema event_name definer event_
definition
events_test white_space root@localhost select 3
drop event white_space;
create event e1 on schedule every 1 year do set @a = 5;
...
...
mysql-test/r/events_grant.result
View file @
23340f3f
...
...
@@ -4,9 +4,9 @@ CREATE EVENT one_event ON SCHEDULE EVERY 10 SECOND DO SELECT 123;
SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test one_event root@localhost RECURRING NULL 10 SECOND # # ENABLED
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT from information_schema.events;
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
NULL events_test one_event root@localhost SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_
DEFINITION, EVENT_
TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT from information_schema.events;
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_
DEFINITION EVENT_
TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
NULL events_test one_event root@localhost S
QL S
ELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
CREATE DATABASE events_test2;
CREATE USER ev_test@localhost;
GRANT ALL ON events_test.* to ev_test@localhost;
...
...
@@ -57,65 +57,65 @@ USE events_test2;
CREATE EVENT four_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42;
USE events_test;
"We should see 4 events : one_event, two_event, three_event & four_event"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
NULL events_test one_event root@localhost SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
NULL events_test two_event ev_test@localhost SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
NULL events_test three_event ev_test@localhost SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
NULL events_test2 four_event ev_test@localhost SELECT 42 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_
DEFINITION, EVENT_
TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_
DEFINITION EVENT_
TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
NULL events_test one_event root@localhost S
QL S
ELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
NULL events_test two_event ev_test@localhost S
QL S
ELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
NULL events_test three_event ev_test@localhost S
QL S
ELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
NULL events_test2 four_event ev_test@localhost S
QL S
ELECT 42 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE
DROP DATABASE events_test2;
"We should see 3 events : one_event, two_event, three_event"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
NULL events_test one_event root@localhost SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
NULL events_test two_event ev_test@localhost SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
NULL events_test three_event ev_test@localhost SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_
DEFINITION, EVENT_
TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_
DEFINITION EVENT_
TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
NULL events_test one_event root@localhost S
QL S
ELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
NULL events_test two_event ev_test@localhost S
QL S
ELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
NULL events_test three_event ev_test@localhost S
QL S
ELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
CREATE DATABASE events_test2;
USE events_test2;
CREATE EVENT five_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42;
"Should see 4 events - one, two, three & five"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
NULL events_test one_event root@localhost SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
NULL events_test two_event ev_test@localhost SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
NULL events_test three_event ev_test@localhost SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
NULL events_test2 five_event root@localhost SELECT 42 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_
DEFINITION, EVENT_
TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_
DEFINITION EVENT_
TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
NULL events_test one_event root@localhost S
QL S
ELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
NULL events_test two_event ev_test@localhost S
QL S
ELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
NULL events_test three_event ev_test@localhost S
QL S
ELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
NULL events_test2 five_event root@localhost S
QL S
ELECT 42 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE
REVOKE EVENT ON events_test2.* FROM ev_test@localhost;
USE test;
"Should see 3 events - one, two & three"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
NULL events_test one_event root@localhost SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
NULL events_test two_event ev_test@localhost SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
NULL events_test three_event ev_test@localhost SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_
DEFINITION, EVENT_
TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_
DEFINITION EVENT_
TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
NULL events_test one_event root@localhost S
QL S
ELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
NULL events_test two_event ev_test@localhost S
QL S
ELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
NULL events_test three_event ev_test@localhost S
QL S
ELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
"Let's test ALTER EVENT which changes the definer"
USE events_test;
ALTER EVENT one_event ON SCHEDULE EVERY 10 SECOND;
"The definer should be ev_test@localhost"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
NULL events_test one_event ev_test@localhost SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_
DEFINITION, EVENT_
TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_
DEFINITION EVENT_
TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
NULL events_test one_event ev_test@localhost S
QL S
ELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
USE events_test;
ALTER EVENT one_event COMMENT "comment";
"The definer should be root@localhost"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
NULL events_test one_event root@localhost SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE comment
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_
DEFINITION, EVENT_
TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_
DEFINITION EVENT_
TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
NULL events_test one_event root@localhost S
QL S
ELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE comment
ALTER EVENT one_event DO SELECT 12;
"The definer should be ev_test@localhost"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
NULL events_test one_event ev_test@localhost SELECT 12 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE comment
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_
DEFINITION, EVENT_
TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_
DEFINITION EVENT_
TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
NULL events_test one_event ev_test@localhost S
QL S
ELECT 12 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE comment
"make the definer again root@localhost"
ALTER EVENT one_event COMMENT "new comment";
"test DROP by another user"
DROP EVENT one_event;
"One event should not be there"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
NULL events_test two_event ev_test@localhost SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
NULL events_test three_event ev_test@localhost SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
NULL events_test2 five_event root@localhost SELECT 42 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_
DEFINITION, EVENT_
TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS;
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_
DEFINITION EVENT_
TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
NULL events_test two_event ev_test@localhost S
QL S
ELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
NULL events_test three_event ev_test@localhost S
QL S
ELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
NULL events_test2 five_event root@localhost S
QL S
ELECT 42 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE
DROP USER ev_test@localhost;
DROP DATABASE events_test2;
DROP DATABASE events_test;
mysql-test/r/information_schema.result
View file @
23340f3f
...
...
@@ -754,7 +754,7 @@ information_schema.columns
where data_type = 'longtext';
table_schema table_name column_name
information_schema COLUMNS COLUMN_TYPE
information_schema EVENTS EVENT_
BODY
information_schema EVENTS EVENT_
DEFINITION
information_schema EVENTS SQL_MODE
information_schema PARTITIONS PARTITION_EXPRESSION
information_schema PARTITIONS SUBPARTITION_EXPRESSION
...
...
mysql-test/t/events.test
View file @
23340f3f
...
...
@@ -330,15 +330,15 @@ on schedule every 10 hour
disable
do
select
1
;
select
event_schema
,
event_name
,
definer
,
event_
body
from
information_schema
.
events
where
event_name
=
'white_space'
;
select
event_schema
,
event_name
,
definer
,
event_
definition
from
information_schema
.
events
where
event_name
=
'white_space'
;
drop
event
white_space
;
create
event
white_space
on
schedule
every
10
hour
disable
do
select
2
;
select
event_schema
,
event_name
,
definer
,
event_
body
from
information_schema
.
events
where
event_name
=
'white_space'
;
select
event_schema
,
event_name
,
definer
,
event_
definition
from
information_schema
.
events
where
event_name
=
'white_space'
;
drop
event
white_space
;
create
event
white_space
on
schedule
every
10
hour
disable
do
select
3
;
select
event_schema
,
event_name
,
definer
,
event_
body
from
information_schema
.
events
where
event_name
=
'white_space'
;
select
event_schema
,
event_name
,
definer
,
event_
definition
from
information_schema
.
events
where
event_name
=
'white_space'
;
drop
event
white_space
;
#
# END: BUG #17453: Creating Event crash the server
...
...
mysql-test/t/events_grant.test
View file @
23340f3f
...
...
@@ -9,7 +9,7 @@ use events_test;
CREATE
EVENT
one_event
ON
SCHEDULE
EVERY
10
SECOND
DO
SELECT
123
;
--
replace_column
8
# 9 #
SHOW
EVENTS
;
SELECT
EVENT_CATALOG
,
EVENT_SCHEMA
,
EVENT_NAME
,
DEFINER
,
EVENT_BODY
,
EVENT_TYPE
,
EXECUTE_AT
,
INTERVAL_VALUE
,
INTERVAL_FIELD
,
STATUS
,
ON_COMPLETION
,
EVENT_COMMENT
from
information_schema
.
events
;
SELECT
EVENT_CATALOG
,
EVENT_SCHEMA
,
EVENT_NAME
,
DEFINER
,
EVENT_BODY
,
EVENT_
DEFINITION
,
EVENT_
TYPE
,
EXECUTE_AT
,
INTERVAL_VALUE
,
INTERVAL_FIELD
,
STATUS
,
ON_COMPLETION
,
EVENT_COMMENT
from
information_schema
.
events
;
CREATE
DATABASE
events_test2
;
CREATE
USER
ev_test
@
localhost
;
GRANT
ALL
ON
events_test
.*
to
ev_test
@
localhost
;
...
...
@@ -55,10 +55,10 @@ CREATE EVENT four_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42;
connection
default
;
USE
events_test
;
--
echo
"We should see 4 events : one_event, two_event, three_event & four_event"
SELECT
EVENT_CATALOG
,
EVENT_SCHEMA
,
EVENT_NAME
,
DEFINER
,
EVENT_BODY
,
EVENT_TYPE
,
EXECUTE_AT
,
INTERVAL_VALUE
,
INTERVAL_FIELD
,
STATUS
,
ON_COMPLETION
,
EVENT_COMMENT
FROM
INFORMATION_SCHEMA
.
EVENTS
;
SELECT
EVENT_CATALOG
,
EVENT_SCHEMA
,
EVENT_NAME
,
DEFINER
,
EVENT_BODY
,
EVENT_
DEFINITION
,
EVENT_
TYPE
,
EXECUTE_AT
,
INTERVAL_VALUE
,
INTERVAL_FIELD
,
STATUS
,
ON_COMPLETION
,
EVENT_COMMENT
FROM
INFORMATION_SCHEMA
.
EVENTS
;
DROP
DATABASE
events_test2
;
--
echo
"We should see 3 events : one_event, two_event, three_event"
SELECT
EVENT_CATALOG
,
EVENT_SCHEMA
,
EVENT_NAME
,
DEFINER
,
EVENT_BODY
,
EVENT_TYPE
,
EXECUTE_AT
,
INTERVAL_VALUE
,
INTERVAL_FIELD
,
STATUS
,
ON_COMPLETION
,
EVENT_COMMENT
FROM
INFORMATION_SCHEMA
.
EVENTS
;
SELECT
EVENT_CATALOG
,
EVENT_SCHEMA
,
EVENT_NAME
,
DEFINER
,
EVENT_BODY
,
EVENT_
DEFINITION
,
EVENT_
TYPE
,
EXECUTE_AT
,
INTERVAL_VALUE
,
INTERVAL_FIELD
,
STATUS
,
ON_COMPLETION
,
EVENT_COMMENT
FROM
INFORMATION_SCHEMA
.
EVENTS
;
connection
default
;
CREATE
DATABASE
events_test2
;
...
...
@@ -67,27 +67,27 @@ CREATE EVENT five_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42;
connection
ev_con1
;
--
echo
"Should see 4 events - one, two, three & five"
SELECT
EVENT_CATALOG
,
EVENT_SCHEMA
,
EVENT_NAME
,
DEFINER
,
EVENT_BODY
,
EVENT_TYPE
,
EXECUTE_AT
,
INTERVAL_VALUE
,
INTERVAL_FIELD
,
STATUS
,
ON_COMPLETION
,
EVENT_COMMENT
FROM
INFORMATION_SCHEMA
.
EVENTS
;
SELECT
EVENT_CATALOG
,
EVENT_SCHEMA
,
EVENT_NAME
,
DEFINER
,
EVENT_BODY
,
EVENT_
DEFINITION
,
EVENT_
TYPE
,
EXECUTE_AT
,
INTERVAL_VALUE
,
INTERVAL_FIELD
,
STATUS
,
ON_COMPLETION
,
EVENT_COMMENT
FROM
INFORMATION_SCHEMA
.
EVENTS
;
connection
default
;
REVOKE
EVENT
ON
events_test2
.*
FROM
ev_test
@
localhost
;
connection
ev_con1
;
USE
test
;
--
echo
"Should see 3 events - one, two & three"
SELECT
EVENT_CATALOG
,
EVENT_SCHEMA
,
EVENT_NAME
,
DEFINER
,
EVENT_BODY
,
EVENT_TYPE
,
EXECUTE_AT
,
INTERVAL_VALUE
,
INTERVAL_FIELD
,
STATUS
,
ON_COMPLETION
,
EVENT_COMMENT
FROM
INFORMATION_SCHEMA
.
EVENTS
;
SELECT
EVENT_CATALOG
,
EVENT_SCHEMA
,
EVENT_NAME
,
DEFINER
,
EVENT_BODY
,
EVENT_
DEFINITION
,
EVENT_
TYPE
,
EXECUTE_AT
,
INTERVAL_VALUE
,
INTERVAL_FIELD
,
STATUS
,
ON_COMPLETION
,
EVENT_COMMENT
FROM
INFORMATION_SCHEMA
.
EVENTS
;
--
echo
"Let's test ALTER EVENT which changes the definer"
USE
events_test
;
ALTER
EVENT
one_event
ON
SCHEDULE
EVERY
10
SECOND
;
--
echo
"The definer should be ev_test@localhost"
SELECT
EVENT_CATALOG
,
EVENT_SCHEMA
,
EVENT_NAME
,
DEFINER
,
EVENT_BODY
,
EVENT_TYPE
,
EXECUTE_AT
,
INTERVAL_VALUE
,
INTERVAL_FIELD
,
STATUS
,
ON_COMPLETION
,
EVENT_COMMENT
FROM
INFORMATION_SCHEMA
.
EVENTS
WHERE
EVENT_NAME
=
'one_event'
;
SELECT
EVENT_CATALOG
,
EVENT_SCHEMA
,
EVENT_NAME
,
DEFINER
,
EVENT_BODY
,
EVENT_
DEFINITION
,
EVENT_
TYPE
,
EXECUTE_AT
,
INTERVAL_VALUE
,
INTERVAL_FIELD
,
STATUS
,
ON_COMPLETION
,
EVENT_COMMENT
FROM
INFORMATION_SCHEMA
.
EVENTS
WHERE
EVENT_NAME
=
'one_event'
;
connection
default
;
USE
events_test
;
ALTER
EVENT
one_event
COMMENT
"comment"
;
connection
ev_con1
;
--
echo
"The definer should be root@localhost"
SELECT
EVENT_CATALOG
,
EVENT_SCHEMA
,
EVENT_NAME
,
DEFINER
,
EVENT_BODY
,
EVENT_TYPE
,
EXECUTE_AT
,
INTERVAL_VALUE
,
INTERVAL_FIELD
,
STATUS
,
ON_COMPLETION
,
EVENT_COMMENT
FROM
INFORMATION_SCHEMA
.
EVENTS
WHERE
EVENT_NAME
=
'one_event'
;
SELECT
EVENT_CATALOG
,
EVENT_SCHEMA
,
EVENT_NAME
,
DEFINER
,
EVENT_BODY
,
EVENT_
DEFINITION
,
EVENT_
TYPE
,
EXECUTE_AT
,
INTERVAL_VALUE
,
INTERVAL_FIELD
,
STATUS
,
ON_COMPLETION
,
EVENT_COMMENT
FROM
INFORMATION_SCHEMA
.
EVENTS
WHERE
EVENT_NAME
=
'one_event'
;
ALTER
EVENT
one_event
DO
SELECT
12
;
--
echo
"The definer should be ev_test@localhost"
SELECT
EVENT_CATALOG
,
EVENT_SCHEMA
,
EVENT_NAME
,
DEFINER
,
EVENT_BODY
,
EVENT_TYPE
,
EXECUTE_AT
,
INTERVAL_VALUE
,
INTERVAL_FIELD
,
STATUS
,
ON_COMPLETION
,
EVENT_COMMENT
FROM
INFORMATION_SCHEMA
.
EVENTS
WHERE
EVENT_NAME
=
'one_event'
;
SELECT
EVENT_CATALOG
,
EVENT_SCHEMA
,
EVENT_NAME
,
DEFINER
,
EVENT_BODY
,
EVENT_
DEFINITION
,
EVENT_
TYPE
,
EXECUTE_AT
,
INTERVAL_VALUE
,
INTERVAL_FIELD
,
STATUS
,
ON_COMPLETION
,
EVENT_COMMENT
FROM
INFORMATION_SCHEMA
.
EVENTS
WHERE
EVENT_NAME
=
'one_event'
;
connection
default
;
--
echo
"make the definer again root@localhost"
ALTER
EVENT
one_event
COMMENT
"new comment"
;
...
...
@@ -96,7 +96,7 @@ connection ev_con1;
DROP
EVENT
one_event
;
connection
default
;
--
echo
"One event should not be there"
SELECT
EVENT_CATALOG
,
EVENT_SCHEMA
,
EVENT_NAME
,
DEFINER
,
EVENT_BODY
,
EVENT_TYPE
,
EXECUTE_AT
,
INTERVAL_VALUE
,
INTERVAL_FIELD
,
STATUS
,
ON_COMPLETION
,
EVENT_COMMENT
FROM
INFORMATION_SCHEMA
.
EVENTS
;
SELECT
EVENT_CATALOG
,
EVENT_SCHEMA
,
EVENT_NAME
,
DEFINER
,
EVENT_BODY
,
EVENT_
DEFINITION
,
EVENT_
TYPE
,
EXECUTE_AT
,
INTERVAL_VALUE
,
INTERVAL_FIELD
,
STATUS
,
ON_COMPLETION
,
EVENT_COMMENT
FROM
INFORMATION_SCHEMA
.
EVENTS
;
disconnect
ev_con1
;
connection
default
;
DROP
USER
ev_test
@
localhost
;
...
...
sql/sql_show.cc
View file @
23340f3f
...
...
@@ -34,6 +34,30 @@
#include "ha_partition.h"
#endif
enum
enum_i_s_events_fields
{
ISE_EVENT_CATALOG
=
0
,
ISE_EVENT_SCHEMA
,
ISE_EVENT_NAME
,
ISE_DEFINER
,
ISE_EVENT_BODY
,
ISE_EVENT_DEFINITION
,
ISE_EVENT_TYPE
,
ISE_EXECUTE_AT
,
ISE_INTERVAL_VALUE
,
ISE_INTERVAL_FIELD
,
ISE_SQL_MODE
,
ISE_STARTS
,
ISE_ENDS
,
ISE_STATUS
,
ISE_ON_COMPLETION
,
ISE_CREATED
,
ISE_LAST_ALTERED
,
ISE_LAST_EXECUTED
,
ISE_EVENT_COMMENT
};
static
const
char
*
grant_names
[]
=
{
"select"
,
"insert"
,
"update"
,
"delete"
,
"create"
,
"drop"
,
"reload"
,
"shutdown"
,
"process"
,
"file"
,
"grant"
,
"references"
,
"index"
,
"alter"
};
...
...
@@ -4111,6 +4135,8 @@ static interval_type get_real_interval_type(interval_type i_type)
case
INTERVAL_SECOND_MICROSECOND
:
case
INTERVAL_MICROSECOND
:
return
INTERVAL_MICROSECOND
;
case
INTERVAL_LAST
:
DBUG_ASSERT
(
0
);
}
DBUG_ASSERT
(
0
);
return
INTERVAL_SECOND
;
...
...
@@ -4166,85 +4192,101 @@ copy_event_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table)
/* ->field[0] is EVENT_CATALOG and is by default NULL */
sch_table
->
field
[
1
]
->
store
(
et
.
dbname
.
str
,
et
.
dbname
.
length
,
scs
);
sch_table
->
field
[
2
]
->
store
(
et
.
name
.
str
,
et
.
name
.
length
,
scs
);
sch_table
->
field
[
3
]
->
store
(
et
.
definer
.
str
,
et
.
definer
.
length
,
scs
);
sch_table
->
field
[
4
]
->
store
(
et
.
body
.
str
,
et
.
body
.
length
,
scs
);
/* [9] is SQL_MODE */
sch_table
->
field
[
ISE_EVENT_SCHEMA
]
->
store
(
et
.
dbname
.
str
,
et
.
dbname
.
length
,
scs
);
sch_table
->
field
[
ISE_EVENT_NAME
]
->
store
(
et
.
name
.
str
,
et
.
name
.
length
,
scs
);
sch_table
->
field
[
ISE_DEFINER
]
->
store
(
et
.
definer
.
str
,
et
.
definer
.
length
,
scs
);
sch_table
->
field
[
ISE_EVENT_BODY
]
->
store
(
STRING_WITH_LEN
(
"SQL"
),
scs
);
sch_table
->
field
[
ISE_EVENT_DEFINITION
]
->
store
(
et
.
body
.
str
,
et
.
body
.
length
,
scs
);
/* SQL_MODE */
{
byte
*
sql_mode_str
;
ulong
sql_mode_len
=
0
;
ulong
sql_mode_len
=
0
;
sql_mode_str
=
sys_var_thd_sql_mode
::
symbolic_mode_representation
(
thd
,
et
.
sql_mode
,
&
sql_mode_len
);
sch_table
->
field
[
9
]
->
store
((
const
char
*
)
sql_mode_str
,
sql_mode_len
,
scs
);
sch_table
->
field
[
ISE_SQL_MODE
]
->
store
((
const
char
*
)
sql_mode_str
,
sql_mode_len
,
scs
);
}
if
(
et
.
expression
)
{
String
show_str
;
/* type */
sch_table
->
field
[
5
]
->
store
(
STRING_WITH_LEN
(
"RECURRING"
),
scs
);
sch_table
->
field
[
ISE_EVENT_TYPE
]
->
store
(
STRING_WITH_LEN
(
"RECURRING"
),
scs
);
if
(
Events
::
reconstruct_interval_expression
(
&
show_str
,
et
.
interval
,
et
.
expression
))
DBUG_RETURN
(
1
);
sch_table
->
field
[
7
]
->
set_notnull
();
sch_table
->
field
[
7
]
->
store
(
show_str
.
ptr
(),
show_str
.
length
(),
scs
);
sch_table
->
field
[
ISE_INTERVAL_VALUE
]
->
set_notnull
();
sch_table
->
field
[
ISE_INTERVAL_VALUE
]
->
store
(
show_str
.
ptr
(),
show_str
.
length
(),
scs
);
LEX_STRING
*
ival
=
&
interval_type_to_name
[
et
.
interval
];
sch_table
->
field
[
8
]
->
set_notnull
();
sch_table
->
field
[
8
]
->
store
(
ival
->
str
,
ival
->
length
,
scs
);
sch_table
->
field
[
ISE_INTERVAL_FIELD
]
->
set_notnull
();
sch_table
->
field
[
ISE_INTERVAL_FIELD
]
->
store
(
ival
->
str
,
ival
->
length
,
scs
);
/* starts & ends */
sch_table
->
field
[
10
]
->
set_notnull
();
sch_table
->
field
[
10
]
->
store_time
(
&
et
.
starts
,
MYSQL_TIMESTAMP_DATETIME
);
/* starts & ends . STARTS is always set - see sql_yacc.yy */
sch_table
->
field
[
ISE_STARTS
]
->
set_notnull
();
sch_table
->
field
[
ISE_STARTS
]
->
store_time
(
&
et
.
starts
,
MYSQL_TIMESTAMP_DATETIME
);
if
(
!
et
.
ends_null
)
{
sch_table
->
field
[
11
]
->
set_notnull
();
sch_table
->
field
[
11
]
->
store_time
(
&
et
.
ends
,
MYSQL_TIMESTAMP_DATETIME
);
sch_table
->
field
[
ISE_ENDS
]
->
set_notnull
();
sch_table
->
field
[
ISE_ENDS
]
->
store_time
(
&
et
.
ends
,
MYSQL_TIMESTAMP_DATETIME
);
}
}
else
{
/
/type
sch_table
->
field
[
5
]
->
store
(
STRING_WITH_LEN
(
"ONE TIME"
),
scs
);
/
* type */
sch_table
->
field
[
ISE_EVENT_TYPE
]
->
store
(
STRING_WITH_LEN
(
"ONE TIME"
),
scs
);
sch_table
->
field
[
6
]
->
set_notnull
();
sch_table
->
field
[
6
]
->
store_time
(
&
et
.
execute_at
,
MYSQL_TIMESTAMP_DATETIME
);
sch_table
->
field
[
ISE_EXECUTE_AT
]
->
set_notnull
();
sch_table
->
field
[
ISE_EXECUTE_AT
]
->
store_time
(
&
et
.
execute_at
,
MYSQL_TIMESTAMP_DATETIME
);
}
/* status */
if
(
et
.
status
==
Event_timed
::
ENABLED
)
sch_table
->
field
[
12
]
->
store
(
STRING_WITH_LEN
(
"ENABLED"
),
scs
);
sch_table
->
field
[
ISE_STATUS
]
->
store
(
STRING_WITH_LEN
(
"ENABLED"
),
scs
);
else
sch_table
->
field
[
12
]
->
store
(
STRING_WITH_LEN
(
"DISABLED"
),
scs
);
sch_table
->
field
[
ISE_STATUS
]
->
store
(
STRING_WITH_LEN
(
"DISABLED"
),
scs
);
/* on_completion */
if
(
et
.
on_completion
==
Event_timed
::
ON_COMPLETION_DROP
)
sch_table
->
field
[
13
]
->
store
(
STRING_WITH_LEN
(
"NOT PRESERVE"
),
scs
);
sch_table
->
field
[
ISE_ON_COMPLETION
]
->
store
(
STRING_WITH_LEN
(
"NOT PRESERVE"
),
scs
);
else
sch_table
->
field
[
13
]
->
store
(
STRING_WITH_LEN
(
"PRESERVE"
),
scs
);
sch_table
->
field
[
ISE_ON_COMPLETION
]
->
store
(
STRING_WITH_LEN
(
"PRESERVE"
),
scs
);
int
not_used
=
0
;
number_to_datetime
(
et
.
created
,
&
time
,
0
,
&
not_used
);
DBUG_ASSERT
(
not_used
==
0
);
sch_table
->
field
[
14
]
->
store_time
(
&
time
,
MYSQL_TIMESTAMP_DATETIME
);
sch_table
->
field
[
ISE_CREATED
]
->
store_time
(
&
time
,
MYSQL_TIMESTAMP_DATETIME
);
number_to_datetime
(
et
.
modified
,
&
time
,
0
,
&
not_used
);
DBUG_ASSERT
(
not_used
==
0
);
sch_table
->
field
[
15
]
->
store_time
(
&
time
,
MYSQL_TIMESTAMP_DATETIME
);
sch_table
->
field
[
ISE_LAST_ALTERED
]
->
store_time
(
&
time
,
MYSQL_TIMESTAMP_DATETIME
);
if
(
et
.
last_executed
.
year
)
{
sch_table
->
field
[
16
]
->
set_notnull
();
sch_table
->
field
[
16
]
->
store_time
(
&
et
.
last_executed
,
MYSQL_TIMESTAMP_DATETIME
);
sch_table
->
field
[
ISE_LAST_EXECUTED
]
->
set_notnull
();
sch_table
->
field
[
ISE_LAST_EXECUTED
]
->
store_time
(
&
et
.
last_executed
,
MYSQL_TIMESTAMP_DATETIME
);
}
sch_table
->
field
[
17
]
->
store
(
et
.
comment
.
str
,
et
.
comment
.
length
,
scs
);
sch_table
->
field
[
ISE_EVENT_COMMENT
]
->
store
(
et
.
comment
.
str
,
et
.
comment
.
length
,
scs
);
if
(
schema_table_store_record
(
thd
,
sch_table
))
DBUG_RETURN
(
1
);
...
...
@@ -5168,7 +5210,8 @@ ST_FIELD_INFO events_fields_info[]=
{
"EVENT_SCHEMA"
,
NAME_LEN
,
MYSQL_TYPE_STRING
,
0
,
0
,
"Db"
},
{
"EVENT_NAME"
,
NAME_LEN
,
MYSQL_TYPE_STRING
,
0
,
0
,
"Name"
},
{
"DEFINER"
,
77
,
MYSQL_TYPE_STRING
,
0
,
0
,
"Definer"
},
{
"EVENT_BODY"
,
65535
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
},
{
"EVENT_BODY"
,
8
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
},
{
"EVENT_DEFINITION"
,
65535
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
},
{
"EVENT_TYPE"
,
9
,
MYSQL_TYPE_STRING
,
0
,
0
,
"Type"
},
{
"EXECUTE_AT"
,
0
,
MYSQL_TYPE_TIMESTAMP
,
0
,
1
,
"Execute at"
},
{
"INTERVAL_VALUE"
,
256
,
MYSQL_TYPE_STRING
,
0
,
1
,
"Interval value"
},
...
...
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