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
d4321d9b
Commit
d4321d9b
authored
Jan 26, 2006
by
andrey@lmy004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for bug#16419 (Events: can't use timestamp in the schedule)
WL #1034 (Internal CRON)
parent
ccc36b01
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
8 deletions
+44
-8
mysql-test/r/events.result
mysql-test/r/events.result
+9
-0
mysql-test/t/events.test
mysql-test/t/events.test
+9
-0
sql/event_timed.cc
sql/event_timed.cc
+15
-7
sql/share/errmsg.txt
sql/share/errmsg.txt
+1
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+10
-0
No files found.
mysql-test/r/events.result
View file @
d4321d9b
...
...
@@ -40,6 +40,15 @@ count(*)
0
drop event event3;
drop table t_event3;
create event e_26 on schedule at '2017-01-01 00:00:00' disabled do set @a = 5;
select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
db name body definer convert_tz(execute_at, 'UTC', 'SYSTEM') on_completion
events_test e_26 set @a = 5 root@localhost 2017-01-01 00:00:00 DROP
drop event e_26;
create event e_26 on schedule at NULL disabled do set @a = 5;
ERROR HY000: Incorrect AT value: 'NULL'
create event e_26 on schedule at 'definitely not a datetime' disabled do set @a = 5;
ERROR HY000: Incorrect AT value: 'definitely not a datetime'
set names utf8;
create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1;
drop event задачка;
...
...
mysql-test/t/events.test
View file @
d4321d9b
...
...
@@ -32,6 +32,15 @@ select count(*) from t_event3;
drop
event
event3
;
drop
table
t_event3
;
create
event
e_26
on
schedule
at
'2017-01-01 00:00:00'
disabled
do
set
@
a
=
5
;
select
db
,
name
,
body
,
definer
,
convert_tz
(
execute_at
,
'UTC'
,
'SYSTEM'
),
on_completion
from
mysql
.
event
;
drop
event
e_26
;
--
error
1503
create
event
e_26
on
schedule
at
NULL
disabled
do
set
@
a
=
5
;
--
error
1503
create
event
e_26
on
schedule
at
'definitely not a datetime'
disabled
do
set
@
a
=
5
;
set
names
utf8
;
create
event
задачка
on
schedule
every
123
minute
starts
now
()
ends
now
()
+
interval
1
month
do
select
1
;
drop
event
задачка
;
...
...
sql/event_timed.cc
View file @
d4321d9b
...
...
@@ -133,6 +133,7 @@ event_timed::init_body(THD *thd)
0 - OK
EVEX_PARSE_ERROR - fix_fields failed
EVEX_BAD_PARAMS - datetime is in the past
ER_WRONG_VALUE - wrong value for execute at
*/
int
...
...
@@ -148,19 +149,19 @@ event_timed::init_execute_at(THD *thd, Item *expr)
if
(
expr
->
fix_fields
(
thd
,
&
expr
))
DBUG_RETURN
(
EVEX_PARSE_ERROR
);
if
(
expr
->
val_int
()
==
MYSQL_TIMESTAMP_ERROR
)
DBUG_RETURN
(
EVEX_BAD_PARAMS
);
// let's check whether time is in the past
thd
->
variables
.
time_zone
->
gmt_sec_to_TIME
(
&
time_tmp
,
(
my_time_t
)
thd
->
query_start
());
if
(
expr
->
val_int
()
<
TIME_to_ulonglong_datetime
(
&
time_tmp
))
DBUG_RETURN
(
EVEX_BAD_PARAMS
);
if
((
not_used
=
expr
->
get_date
(
&
ltime
,
TIME_NO_ZERO_DATE
)))
DBUG_RETURN
(
ER_WRONG_VALUE
);
if
(
TIME_to_ulonglong_datetime
(
&
ltime
)
<
TIME_to_ulonglong_datetime
(
&
time_tmp
))
DBUG_RETURN
(
EVEX_BAD_PARAMS
);
/*
This may result in a 1970-01-01 date if ltime is > 2037-xx-xx
CONVERT_TZ has similar problem
...
...
@@ -292,8 +293,7 @@ int
event_timed
::
init_starts
(
THD
*
thd
,
Item
*
new_starts
)
{
my_bool
not_used
;
TIME
ltime
;
my_time_t
my_time_tmp
;
TIME
ltime
,
time_tmp
;
DBUG_ENTER
(
"event_timed::init_starts"
);
...
...
@@ -306,6 +306,14 @@ event_timed::init_starts(THD *thd, Item *new_starts)
if
((
not_used
=
new_starts
->
get_date
(
&
ltime
,
TIME_NO_ZERO_DATE
)))
DBUG_RETURN
(
EVEX_BAD_PARAMS
);
// let's check whether time is in the past
thd
->
variables
.
time_zone
->
gmt_sec_to_TIME
(
&
time_tmp
,
(
my_time_t
)
thd
->
query_start
());
if
(
TIME_to_ulonglong_datetime
(
&
ltime
)
<
TIME_to_ulonglong_datetime
(
&
time_tmp
))
DBUG_RETURN
(
EVEX_BAD_PARAMS
);
/*
This may result in a 1970-01-01 date if ltime is > 2037-xx-xx
CONVERT_TZ has similar problem
...
...
sql/share/errmsg.txt
View file @
d4321d9b
...
...
@@ -5793,7 +5793,7 @@ ER_EVENT_DATA_TOO_LONG
eng "Data for column '%s' too long"
ER_DROP_INDEX_FK
eng "Cannot drop index '%-.64s': needed in a foreign key constraint"
ger "Kann Index '%-.64s' nicht lschen: wird fr einen
einen
Fremdschlssel bentigt"
ger "Kann Index '%-.64s' nicht lschen: wird fr einen Fremdschlssel bentigt"
ER_CANT_WRITE_LOCK_LOG_TABLE
eng "You can't write-lock a log table. Only read access is possible."
ER_CANT_READ_LOCK_LOG_TABLE
...
...
sql/sql_yacc.yy
View file @
d4321d9b
...
...
@@ -1436,6 +1436,16 @@ ev_schedule_time: EVERY_SYM expr interval
yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
break;
case ER_WRONG_VALUE:
{
char buff[120];
String str(buff,(uint32) sizeof(buff), system_charset_info);
String *str2= $2->val_str(&str);
my_error(ER_WRONG_VALUE, MYF(0), "AT",
str2? str2->c_ptr():"NULL");
YYABORT;
break;
}
case EVEX_BAD_PARAMS:
my_error(ER_EVENT_EXEC_TIME_IN_THE_PAST, MYF(0));
YYABORT;
...
...
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