summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
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/item_timefunc.cc
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/item_timefunc.cc')
-rw-r--r--sql/item_timefunc.cc33
1 files changed, 24 insertions, 9 deletions
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;