-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Exception e wrote:
> First of, you might consider this question also helpful:
> http://stackoverflow.com/questions/1579638/what-is-the-best-way-to-represent-recurring-events-in-database

Thanks for the pointer, some good discussion there.

>> This is essentially what I am doing now, basically modeled after crontab
>> as I originally mentioned. I've only got a column for day, month and
>> weekday so far, but it is easy to add additional columns at a later date
>> as requirements become more complex.
>>
>> Finding the next date is currently a matter of looping through the days
>> and seeing if they match all criteria (limited to checking one year
>> ahead to prevent an infinite loop). That part can probably be refactored
>> later, but it works for now.
>>
> That's a pain indeed. I think this can be optimized.
> Maybe you should also look at the possibility to generate and store all
> matchting dates in the databases, making it easier to perform difficult
> selects.

That sounds like that plan of attack. Storing them pretty much as I've
described (pseudo crontab format - simplified to start with) then on
save (or on a schedule, depending on speed). Add future dates to the
schedule to allow for easy querying.

Thanks for the input.

- --

Brenton Alker
PHP Developer - Brisbane, Australia

http://blog.tekerson.com/
http://twitter.com/tekerson

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkrlcNYACgkQ7bkAtAithuuDDACZAZ/rcKkEahCuM1d2iYuSA+9d
7GUAn1Uu+PHuc89Efn69AnEQzk+ImUfD
=syjV
-----END PGP SIGNATURE-----

Reply via email to