Re: Storing recurrences in a SQL DBMS?

2005-05-06 Thread Simon Perreault
On May 5, 2005 20:03, Dave Rolsky wrote: The set _is_ data! Sure, just as a procedure is data itself. This is data: sub sum { return shift + shift; } What's the difference between code and data eh? Is this data? sub closure { my $data = shift; return sub data { return $data; }

Re: Storing recurrences in a SQL DBMS?

2005-05-06 Thread Simon Perreault
On Friday 06 May 2005 11:13, Dave Rolsky wrote: The purpose of putting something in a DBMS is to ensure _correctness_ of the data, and to make it easier to query that data in a variety of ways, particularly in ways you did not anticipate when you first created the logical model. Speed may or

Re: Storing recurrences in a SQL DBMS?

2005-05-06 Thread Flavio S. Glock
Simon Perreault wrote: That would create N views (not counting the sub-views). It doesn't create temporary tables anymore: my $set = DateTime::Event::Recurrence-monthly( days = [ 10, 20 ], hours = 7 )- union( DateTime::Event::Recurrence-monthly(

Re: Storing recurrences in a SQL DBMS?

2005-05-05 Thread Dave Rolsky
On Wed, 4 May 2005, Flavio S. Glock wrote: Flavio S. Glock wrote: I'm working on a module that translates datetime sets into SQL statements. I'd appreciate to have your feedback on it. Here is a preliminary version: http://www.ipct.pucrs.br/flavio/perl/DateTime-Format-SQL-0.00_07.tar.gz This is

Re: Storing recurrences in a SQL DBMS?

2005-05-05 Thread Simon Perreault
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? Is it possible to do a query such as which sets intersect with today? on the SQL data

Re: Storing recurrences in a SQL DBMS?

2005-05-05 Thread Flavio S. Glock
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

Re: Storing recurrences in a SQL DBMS?

2005-05-05 Thread Simon Perreault
On Thursday 05 May 2005 15:46, Flavio S. Glock wrote: 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

Re: Storing recurrences in a SQL DBMS?

2005-05-05 Thread Flavio S. Glock
Simon Perreault wrote: which views contain a row that intersects with today? You could use a structure like: create view year_month as select n, 'dt_year' as tbl_name from dt_year union select n, 'dt_month' as tbl_name from dt_month; n | tbl_name

Re: Storing recurrences in a SQL DBMS?

2005-05-05 Thread Dave Rolsky
On Thu, 5 May 2005, Simon Perreault wrote: In fact, your solution is a way to move the set logic from the app to the SQL server. I don't think it's a good idea. You might as well have the SQL server call a procedure using DateTime::Sets directly, it would be the same computation. Nothing is

Re: Storing recurrences in a SQL DBMS?

2005-05-04 Thread Flavio S. Glock
I'm working on a module that translates datetime sets into SQL statements. I'd appreciate to have your feedback on it. - NAME - DateTime::Format::SQL SINOPSIS my $formatter = DateTime::Format::SQL-factory; print $formatter-create_table( set = $set, table_name =

Re: Storing recurrences in a SQL DBMS?

2005-05-04 Thread Flavio S. Glock
Flavio S. Glock wrote: I'm working on a module that translates datetime sets into SQL statements. I'd appreciate to have your feedback on it. - NAME - DateTime::Format::SQL SINOPSIS s/SINOPSIS/SYNOPSIS/

Re: Storing recurrences in a SQL DBMS?

2005-05-04 Thread Flavio S. Glock
Flavio S. Glock wrote: I'm working on a module that translates datetime sets into SQL statements. I'd appreciate to have your feedback on it. Here is a preliminary version: http://www.ipct.pucrs.br/flavio/perl/DateTime-Format-SQL-0.00_07.tar.gz This is the example in the synopsis: use

Re: Storing recurrences in a SQL DBMS?

2005-05-03 Thread Tim
On Fri, Apr 29, 2005 at 12:51:46PM -0500, Dave Rolsky wrote: On Fri, 29 Apr 2005, kellan wrote: Actually recurrence exceptions are one really good reason why its hard to ever come up with an elegant, purely rule based recurrence representation. For events involving humans its inevitable

Re: Storing recurrences in a SQL DBMS?

2005-05-03 Thread David Wheeler
On May 2, 2005, at 18:41 , Tim wrote: p.s. Since Postgres has been mentioned already I'll mention MySQL :) http://dev.mysql.com/doc/mysql/en/spatial-extensions-in-mysql.html PostgreSQL geometric data types: http://www.postgresql.org/docs/8.0/static/datatype-geometric.html ;-) David smime.p7s

Re: Storing recurrences in a SQL DBMS?

2005-05-03 Thread Flavio S. Glock
How about using a view to create a lazy sql recurrence. For example: FREQ=YEARLY;BYMONTH=3,6 --- postgresql --- CREATE TABLE YEARS ( N DATE UNIQUE PRIMARY KEY ); insert into years values ( date('1990-01-01') ); insert into years values ( date('1991-01-01') ); insert into years values (

Re: Storing recurrences in a SQL DBMS?

2005-04-29 Thread David Wheeler
On Apr 28, 2005, at 10:48 PM, Dave Rolsky wrote: What I'd really like to see is some way to query both single events and recurring events within a given timeframe, all in one query that returns a sorted array of occurrences. I haven't tried it (yet), but you might want to check out the INTERVAL

Re: Storing recurrences in a SQL DBMS?

2005-04-29 Thread David Wheeler
On Apr 28, 2005, at 11:05 PM, David Wheeler wrote: I haven't tried it (yet), but you might want to check out the INTERVAL data type in PostgreSQL. http://www.postgresql.org/docs/current/static/datatype-datetime.html Or, more precisely: http://www.postgresql.org/docs/8.0/static/datatype-

Re: Storing recurrences in a SQL DBMS?

2005-04-29 Thread Matt Sisk
Dave Rolsky wrote: - Allow only a fairly limited set of recurrences, store them as iCal strings, and query based on string contents. This limits the flexibility of the system, but is potentially quite efficient. This is what I've done in the past. The iCal string is only the recurrence part.

Re: Storing recurrences in a SQL DBMS?

2005-04-29 Thread Dave Rolsky
On Thu, 28 Apr 2005, David Wheeler wrote: On Apr 28, 2005, at 10:48 PM, Dave Rolsky wrote: What I'd really like to see is some way to query both single events and recurring events within a given timeframe, all in one query that returns a sorted array of occurrences. I haven't tried it (yet), but

Re: Storing recurrences in a SQL DBMS?

2005-04-29 Thread Dave Rolsky
On Fri, 29 Apr 2005, Dave Rolsky wrote: What I'd really like to see is some way to query both single events and recurring events within a given timeframe, all in one query that returns a sorted array of occurrences. Specifically, I'm interested in offering a meetup.com-alike service through

Re: Storing recurrences in a SQL DBMS?

2005-04-29 Thread Flavio S. Glock
Dave Rolsky wrote: Has anyone done any work on this? Basically, I'd like to be able to store these in a way that makes queries like all the entries for a given month reasonably efficient. [...] What I'd really like to see is some way to query both single events and recurring events within a

Re: Storing recurrences in a SQL DBMS?

2005-04-29 Thread Dave Rolsky
On Fri, 29 Apr 2005, Flavio S. Glock wrote: Dave Rolsky wrote: Has anyone done any work on this? Basically, I'd like to be able to store these in a way that makes queries like all the entries for a given month reasonably efficient. [...] What I'd really like to see is some way to query both

Re: Storing recurrences in a SQL DBMS?

2005-04-29 Thread kellan
On 4/29/05, Dave Rolsky [EMAIL PROTECTED] wrote: Has anyone done any work on this? A little. And I haven't come up with anything more clever then rollout occurrences when requested, and cache them. If someone does come up with something, I'd love to hear about that. I've always felt like

Re: Storing recurrences in a SQL DBMS?

2005-04-29 Thread David Wheeler
On Apr 29, 2005, at 10:51 AM, Dave Rolsky wrote: Surely implementation of that data type is just a SMOP! What would the data type look like, exactly? You might be able to create it using DOMAINS in PostgreSQL. http://www.postgresql.org/docs/current/static/sql-createdomain.html Hehe. Actually,

Storing recurrences in a SQL DBMS?

2005-04-28 Thread Dave Rolsky
Has anyone done any work on this? Basically, I'd like to be able to store these in a way that makes queries like all the entries for a given month reasonably efficient. I've come up with a few thoughts: - Store each occurrence as a separate entry, and then store the recurrence in a separate