summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
diff options
context:
space:
mode:
authorMikael Ronstrom <mikael@mysql.com>2009-09-15 17:07:52 +0200
committerMikael Ronstrom <mikael@mysql.com>2009-09-15 17:07:52 +0200
commit6942c25e733967e4d3da8aaad3b2e9a2832dc33e (patch)
treeee714c9620c9eaa85fba98f4423487d638cc9edf /sql/item_timefunc.cc
parent905d715f10e711860311e0a10488c6bb5e19ee49 (diff)
downloadmariadb-git-6942c25e733967e4d3da8aaad3b2e9a2832dc33e.tar.gz
WL#3352, Introducing Column list partitioning, makes it possible to partition on most data types, makes it possible to prune on multi-field partitioning
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r--sql/item_timefunc.cc33
1 files changed, 33 insertions, 0 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index d79b0b02998..bad9b85b2b6 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -941,6 +941,27 @@ longlong Item_func_to_days::val_int()
}
+longlong Item_func_to_seconds::val_int_endpoint(bool left_endp,
+ bool *incl_endp)
+{
+ longlong res= val_int();
+ return null_value ? LONGLONG_MIN : res;
+}
+
+longlong Item_func_to_seconds::val_int()
+{
+ DBUG_ASSERT(fixed == 1);
+ MYSQL_TIME ltime;
+ longlong seconds;
+ longlong days;
+ if (get_arg0_date(&ltime, TIME_NO_ZERO_DATE))
+ return 0;
+ seconds=ltime.hour*3600L+ltime.minute*60+ltime.second;
+ seconds=ltime.neg ? -seconds : seconds;
+ days= (longlong) calc_daynr(ltime.year,ltime.month,ltime.day);
+ return (seconds + days * (24L * 3600L));
+}
+
/*
Get information about this Item tree monotonicity
@@ -967,6 +988,18 @@ enum_monotonicity_info Item_func_to_days::get_monotonicity_info() const
return NON_MONOTONIC;
}
+enum_monotonicity_info Item_func_to_seconds::get_monotonicity_info() const
+{
+ if (args[0]->type() == Item::FIELD_ITEM)
+ {
+ if (args[0]->field_type() == MYSQL_TYPE_DATE)
+ return MONOTONIC_STRICT_INCREASING;
+ if (args[0]->field_type() == MYSQL_TYPE_DATETIME)
+ return MONOTONIC_INCREASING;
+ }
+ return NON_MONOTONIC;
+}
+
longlong Item_func_to_days::val_int_endpoint(bool left_endp, bool *incl_endp)
{