diff options
author | monty@hundin.mysql.fi <> | 2001-08-21 13:44:01 +0300 |
---|---|---|
committer | monty@hundin.mysql.fi <> | 2001-08-21 13:44:01 +0300 |
commit | 2662e135c76e6e363a7216dff4de45da997940a9 (patch) | |
tree | 4e64a1ec67abe449474688af7b06340fac1019d7 /sql/time.cc | |
parent | e743944f21c7b487c6950ce0f69a5f9648a700a8 (diff) | |
download | mariadb-git-2662e135c76e6e363a7216dff4de45da997940a9.tar.gz |
Remove usage of my_dup(), as this casued error 127 when reading MyISAM tables
New definition of WEEK().
Diffstat (limited to 'sql/time.cc')
-rw-r--r-- | sql/time.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/time.cc b/sql/time.cc index e0b74fc9d25..d1e0aee0fa4 100644 --- a/sql/time.cc +++ b/sql/time.cc @@ -176,7 +176,9 @@ uint calc_week(TIME *l_time, bool with_year, bool sunday_first_day_of_week, ulong first_daynr=calc_daynr(l_time->year,1,1); uint weekday=calc_weekday(first_daynr,sunday_first_day_of_week); *year=l_time->year; - if (l_time->month == 1 && weekday >= 4 && l_time->day <= 7-weekday) + if (l_time->month == 1 && l_time->day <= 7-weekday && + ((!sunday_first_day_of_week && weekday >= 4) || + (sunday_first_day_of_week && weekday != 0))) { /* Last week of the previous year */ if (!with_year) @@ -186,7 +188,8 @@ uint calc_week(TIME *l_time, bool with_year, bool sunday_first_day_of_week, first_daynr-= (days=calc_days_in_year(*year)); weekday= (weekday + 53*7- days) % 7; } - if (weekday >= 4) + if ((sunday_first_day_of_week && weekday != 0) || + (!sunday_first_day_of_week && weekday >= 4)) days= daynr - (first_daynr+ (7-weekday)); else days= daynr - (first_daynr - weekday); |