30 #include "sql_class.h"
42 if (item->real_item()->type() == Item::FIELD_ITEM &&
43 !(((
Item_field *) (item->real_item()))->field->flags & BLOB_FLAG))
46 Field *cached_field= use_result_field ? real_item->result_field :
50 switch (item->result_type()) {
52 if (item->is_temporal())
68 Cached_item::~Cached_item() {}
79 value_max_length(min<uint32>(arg->max_length, thd->variables.max_sort_length)),
80 value(value_max_length)
83 bool Cached_item_str::cmp(
void)
88 DBUG_ENTER(
"Cached_item_str::cmp");
89 DBUG_ASSERT(!item->is_temporal());
90 if ((res=item->val_str(&tmp_value)))
91 res->length(min(res->length(), value_max_length));
92 DBUG_PRINT(
"info", (
"old: %s, new: %s",
93 value.c_ptr_safe(), res ? res->c_ptr_safe() :
""));
94 if (null_value != item->null_value)
96 if ((null_value= item->null_value))
103 tmp= sortcmp(&value,res,item->collation.collation) != 0;
109 Cached_item_str::~Cached_item_str()
114 bool Cached_item_real::cmp(
void)
116 DBUG_ENTER(
"Cached_item_real::cmp");
117 double nr= item->val_real();
118 DBUG_PRINT(
"info", (
"old: %f, new: %f", value, nr));
119 if (null_value != item->null_value || nr != value)
121 null_value= item->null_value;
128 bool Cached_item_int::cmp(
void)
130 DBUG_ENTER(
"Cached_item_int::cmp");
131 longlong nr=item->val_int();
132 DBUG_PRINT(
"info", (
"old: %lld, new: %lld", value, nr));
133 if (null_value != item->null_value || nr != value)
135 null_value= item->null_value;
143 bool Cached_item_temporal::cmp(
void)
145 DBUG_ENTER(
"Cached_item_temporal::cmp");
146 longlong nr= item->val_temporal_by_field_type();
147 DBUG_PRINT(
"info", (
"old: %lld, new: %lld", value, nr));
148 if (null_value != item->null_value || nr != value)
150 null_value= item->null_value;
158 bool Cached_item_field::cmp(
void)
160 DBUG_ENTER(
"Cached_item_field::cmp");
161 DBUG_EXECUTE(
"info", dbug_print(););
163 bool different=
false;
165 if (field->is_null())
179 field->get_image(buff, length, field->charset());
181 else if (field->cmp(buff))
184 field->get_image(buff, length, field->charset());
188 DBUG_RETURN(different);
192 Cached_item_decimal::Cached_item_decimal(
Item *it)
195 my_decimal_set_zero(&value);
199 bool Cached_item_decimal::cmp()
203 if (null_value != item->null_value ||
206 null_value= item->null_value;
210 my_decimal2decimal(ptmp, &value);