diff options
author | unknown <monty@hundin.mysql.fi> | 2001-08-21 13:44:01 +0300 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2001-08-21 13:44:01 +0300 |
commit | 023cbef04c5bec28e939d5076c5f329ab7f3994f (patch) | |
tree | 4e64a1ec67abe449474688af7b06340fac1019d7 /sql/time.cc | |
parent | f3171b49b3507b84b5f26bdaf73932495741d7fc (diff) | |
download | mariadb-git-023cbef04c5bec28e939d5076c5f329ab7f3994f.tar.gz |
Remove usage of my_dup(), as this casued error 127 when reading MyISAM tables
New definition of WEEK().
Docs/manual.texi:
Changelog
myisam/mi_cache.c:
Better logging on error
myisam/mi_open.c:
Remove usage of my_dup(), as this casued error 127 when reading tables
mysql-test/r/func_time.result:
More tests for the WEEK/YEARWEEK function
mysql-test/t/func_time.test:
More tests for the WEEK/YEARWEEK function
sql/time.cc:
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); |