summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2011-03-18 13:43:33 +0100
committerSergei Golubchik <sergii@pisem.net>2011-03-18 13:43:33 +0100
commit5ff5c4b8a32a74501aace277766df4c336c62157 (patch)
tree7b1bdc32928b43789b53f6795473fd7718b7e4b8 /sql/field.cc
parent1a963822c80ada2ea82a8a07c09870070fb6a820 (diff)
downloadmariadb-git-5ff5c4b8a32a74501aace277766df4c336c62157.tar.gz
lp:737111 Different behavior for TIMESTAMPADD with 0000-00-00 argument in 5.1-micro
respect fuzzydate flags in Item_*::get_date() methods
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 16b250ed63c..4ff9f83f5cc 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5869,8 +5869,11 @@ bool Field_newdate::get_date(MYSQL_TIME *ltime,uint fuzzydate)
ltime->year= (tmp >> 9);
ltime->time_type= MYSQL_TIMESTAMP_DATE;
ltime->hour= ltime->minute= ltime->second= ltime->second_part= ltime->neg= 0;
- return ((!(fuzzydate & TIME_FUZZY_DATE) && (!ltime->month || !ltime->day)) ?
- 1 : 0);
+ if ((fuzzydate & TIME_NO_ZERO_DATE) && !tmp)
+ return 1;
+ if (!(fuzzydate & TIME_FUZZY_DATE) && (!ltime->month || !ltime->day))
+ return 1;
+ return 0;
}