summaryrefslogtreecommitdiff
path: root/sql/item.h
diff options
context:
space:
mode:
authoranozdrin@mysql.com <>2006-01-24 20:15:12 +0300
committeranozdrin@mysql.com <>2006-01-24 20:15:12 +0300
commit378147a23d2744f71fbfb677021c5901c811d156 (patch)
tree8b864c683f6cc00900b0bf9a6b84bc78cb1cf3e8 /sql/item.h
parentcf6becdebe856c27cb45e85615fb8d3a94d757c9 (diff)
downloadmariadb-git-378147a23d2744f71fbfb677021c5901c811d156.tar.gz
Fix for the following bugs:
- BUG#15166: Wrong update permissions required to execute triggers - BUG#15196: Wrong select permission required to execute triggers The idea of the fix is to check necessary privileges in Item_trigger_field::fix_fields(), instead of having "special variables" technique. To achieve this, we should pass to an Item_trigger_field instance a flag, which will indicate the usage/access type of this trigger variable.
Diffstat (limited to 'sql/item.h')
-rw-r--r--sql/item.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/sql/item.h b/sql/item.h
index eee9bc5b284..af42ce38b9b 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -2126,6 +2126,8 @@ public:
/* Is this item represents row from NEW or OLD row ? */
enum row_version_type {OLD_ROW, NEW_ROW};
row_version_type row_version;
+ /* Is this item used for reading or updating the value? */
+ enum access_types { AT_READ = 0x1, AT_UPDATE = 0x2 };
/* Next in list of all Item_trigger_field's in trigger */
Item_trigger_field *next_trg_field;
/* Index of the field in the TABLE::field array */
@@ -2135,18 +2137,24 @@ public:
Item_trigger_field(Name_resolution_context *context_arg,
row_version_type row_ver_arg,
- const char *field_name_arg)
+ const char *field_name_arg,
+ access_types access_type_arg)
:Item_field(context_arg,
(const char *)NULL, (const char *)NULL, field_name_arg),
- row_version(row_ver_arg), field_idx((uint)-1)
+ row_version(row_ver_arg), field_idx((uint)-1),
+ access_type(access_type_arg), table_grants(NULL)
{}
- void setup_field(THD *thd, TABLE *table);
+ void setup_field(THD *thd, TABLE *table, GRANT_INFO *table_grant_info);
enum Type type() const { return TRIGGER_FIELD_ITEM; }
bool eq(const Item *item, bool binary_cmp) const;
bool fix_fields(THD *, Item **);
void print(String *str);
table_map used_tables() const { return (table_map)0L; }
void cleanup();
+
+private:
+ access_types access_type;
+ GRANT_INFO *table_grants;
};