diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2021-04-21 22:14:08 +0300 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2021-04-27 09:08:44 +0300 |
commit | 6d73282b136058deb992fdb758d8992fa186e73e (patch) | |
tree | e2b54ef9d0693ccd658ff5068a97ccbd3fc1ccc4 /sql/item_vers.h | |
parent | 29b2f3dbb543130a7ba71635216a8d7d34cac46e (diff) | |
download | mariadb-git-6d73282b136058deb992fdb758d8992fa186e73e.tar.gz |
MDEV-25468 DELETE HISTORY may delete current data on system-versioned table
Item_func_history (is_history()) is a bool function that checks if the
row is the history row by checking row_end->is_max(). The argument to
this function must be row_end system field.
Added the above function to conjunction with SYSTEM_TIME_BEFORE
versioning condition.
Diffstat (limited to 'sql/item_vers.h')
-rw-r--r-- | sql/item_vers.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/sql/item_vers.h b/sql/item_vers.h index 8b9c0e6056c..2be3f683913 100644 --- a/sql/item_vers.h +++ b/sql/item_vers.h @@ -22,6 +22,36 @@ #pragma interface /* gcc class implementation */ #endif +class Item_func_history: public Item_bool_func +{ +public: + /* + @param a Item_field for row_end system field + */ + Item_func_history(THD *thd, Item *a): Item_bool_func(thd, a) + { + DBUG_ASSERT(a->type() == Item::FIELD_ITEM); + } + + virtual bool val_bool(); + virtual longlong val_int() + { + return (val_bool() ? 1 : 0); + } + bool fix_length_and_dec() + { + maybe_null= 0; + null_value= 0; + decimals= 0; + max_length= 1; + return FALSE; + } + virtual const char* func_name() const { return "is_history"; } + virtual void print(String *str, enum_query_type query_type); + Item *get_copy(THD *thd) + { return get_item_copy<Item_func_history>(thd, this); } +}; + class Item_func_trt_ts: public Item_datetimefunc { TR_table::field_id_t trt_field; |