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
a3c893e0
Commit
a3c893e0
authored
Aug 19, 2005
by
jimw@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix cases where SLEEP() calls would get optimized away or cached. (Bug #12689)
parent
dd1e0fb8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
0 deletions
+54
-0
mysql-test/r/func_misc.result
mysql-test/r/func_misc.result
+24
-0
mysql-test/t/func_misc.test
mysql-test/t/func_misc.test
+23
-0
sql/item_create.cc
sql/item_create.cc
+1
-0
sql/item_func.h
sql/item_func.h
+6
-0
No files found.
mysql-test/r/func_misc.result
View file @
a3c893e0
...
...
@@ -70,3 +70,27 @@ select timediff(b, a) >= '00:00:03' from t1;
timediff(b, a) >= '00:00:03'
1
drop table t1;
set global query_cache_size=1355776;
create table t1 (a int);
insert into t1 values (1),(1),(1);
create table t2 (a datetime default null, b datetime default null);
insert into t2 set a = now();
select a from t1 where sleep(1);
a
update t2 set b = now() where b is null;
insert into t2 set a = now();
select a from t1 where sleep(a);
a
update t2 set b = now() where b is null;
insert into t2 set a = now();
select a from t1 where sleep(1);
a
update t2 set b = now() where b is null;
select timediff(b, a) >= '00:00:03' from t2;
timediff(b, a) >= '00:00:03'
1
1
1
drop table t2;
drop table t1;
set global query_cache_size=default;
mysql-test/t/func_misc.test
View file @
a3c893e0
...
...
@@ -55,3 +55,26 @@ select sleep(3);
update
t1
set
b
=
now
();
select
timediff
(
b
,
a
)
>=
'00:00:03'
from
t1
;
drop
table
t1
;
#
# Bug #12689: SLEEP() gets incorrectly cached/optimized-away
#
set
global
query_cache_size
=
1355776
;
create
table
t1
(
a
int
);
insert
into
t1
values
(
1
),(
1
),(
1
);
create
table
t2
(
a
datetime
default
null
,
b
datetime
default
null
);
insert
into
t2
set
a
=
now
();
select
a
from
t1
where
sleep
(
1
);
update
t2
set
b
=
now
()
where
b
is
null
;
insert
into
t2
set
a
=
now
();
select
a
from
t1
where
sleep
(
a
);
update
t2
set
b
=
now
()
where
b
is
null
;
insert
into
t2
set
a
=
now
();
select
a
from
t1
where
sleep
(
1
);
update
t2
set
b
=
now
()
where
b
is
null
;
select
timediff
(
b
,
a
)
>=
'00:00:03'
from
t2
;
drop
table
t2
;
drop
table
t1
;
set
global
query_cache_size
=
default
;
# End of 5.0 tests
sql/item_create.cc
View file @
a3c893e0
...
...
@@ -356,6 +356,7 @@ Item *create_func_sha(Item* a)
Item
*
create_func_sleep
(
Item
*
a
)
{
current_thd
->
lex
->
uncacheable
(
UNCACHEABLE_SIDEEFFECT
);
return
new
Item_func_sleep
(
a
);
}
...
...
sql/item_func.h
View file @
a3c893e0
...
...
@@ -893,7 +893,13 @@ class Item_func_sleep :public Item_int_func
{
public:
Item_func_sleep
(
Item
*
a
)
:
Item_int_func
(
a
)
{}
bool
const_item
()
const
{
return
0
;
}
const
char
*
func_name
()
const
{
return
"sleep"
;
}
void
update_used_tables
()
{
Item_int_func
::
update_used_tables
();
used_tables_cache
|=
RAND_TABLE_BIT
;
}
longlong
val_int
();
};
...
...
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