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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
7c75bab1
Commit
7c75bab1
authored
Jan 27, 2006
by
joerg@debian.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge jbruehe@bk-internal.mysql.com:/home/bk/mysql-5.1-new
into debian.(none):/M51/mysql-5.1
parents
89102024
8188f77c
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
85 additions
and
34 deletions
+85
-34
mysql-test/lib/init_db.sql
mysql-test/lib/init_db.sql
+1
-1
mysql-test/r/events.result
mysql-test/r/events.result
+9
-0
mysql-test/r/system_mysql_db.result
mysql-test/r/system_mysql_db.result
+20
-20
mysql-test/t/events.test
mysql-test/t/events.test
+9
-0
scripts/mysql_create_system_tables.sh
scripts/mysql_create_system_tables.sh
+1
-1
sql/event_timed.cc
sql/event_timed.cc
+14
-9
sql/share/errmsg.txt
sql/share/errmsg.txt
+2
-2
sql/sql_yacc.yy
sql/sql_yacc.yy
+29
-1
No files found.
mysql-test/lib/init_db.sql
View file @
7c75bab1
...
@@ -595,7 +595,7 @@ CREATE TABLE event (
...
@@ -595,7 +595,7 @@ CREATE TABLE event (
ends
DATETIME
default
NULL
,
ends
DATETIME
default
NULL
,
status
ENUM
(
'ENABLED'
,
'DISABLED'
)
NOT
NULL
default
'ENABLED'
,
status
ENUM
(
'ENABLED'
,
'DISABLED'
)
NOT
NULL
default
'ENABLED'
,
on_completion
ENUM
(
'DROP'
,
'PRESERVE'
)
NOT
NULL
default
'DROP'
,
on_completion
ENUM
(
'DROP'
,
'PRESERVE'
)
NOT
NULL
default
'DROP'
,
comment
var
char
(
64
)
CHARACTER
SET
utf8
COLLATE
utf8_bin
NOT
NULL
default
''
,
comment
char
(
64
)
CHARACTER
SET
utf8
COLLATE
utf8_bin
NOT
NULL
default
''
,
PRIMARY
KEY
(
db
,
name
)
PRIMARY
KEY
(
db
,
name
)
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
utf8
COMMENT
'Events'
;
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
utf8
COMMENT
'Events'
;
...
...
mysql-test/r/events.result
View file @
7c75bab1
...
@@ -41,6 +41,15 @@ count(*)
...
@@ -41,6 +41,15 @@ count(*)
0
0
drop event event3;
drop event event3;
drop table t_event3;
drop table t_event3;
create event e_26 on schedule at '2017-01-01 00:00:00' disable 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;
set names utf8;
create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1;
create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1;
drop event задачка;
drop event задачка;
...
...
mysql-test/r/system_mysql_db.result
View file @
7c75bab1
...
@@ -186,6 +186,26 @@ proc CREATE TABLE `proc` (
...
@@ -186,6 +186,26 @@ proc CREATE TABLE `proc` (
`comment` char(64) character set utf8 collate utf8_bin NOT NULL default '',
`comment` char(64) character set utf8 collate utf8_bin NOT NULL default '',
PRIMARY KEY (`db`,`name`,`type`)
PRIMARY KEY (`db`,`name`,`type`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Stored Procedures'
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Stored Procedures'
show create table event;
Table Create Table
event CREATE TABLE `event` (
`db` char(64) character set utf8 collate utf8_bin NOT NULL default '',
`name` char(64) character set utf8 collate utf8_bin NOT NULL default '',
`body` longblob NOT NULL,
`definer` char(77) character set utf8 collate utf8_bin NOT NULL default '',
`execute_at` datetime default NULL,
`interval_value` int(11) default NULL,
`interval_field` enum('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL,
`created` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`modified` timestamp NOT NULL default '0000-00-00 00:00:00',
`last_executed` datetime default NULL,
`starts` datetime default NULL,
`ends` datetime default NULL,
`status` enum('ENABLED','DISABLED') NOT NULL default 'ENABLED',
`on_completion` enum('DROP','PRESERVE') NOT NULL default 'DROP',
`comment` char(64) character set utf8 collate utf8_bin NOT NULL default '',
PRIMARY KEY (`db`,`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events'
show create table general_log;
show create table general_log;
Table Create Table
Table Create Table
general_log CREATE TABLE `general_log` (
general_log CREATE TABLE `general_log` (
...
@@ -211,25 +231,5 @@ slow_log CREATE TABLE `slow_log` (
...
@@ -211,25 +231,5 @@ slow_log CREATE TABLE `slow_log` (
`server_id` int(11) default NULL,
`server_id` int(11) default NULL,
`sql_text` mediumtext NOT NULL
`sql_text` mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
show create table event;
Table Create Table
event CREATE TABLE `event` (
`db` char(64) character set utf8 collate utf8_bin NOT NULL default '',
`name` char(64) character set utf8 collate utf8_bin NOT NULL default '',
`body` longblob NOT NULL,
`definer` char(77) character set utf8 collate utf8_bin NOT NULL default '',
`execute_at` datetime default NULL,
`interval_value` int(11) default NULL,
`interval_field` enum('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL,
`created` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`modified` timestamp NOT NULL default '0000-00-00 00:00:00',
`last_executed` datetime default NULL,
`starts` datetime default NULL,
`ends` datetime default NULL,
`status` enum('ENABLED','DISABLED') NOT NULL default 'ENABLED',
`on_completion` enum('DROP','PRESERVE') NOT NULL default 'DROP',
`comment` varchar(64) character set utf8 collate utf8_bin NOT NULL default '',
PRIMARY KEY (`db`,`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events'
show tables;
show tables;
Tables_in_test
Tables_in_test
mysql-test/t/events.test
View file @
7c75bab1
...
@@ -33,6 +33,15 @@ select count(*) from t_event3;
...
@@ -33,6 +33,15 @@ select count(*) from t_event3;
drop
event
event3
;
drop
event
event3
;
drop
table
t_event3
;
drop
table
t_event3
;
create
event
e_26
on
schedule
at
'2017-01-01 00:00:00'
disable
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
;
set
names
utf8
;
create
event
задачка
on
schedule
every
123
minute
starts
now
()
ends
now
()
+
interval
1
month
do
select
1
;
create
event
задачка
on
schedule
every
123
minute
starts
now
()
ends
now
()
+
interval
1
month
do
select
1
;
drop
event
задачка
;
drop
event
задачка
;
...
...
scripts/mysql_create_system_tables.sh
View file @
7c75bab1
...
@@ -791,7 +791,7 @@ then
...
@@ -791,7 +791,7 @@ then
c_ev
=
"
$c_ev
ends DATETIME default NULL,"
c_ev
=
"
$c_ev
ends DATETIME default NULL,"
c_ev
=
"
$c_ev
status ENUM('ENABLED','DISABLED') NOT NULL default 'ENABLED',"
c_ev
=
"
$c_ev
status ENUM('ENABLED','DISABLED') NOT NULL default 'ENABLED',"
c_ev
=
"
$c_ev
on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP',"
c_ev
=
"
$c_ev
on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP',"
c_ev
=
"
$c_ev
comment
var
char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '',"
c_ev
=
"
$c_ev
comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '',"
c_ev
=
"
$c_ev
PRIMARY KEY (db,name)"
c_ev
=
"
$c_ev
PRIMARY KEY (db,name)"
c_ev
=
"
$c_ev
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';"
c_ev
=
"
$c_ev
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';"
fi
fi
...
...
sql/event_timed.cc
View file @
7c75bab1
...
@@ -133,6 +133,7 @@ event_timed::init_body(THD *thd)
...
@@ -133,6 +133,7 @@ event_timed::init_body(THD *thd)
0 - OK
0 - OK
EVEX_PARSE_ERROR - fix_fields failed
EVEX_PARSE_ERROR - fix_fields failed
EVEX_BAD_PARAMS - datetime is in the past
EVEX_BAD_PARAMS - datetime is in the past
ER_WRONG_VALUE - wrong value for execute at
*/
*/
int
int
...
@@ -148,19 +149,19 @@ event_timed::init_execute_at(THD *thd, Item *expr)
...
@@ -148,19 +149,19 @@ event_timed::init_execute_at(THD *thd, Item *expr)
if
(
expr
->
fix_fields
(
thd
,
&
expr
))
if
(
expr
->
fix_fields
(
thd
,
&
expr
))
DBUG_RETURN
(
EVEX_PARSE_ERROR
);
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
// let's check whether time is in the past
thd
->
variables
.
time_zone
->
gmt_sec_to_TIME
(
&
time_tmp
,
thd
->
variables
.
time_zone
->
gmt_sec_to_TIME
(
&
time_tmp
,
(
my_time_t
)
thd
->
query_start
());
(
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
)))
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
);
DBUG_RETURN
(
EVEX_BAD_PARAMS
);
/*
/*
This may result in a 1970-01-01 date if ltime is > 2037-xx-xx
This may result in a 1970-01-01 date if ltime is > 2037-xx-xx
CONVERT_TZ has similar problem
CONVERT_TZ has similar problem
...
@@ -292,18 +293,22 @@ int
...
@@ -292,18 +293,22 @@ int
event_timed
::
init_starts
(
THD
*
thd
,
Item
*
new_starts
)
event_timed
::
init_starts
(
THD
*
thd
,
Item
*
new_starts
)
{
{
my_bool
not_used
;
my_bool
not_used
;
TIME
ltime
;
TIME
ltime
,
time_tmp
;
my_time_t
my_time_tmp
;
DBUG_ENTER
(
"event_timed::init_starts"
);
DBUG_ENTER
(
"event_timed::init_starts"
);
if
(
new_starts
->
fix_fields
(
thd
,
&
new_starts
))
if
(
new_starts
->
fix_fields
(
thd
,
&
new_starts
))
DBUG_RETURN
(
EVEX_PARSE_ERROR
);
DBUG_RETURN
(
EVEX_PARSE_ERROR
);
if
(
new_starts
->
val_int
()
==
MYSQL_TIMESTAMP_ERROR
)
if
(
(
not_used
=
new_starts
->
get_date
(
&
ltime
,
TIME_NO_ZERO_DATE
))
)
DBUG_RETURN
(
EVEX_BAD_PARAMS
);
DBUG_RETURN
(
EVEX_BAD_PARAMS
);
if
((
not_used
=
new_starts
->
get_date
(
&
ltime
,
TIME_NO_ZERO_DATE
)))
// 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
);
DBUG_RETURN
(
EVEX_BAD_PARAMS
);
/*
/*
...
...
sql/share/errmsg.txt
View file @
7c75bab1
...
@@ -5772,7 +5772,7 @@ ER_EVENT_DROP_FAILED
...
@@ -5772,7 +5772,7 @@ ER_EVENT_DROP_FAILED
ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG
ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG
eng "INTERVAL is either not positive or too big"
eng "INTERVAL is either not positive or too big"
ER_EVENT_ENDS_BEFORE_STARTS
ER_EVENT_ENDS_BEFORE_STARTS
eng "ENDS
must be after
STARTS"
eng "ENDS
is either invalid or before
STARTS"
ER_EVENT_EXEC_TIME_IN_THE_PAST
ER_EVENT_EXEC_TIME_IN_THE_PAST
eng "Activation (AT) time is in the past"
eng "Activation (AT) time is in the past"
ER_EVENT_OPEN_TABLE_FAILED
ER_EVENT_OPEN_TABLE_FAILED
...
@@ -5793,7 +5793,7 @@ ER_EVENT_DATA_TOO_LONG
...
@@ -5793,7 +5793,7 @@ ER_EVENT_DATA_TOO_LONG
eng "Data for column '%s' too long"
eng "Data for column '%s' too long"
ER_DROP_INDEX_FK
ER_DROP_INDEX_FK
eng "Cannot drop index '%-.64s': needed in a foreign key constraint"
eng "Cannot drop index '%-.64s': needed in a foreign key constraint"
ger "Kann Index '%-.64s' nicht lschen: wird fr einen ei
nen Fr
emdschlssel bentigt"
ger "Kann Index '%-.64s' nicht lschen: wird fr einen Fremdschlssel bentigt"
ER_CANT_WRITE_LOCK_LOG_TABLE
ER_CANT_WRITE_LOCK_LOG_TABLE
eng "You can't write-lock a log table. Only read access is possible."
eng "You can't write-lock a log table. Only read access is possible."
ER_CANT_READ_LOCK_LOG_TABLE
ER_CANT_READ_LOCK_LOG_TABLE
...
...
sql/sql_yacc.yy
View file @
7c75bab1
...
@@ -1434,6 +1434,16 @@ ev_schedule_time: EVERY_SYM expr interval
...
@@ -1434,6 +1434,16 @@ ev_schedule_time: EVERY_SYM expr interval
yyerror(ER(ER_SYNTAX_ERROR));
yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
YYABORT;
break;
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:
case EVEX_BAD_PARAMS:
my_error(ER_EVENT_EXEC_TIME_IN_THE_PAST, MYF(0));
my_error(ER_EVENT_EXEC_TIME_IN_THE_PAST, MYF(0));
YYABORT;
YYABORT;
...
@@ -1466,7 +1476,25 @@ ev_starts: /* empty */
...
@@ -1466,7 +1476,25 @@ ev_starts: /* empty */
{
{
LEX *lex= Lex;
LEX *lex= Lex;
if (!lex->et_compile_phase)
if (!lex->et_compile_phase)
lex->et->init_starts(YYTHD, $2);
{
switch (lex->et->init_starts(YYTHD, $2)) {
case EVEX_PARSE_ERROR:
yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
break;
case EVEX_BAD_PARAMS:
{
char buff[20];
String str(buff,(uint32) sizeof(buff), system_charset_info);
String *str2= $2->val_str(&str);
my_error(ER_WRONG_VALUE, MYF(0), "STARTS", str2? str2->c_ptr():
NULL);
YYABORT;
break;
}
}
}
}
}
;
;
...
...
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