Il giorno mar, 23-11-2004 alle 21:13 +0100, Josef Meile ha scritto:
> > the first thing that comes to mind is preloading all the possible time
> > slots and then "UPDATE ... WHERE ... " in a way that allocate the time
> > slots only if not yet allocated. then you SELECT the result and show > it
> > to the user. should pretty much replicate what you're trying to do.
> Yes, I thaught also about it, but I discarted this posibility because it
> means that I have to create at least 5.475 (365 days x 15 hours) records
> to allow my users to do reservations over a year. Normally they don't do
> reservations on the weekends, so, there will be a waste space of 1.576
> (52 weeks x 2 days x 15 hours) records. And there are also resources
> that aren't frecuently reserved, so, the wasted space will increase a
> lot. So, I guess, I have to try something different, maybe as you said,
> running the query on a external method. Anyway, thanks a lot for your help.
an external method will let you do exactly what you need, especially
when using set_isolation_level(0) to have every single INSERT
automatically commited to the database. but, as a side note, you don't
need to use one row for every hour: a string of x--xxxxx---xxxx
indicating the free (-) and occupied (x) hours suffices. this suggestion
will probably make sql purists to go crazy but, alas, it works.
federico
|