summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2006-08-23 01:03:28 +0400
committerunknown <evgen@moonbone.local>2006-08-23 01:03:28 +0400
commitd8c9de79f44dec1139046af7f7605f01e15d03fd (patch)
tree7c1a1020bdab14e6eeffc149cd1864bece92c32c
parent3a23139aa4215c9fac16300ea9af1a626eb04026 (diff)
downloadmariadb-git-d8c9de79f44dec1139046af7f7605f01e15d03fd.tar.gz
item_cmpfunc.cc, item.cc:
Additional fix for bug #21475 item_func.h, item_func.cc: Additional fix for bug#16861 sql/item_func.h: Additional fix for bug#16861 sql/item_func.cc: Additional fix for bug#16861 sql/item_cmpfunc.cc: Additional fix for bug #21475 sql/item.cc: Additional fix for bug #21475
-rw-r--r--sql/item.cc7
-rw-r--r--sql/item_cmpfunc.cc1
-rw-r--r--sql/item_func.cc13
-rw-r--r--sql/item_func.h1
4 files changed, 20 insertions, 2 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 73f2f5790a1..96b20d0f0bb 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -305,6 +305,7 @@ Item::Item():
maybe_null=null_value=with_sum_func=unsigned_flag=0;
decimals= 0; max_length= 0;
with_subselect= 0;
+ cmp_context= (Item_result)-1;
/* Put item in free list so that we can free all items at end */
THD *thd= current_thd;
@@ -343,7 +344,8 @@ Item::Item(THD *thd, Item *item):
unsigned_flag(item->unsigned_flag),
with_sum_func(item->with_sum_func),
fixed(item->fixed),
- collation(item->collation)
+ collation(item->collation),
+ cmp_context(item->cmp_context)
{
next= thd->free_list; // Put in free list
thd->free_list= this;
@@ -3788,7 +3790,8 @@ Item *Item_field::equal_fields_propagator(byte *arg)
The same problem occurs when comparing a DATE/TIME field with a
DATE/TIME represented as an int and as a string.
*/
- if (!item || item->cmp_context != cmp_context)
+ if (!item ||
+ (cmp_context != (Item_result)-1 && item->cmp_context != cmp_context))
item= this;
return item;
}
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index c72ff53c3a5..dbf380232c4 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1220,6 +1220,7 @@ void Item_func_between::fix_length_and_dec()
if (!args[0] || !args[1] || !args[2])
return;
agg_cmp_type(thd, &cmp_type, args, 3);
+ args[0]->cmp_context= args[1]->cmp_context= args[2]->cmp_context= cmp_type;
if (cmp_type == STRING_RESULT)
agg_arg_charsets(cmp_collation, args, 3, MY_COLL_CMP_CONV, 1);
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 36e8fd33729..e699669dcc5 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -3897,6 +3897,19 @@ bool Item_func_set_user_var::send(Protocol *protocol, String *str_arg)
return Item::send(protocol, str_arg);
}
+void Item_func_set_user_var::make_field(Send_field *tmp_field)
+{
+ if (result_field)
+ {
+ result_field->make_field(tmp_field);
+ DBUG_ASSERT(tmp_field->table_name != 0);
+ if (Item::name)
+ tmp_field->col_name=Item::name; // Use user supplied name
+ }
+ else
+ Item::make_field(tmp_field);
+}
+
String *
Item_func_get_user_var::val_str(String *str)
{
diff --git a/sql/item_func.h b/sql/item_func.h
index 09429accbad..c15b0b854b0 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -1175,6 +1175,7 @@ public:
bool update_hash(void *ptr, uint length, enum Item_result type,
CHARSET_INFO *cs, Derivation dv, bool unsigned_arg= 0);
bool send(Protocol *protocol, String *str_arg);
+ void make_field(Send_field *tmp_field);
bool check(bool use_result_field);
bool update();
enum Item_result result_type () const { return cached_result_type; }