diff options
author | Nikita Malyavin <nikitamalyavin@gmail.com> | 2021-02-02 05:18:52 +1000 |
---|---|---|
committer | Nikita Malyavin <nikitamalyavin@gmail.com> | 2021-02-02 05:23:08 +1000 |
commit | ee11d0378baa517886c8185322c0d1e514b71612 (patch) | |
tree | e5d16124f573310ef11345a93f02ca0e168a0acf | |
parent | 73448bd108c514f8bdb42355fd66fbe70923563f (diff) | |
download | mariadb-git-bb-10.6-MDEV-16976.tar.gz |
calculate overlapsbb-10.6-MDEV-16976
-rw-r--r-- | sql/item_period.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/item_period.h b/sql/item_period.h index 376773c9269..7d83c495e5b 100644 --- a/sql/item_period.h +++ b/sql/item_period.h @@ -30,16 +30,21 @@ public: class Item_func_overlaps: public Item_bool_func // TODO Item_bool_func2 { + // We remember the operands to access args without type downcast + Item_row *left, *right; public: Item_func_overlaps(THD *thd, Item_row *left, Item_row *right) - : Item_bool_func(thd, left, right) + : Item_bool_func(thd, left, right), left(left), right(right) { - } longlong val_int() { + longlong al= left->element_index(0)->val_int(); + longlong ar= left->element_index(0)->val_int(); + longlong br= right->element_index(1)->val_int(); + return br <= ar && br > al; } const char *func_name() const { return "overlaps"; } Item *get_copy(THD *thd) |