diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2016-03-06 23:10:20 +0300 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2016-03-06 23:10:20 +0300 |
commit | 1fa12cdfb7d580955d664f6a842f7a2ab6363ad4 (patch) | |
tree | 2cbdd56cca80313b1edbb092a23310dbd8e27645 /sql/item_buff.cc | |
parent | b579a626cfac8b2f004812bfc4fe807cfff46268 (diff) | |
download | mariadb-git-1fa12cdfb7d580955d664f6a842f7a2ab6363ad4.tar.gz |
MDEV-9676: RANGE-type frames for window functions
Support RANGE ... CURRENT ROW as frame's first and second bound.
Diffstat (limited to 'sql/item_buff.cc')
-rw-r--r-- | sql/item_buff.cc | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/sql/item_buff.cc b/sql/item_buff.cc index 62c2f76dc2e..3798aad06f0 100644 --- a/sql/item_buff.cc +++ b/sql/item_buff.cc @@ -98,6 +98,25 @@ bool Cached_item_str::cmp(void) return tmp; } + +int Cached_item_str::cmp_read_only() +{ + String *res= item->val_str(&tmp_value); + + if (null_value) + { + if (item->null_value) + return 0; + else + return -1; + } + if (item->null_value) + return 1; + + return sortcmp(&value, res, item->collation.collation); +} + + Cached_item_str::~Cached_item_str() { item=0; // Safety @@ -115,6 +134,23 @@ bool Cached_item_real::cmp(void) return FALSE; } + +int Cached_item_real::cmp_read_only() +{ + double nr= item->val_real(); + if (null_value) + { + if (item->null_value) + return 0; + else + return -1; + } + if (item->null_value) + return 1; + return (nr == value)? 0 : ((nr < value)? 1: -1); +} + + bool Cached_item_int::cmp(void) { longlong nr=item->val_int(); @@ -128,6 +164,22 @@ bool Cached_item_int::cmp(void) } +int Cached_item_int::cmp_read_only() +{ + longlong nr= item->val_int(); + if (null_value) + { + if (item->null_value) + return 0; + else + return -1; + } + if (item->null_value) + return 1; + return (nr == value)? 0 : ((nr < value)? 1: -1); +} + + bool Cached_item_field::cmp(void) { bool tmp= FALSE; // Value is identical @@ -148,6 +200,22 @@ bool Cached_item_field::cmp(void) } +int Cached_item_field::cmp_read_only() +{ + if (null_value) + { + if (field->is_null()) + return 0; + else + return -1; + } + if (field->is_null()) + return 1; + + return field->cmp(buff); +} + + Cached_item_decimal::Cached_item_decimal(Item *it) :item(it) { @@ -174,3 +242,20 @@ bool Cached_item_decimal::cmp() return FALSE; } + +int Cached_item_decimal::cmp_read_only() +{ + my_decimal tmp; + my_decimal *ptmp= item->val_decimal(&tmp); + if (null_value) + { + if (item->null_value) + return 0; + else + return -1; + } + if (item->null_value) + return 1; + return my_decimal_cmp(&value, ptmp); +} + |