Reputation: 13366
This table: sysschedules
If the freq_type
is 8 (weekly) then freq_interval
is 1,2,4,8,16,32,64 for Su,M,T,W,Th,F,S.
But when freq_type
is 32 (monthly relative) then freq_interval
is 1,2,3,4,5,6,7,8,9,10 for Su,M,T,W,Th,F,S, weekday, weekend.
Why is this? Is there some sort of calculation occurring to reduce query complexity?
If so, how? (sry if I sound clueless, building a recurring events system is melting my brain)
Upvotes: 7
Views: 2153
Reputation: 239754
If freq_type
is 8, then the job can occur on one or more days - so there needs to be a way to represent multiple days in the freq_interval
column. This is done by assigning each day a power of two value, and so multiple values can be added together unambiguously. E.g. for something that occurs on Monday, Wednesday and Friday, the value would be 2+8+32 = 42. (Your question has the wrong values assigned to the days)
If freq_type
is 32, then only a single option can be selected - one day of the week, or day, weekday or weekend. Since multiple values cannot be combined, a simpler representation can be used.
Upvotes: 6