[dev] Turba listTimeObject / sql BETWEEN issues

Michael Rubinsky mike at theupstairsroom.com
Tue Dec 4 01:25:46 UTC 2007


I think I've uncovered an issue with turba's listTimeObjects stuff.   
The query we are now running for sql backends attempts to limit the  
date range of the results.  The problem I'm running into is for  
birthdays towards the end of the year.  This generates a query with a  
WHERE clause as so:

...WHERE SUBSTR(object_bday, 6, 5) BETWEEN '11-25' AND '01-06'...

The problem is this is not interpreted as a month/day (at least not by  
MySQL).  I'm not sure it would even be possible to use some type of  
to_date function as they are not universal across RDMS, plus from what  
I've done on MySQL, they require a year, defeating our purpose.

The only solution I came up with was to check if we are "reversed" in  
our date range check...if we are then we should not check for a date  
*range*, but check for the month value only.  This would be overkill  
for the day/week views, but would still be less then grabbing all the  
records from the db as we did before. For the month view, we could  
pull the prev and the next month as well.

Thoughts?

-- 
Thanks
Mike

"Time just hates me, that's why it made me an adult." - Josh Joplin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-keys
Size: 2013 bytes
Desc: PGP Public Key
Url : http://lists.horde.org/archives/dev/attachments/20071203/8e1f3dc2/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: PGP Digital Signature
Url : http://lists.horde.org/archives/dev/attachments/20071203/8e1f3dc2/attachment-0001.bin 


More information about the dev mailing list