summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 2077a6e5455..bc76d05a05b 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -3395,10 +3395,21 @@ String *Field_time::val_str(String *val_buffer,
}
-bool Field_time::get_date(TIME *ltime,
- bool fuzzydate __attribute__((unused)))
+/*
+ Normally we would not consider 'time' as a vaild date, but we allow
+ get_date() here to be able to do things like
+ DATE_FORMAT(time, "%l.%i %p")
+*/
+
+bool Field_time::get_date(TIME *ltime, uint fuzzydate)
{
- long tmp=(long) sint3korr(ptr);
+ long tmp;
+ if (!fuzzydate)
+ {
+ set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
+ return 1;
+ }
+ tmp=(long) sint3korr(ptr);
ltime->neg=0;
if (tmp < 0)
{