summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorjimw@mysql.com <>2005-08-19 15:51:40 -0700
committerjimw@mysql.com <>2005-08-19 15:51:40 -0700
commita3c893e0b8cc630cef295b70b6779f133b9b9eb3 (patch)
treeeb83e995b3e5e80628e119c0486767207a3c8e08 /sql
parentdd1e0fb8c7f07b20eeae0857a265a6afe16d8a50 (diff)
downloadmariadb-git-a3c893e0b8cc630cef295b70b6779f133b9b9eb3.tar.gz
Fix cases where SLEEP() calls would get optimized away or cached. (Bug #12689)
Diffstat (limited to 'sql')
-rw-r--r--sql/item_create.cc1
-rw-r--r--sql/item_func.h6
2 files changed, 7 insertions, 0 deletions
diff --git a/sql/item_create.cc b/sql/item_create.cc
index 8798bf889fc..77476e41d0b 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -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);
}
diff --git a/sql/item_func.h b/sql/item_func.h
index 1f25b762b70..384cb486f7c 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -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();
};