summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2003-08-06 15:37:22 +0200
committerunknown <serg@serg.mylan>2003-08-06 15:37:22 +0200
commite50930d36c33c4457d9ba6d68e5f6b2c6e622f11 (patch)
tree2d013e3cc70fc8c4d39eb14f3473bc2f81edd305 /sql/item_timefunc.cc
parent8edc3dedf91111fec2676addf981d9fa3c33edbb (diff)
downloadmariadb-git-e50930d36c33c4457d9ba6d68e5f6b2c6e622f11.tar.gz
Bug #792 combination of date-interval and between with mixed constant and non-constant
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r--sql/item_timefunc.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 84e7a44ac61..caea79314de 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1058,14 +1058,12 @@ String *Item_date_add_interval::val_str(String *str)
longlong Item_date_add_interval::val_int()
{
TIME ltime;
+ longlong date;
if (Item_date_add_interval::get_date(&ltime,0))
return (longlong) 0;
- return ((longlong) (((ulong) ltime.year)*10000L+
- (((uint) ltime.month)*100+
- (uint) ltime.day))*(longlong) 1000000L+
- (longlong) ((ulong) ((uint) ltime.hour)*10000L+
- (ulong) (((uint)ltime.minute)*100L+
- (uint) ltime.second)));
+ date = (ltime.year*100L + ltime.month)*100L + ltime.day;
+ return ltime.time_type == TIMESTAMP_DATE ? date :
+ ((date*100L + ltime.hour)*100L+ ltime.minute)*100L + ltime.second;
}
void Item_extract::fix_length_and_dec()