summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <jani@ua141d10.elisa.omakaista.fi>2005-10-28 02:36:19 +0300
committerunknown <jani@ua141d10.elisa.omakaista.fi>2005-10-28 02:36:19 +0300
commit1b574f5bdf347ddfeea3b6b704f1089ebb99ea98 (patch)
tree15e24b28ea84bf971a840e358e58bfdcfb90ebe9 /sql
parent7911c50718fa27c2fa56e99d765b54267481a8d2 (diff)
downloadmariadb-git-1b574f5bdf347ddfeea3b6b704f1089ebb99ea98.tar.gz
Merge 4.1 - 5.0
mysql-test/r/insert_select.result: Merge from 4.1 to 5.0. mysql-test/r/select.result: Merge from 4.1 to 5.0. mysql-test/t/insert_select.test: Merge from 4.1 to 5.0. mysys/my_handler.c: Merge from 4.1 to 5.0. sql/item.cc: Merge from 4.1 to 5.0. sql/item_timefunc.cc: Imported bug fix from 4.1 to 5.0. (Bug#14016) sql/item_timefunc.h: Imported bug fix from 4.1 to 5.0. (Bug#14016)
Diffstat (limited to 'sql')
-rw-r--r--sql/item.cc3
-rw-r--r--sql/item_timefunc.cc33
-rw-r--r--sql/item_timefunc.h1
3 files changed, 27 insertions, 10 deletions
diff --git a/sql/item.cc b/sql/item.cc
index c95b214d36f..015657e4ac4 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -755,7 +755,8 @@ bool Item_string::eq(const Item *item, bool binary_cmp) const
{
if (binary_cmp)
return !stringcmp(&str_value, &item->str_value);
- return !sortcmp(&str_value, &item->str_value, collation.collation);
+ return (collation.collation == item->collation.collation &&
+ !sortcmp(&str_value, &item->str_value, collation.collation));
}
return 0;
}
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 4e6087baef9..7f847005966 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1612,15 +1612,6 @@ void Item_func_date_format::fix_length_and_dec()
fixed_length=1;
/*
- Force case sensitive collation on format string.
- This needed because format modifiers with different case,
- for example %m and %M, have different meaning. Thus eq()
- will distinguish them.
- */
- args[1]->collation.set(
- get_charset_by_csname(args[1]->collation.collation->csname,
- MY_CS_BINSORT,MYF(0)), DERIVATION_COERCIBLE);
- /*
The result is a binary string (no reason to use collation->mbmaxlen
This is becasue make_date_time() only returns binary strings
*/
@@ -1637,6 +1628,30 @@ void Item_func_date_format::fix_length_and_dec()
}
+bool Item_func_date_format::eq(const Item *item, bool binary_cmp) const
+{
+ Item_func_date_format *item_func;
+ if (item->type() != FUNC_ITEM)
+ return 0;
+ if (func_name() != ((Item_func*) item)->func_name())
+ return 0;
+ if (this == item)
+ return 1;
+ item_func= (Item_func_date_format*) item;
+ if (!args[0]->eq(item_func->args[0], binary_cmp))
+ return 0;
+ /*
+ We must compare format string case sensitive.
+ This needed because format modifiers with different case,
+ for example %m and %M, have different meaning.
+ */
+ if (!args[1]->eq(item_func->args[1], 1))
+ return 0;
+ return 1;
+}
+
+
+
uint Item_func_date_format::format_length(const String *format)
{
uint size=0;
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index 8e15acbc1fc..196966f5388 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -537,6 +537,7 @@ public:
{ return is_time_format ? "time_format" : "date_format"; }
void fix_length_and_dec();
uint format_length(const String *format);
+ bool eq(const Item *item, bool binary_cmp) const;
};