summaryrefslogtreecommitdiff
path: root/sql/item_func.h
diff options
context:
space:
mode:
authorkroki@mysql.com <>2006-04-12 19:31:00 +0400
committerkroki@mysql.com <>2006-04-12 19:31:00 +0400
commitc8e22ff70b2e8f26e6e7f5465402d89d7616a2e9 (patch)
tree79c3147160f25f4c191b0d31943796b18cc50c8d /sql/item_func.h
parent739ee02cf6a718670712538b3c9c2c865e60c690 (diff)
downloadmariadb-git-c8e22ff70b2e8f26e6e7f5465402d89d7616a2e9.tar.gz
Bug#16461: connection_id() does not work properly inside trigger
CONNECTION_ID() was implemented as a constant Item, i.e. an instance of Item_static_int_func class holding value computed at creation time. Since Items are created on parsing, and trigger statements are parsed on table open, the first connection to open a particular table would effectively set its own CONNECTION_ID() inside trigger statements for that table. Re-implement CONNECTION_ID() as a class derived from Item_int_func, and compute connection_id on every call to fix_fields().
Diffstat (limited to 'sql/item_func.h')
-rw-r--r--sql/item_func.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/sql/item_func.h b/sql/item_func.h
index ccbbbab1df4..ed5924e8fe1 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -279,6 +279,18 @@ public:
};
+class Item_func_connection_id :public Item_int_func
+{
+ longlong value;
+
+public:
+ const char *func_name() const { return "connection_id"; }
+ void fix_length_and_dec();
+ bool fix_fields(THD *thd, Item **ref);
+ longlong val_int() { DBUG_ASSERT(fixed == 1); return value; }
+};
+
+
class Item_func_signed :public Item_int_func
{
public: