summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-11-04 11:16:13 +0100
committerSergei Golubchik <serg@mariadb.org>2016-12-12 20:27:24 +0100
commitfd0044041bf70d5d8bbb530285055da585384ff1 (patch)
tree0cf9923eaeeb9facd2751e3b8df67f9b1394079c /sql/item_timefunc.cc
parent867809f23a8f09b1ac0aa8f9212ac8afd572efc5 (diff)
downloadmariadb-git-fd0044041bf70d5d8bbb530285055da585384ff1.tar.gz
don't convert WEEK(x) to WEEK(x, @@default_week_format)
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r--sql/item_timefunc.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 5e0ae028d88..c35606781ec 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1044,13 +1044,15 @@ uint week_mode(uint mode)
longlong Item_func_week::val_int()
{
DBUG_ASSERT(fixed == 1);
- uint year;
+ uint year, week_format;
MYSQL_TIME ltime;
if (get_arg0_date(&ltime, TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE))
return 0;
- return (longlong) calc_week(&ltime,
- week_mode((uint) args[1]->val_int()),
- &year);
+ if (arg_count > 1)
+ week_format= args[1]->val_int();
+ else
+ week_format= current_thd->variables.default_week_format;
+ return (longlong) calc_week(&ltime, week_mode(week_format), &year);
}