Note that there are some explanatory texts on larger screens.

plurals
  1. POSQL Infinite Calendar Pattern
    primarykey
    data
    text
    <p>I'm going to make a Mysql based calendar system where you can have repeating pattern for lets say every monday forever and ever. It must also cover static/once-only events. What I'm wondering about, is which solution would be most logical (and best) for me to use. I have four methods which I'm wondering to chose between.</p> <h2>Method #1</h2> <p>Make a function which accepts parameters <code>from</code> and <code>to</code>. This function would create a temporary table table which imports existing static schedule through <code>INSERT ... SELECT</code>. Afterward it would read of the pattern table and populate the temporary table through the peroid based on <code>from</code> and <code>to</code>.</p> <p>This solution seems nice from the point of view that queries will be simplier to fetch data with and it works into infinity since you can just repopulate the table depending of which month you're loading. What I'm curious about is whenever this might be a laggy way to do it or not.</p> <h2>Method #2</h2> <p>Create and join given patterns through a subquery and <code>JOIN</code> with static calendar.</p> <p>This seems to be rather annoying since the queries would be a lot more bigger and would probably not be good at all(?).</p> <h2>Method #3</h2> <p>Basicly just <code>INSERT</code> pattern for lets say one year ahead. Then I guess a cron job would repopulate to make it one year ahead always.</p> <p>This is a simple way to do it, but it feels like a lot of unneeded data stored and it doesn't really give the infinity which I'm after.</p> <h2>Method #4 (Suggested by Veger)</h2> <p>If I understand correctly, this method would fetch the pattern from another query and creates events upon execution. It's similar to my thoughts regarding Method #1 in that way that I consider simple pattern to create several rows.</p> <p>However if this would be implemented outside Mysql, I would loose some database functionality which I'm after.</p> <hr> <p>I hope you guys understood my situation, and if you could suggest either given and argue why it's the best or give another solution.</p> <p>Personally I like the Method #1 the most, but I'm curious if it's laggy to repopulate the calendar table each and every call.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload