summaryrefslogtreecommitdiff
path: root/sql/item_buff.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_buff.cc')
-rw-r--r--sql/item_buff.cc85
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);
+}
+