summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-02-09 13:59:41 +0100
committerunknown <monty@mysql.com>2004-02-09 13:59:41 +0100
commit74b81a801785058706b46a1e75b67b026c468d04 (patch)
tree8a4c27f40f9f6b198bd0c9b9b5a7bf3c49138f78 /sql/item_timefunc.cc
parent1c810278bd5e1d69f8612b047784e46b4ba7cd46 (diff)
downloadmariadb-git-74b81a801785058706b46a1e75b67b026c468d04.tar.gz
Ensure that result from date_format() is binary
Removed warnings from test suite mysql-test/r/ctype_utf8.result: Update results after fix of return argument from date_format() mysql-test/r/date_formats.result: Remove unnecessary warnings mysql-test/r/type_decimal.result: Remove unnecessary warnings mysql-test/r/warnings.result: Remove unnecessary warnings mysql-test/t/ctype_utf8.test: Fixed test mysql-test/t/date_formats.test: Remove unnecessary warnings mysql-test/t/type_decimal.test: Remove unnecessary warnings mysql-test/t/warnings.test: Remove unnecessary warnings sql/field.cc: Optimize sql/item_timefunc.cc: Ensure that result from date_format() is binary strings/ctype-simple.c: Better names for arguments
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r--sql/item_timefunc.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 062e7fc7b44..32fbe192d8f 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1283,16 +1283,21 @@ longlong Item_func_sec_to_time::val_int()
void Item_func_date_format::fix_length_and_dec()
{
decimals=0;
+ collation.set(&my_charset_bin);
if (args[1]->type() == STRING_ITEM)
{ // Optimize the normal case
fixed_length=1;
- max_length= format_length(((Item_string*) args[1])->const_string())*
- collation.collation->mbmaxlen;
+ /*
+ The result is a binary string (no reason to use collation->mbmaxlen
+ This is becasue make_date_time() only returns binary strings
+ */
+ max_length= format_length(((Item_string*) args[1])->const_string());
}
else
{
fixed_length=0;
- max_length=args[1]->max_length*10*collation.collation->mbmaxlen;
+ /* The result is a binary string (no reason to use collation->mbmaxlen */
+ max_length=args[1]->max_length*10;
set_if_smaller(max_length,MAX_BLOB_WIDTH);
}
maybe_null=1; // If wrong date