Simon Perreault wrote:
On Thursday 05 May 2005 13:31, Flavio S. Glock wrote:

Flavio S. Glock wrote:

I'm working on a module that translates datetime sets into SQL
statements.


Can you explain how you can serialize infinite sets?


$ perl -Ilib -MDateTime::Format::SQL -e ' print DateTime::Format::SQL->format_set( set => DateTime::Event::Recurrence->yearly( months => 7, days => 5 ), table_name => 'MY_RECURRENCE', lazy => 1 ) '


Yields (this still needs some optimization):

CREATE VIEW MY_RECURRENCE_28403 ( N ) AS
    SELECT ( N + INTERVAL '7 MONTH' ) FROM DT_YEAR;
CREATE VIEW MY_RECURRENCE_83554 ( N ) AS
    SELECT ( N + INTERVAL '5 DAY' ) FROM MY_RECURRENCE_28403;
CREATE VIEW MY_RECURRENCE ( N ) AS
    SELECT ( N ) FROM MY_RECURRENCE_83554;

You are responsible for maintaining the "DT_YEAR" table - it may be as big as needed.

> Is it possible to do a
> query such as "which sets intersect with today?" on the SQL
> data resulting from that serialization?

Yes, this is just a normal table.

- Flavio S. Glock

Reply via email to