summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r--sql/item_timefunc.cc32
1 files changed, 21 insertions, 11 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index eb9b1423c78..1e222fddcfc 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1,15 +1,15 @@
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
@@ -672,7 +672,7 @@ String *Item_func_date_format::val_str(String *str)
else
size=format_length(format);
if (format == str)
- str=&value; // Save result here
+ str= &value; // Save result here
if (str->alloc(size))
{
null_value=1;
@@ -683,7 +683,7 @@ String *Item_func_date_format::val_str(String *str)
/* Create the result string */
const char *ptr=format->ptr();
const char *end=ptr+format->length();
- for ( ; ptr != end ; ptr++)
+ for (; ptr != end ; ptr++)
{
if (*ptr != '%' || ptr+1 == end)
str->append(*ptr);
@@ -691,7 +691,7 @@ String *Item_func_date_format::val_str(String *str)
{
switch (*++ptr) {
case 'M':
- if(!l_time.month)
+ if (!l_time.month)
{
null_value=1;
return 0;
@@ -699,7 +699,7 @@ String *Item_func_date_format::val_str(String *str)
str->append(month_names[l_time.month-1]);
break;
case 'b':
- if(!l_time.month)
+ if (!l_time.month)
{
null_value=1;
return 0;
@@ -707,7 +707,7 @@ String *Item_func_date_format::val_str(String *str)
str->append(month_names[l_time.month-1].ptr(),3);
break;
case 'W':
- if(date_or_time)
+ if (date_or_time)
{
null_value=1;
return 0;
@@ -716,7 +716,7 @@ String *Item_func_date_format::val_str(String *str)
str->append(day_names[weekday]);
break;
case 'a':
- if(date_or_time)
+ if (date_or_time)
{
null_value=1;
return 0;
@@ -725,7 +725,7 @@ String *Item_func_date_format::val_str(String *str)
str->append(day_names[weekday].ptr(),3);
break;
case 'D':
- if(date_or_time)
+ if (date_or_time)
{
null_value=1;
return 0;
@@ -791,7 +791,7 @@ String *Item_func_date_format::val_str(String *str)
str->append(intbuff);
break;
case 'j':
- if(date_or_time)
+ if (date_or_time)
{
null_value=1;
return 0;
@@ -1123,3 +1123,13 @@ longlong Item_extract::val_int()
}
return 0; // Impossible
}
+
+
+void Item_typecast::print(String *str)
+{
+ str->append("CAST(");
+ args[0]->print(str);
+ str->append(" AS ");
+ str->append(func_name());
+ str->append(')');
+}