From: Ferenc Engard Date: 2004-01-22T05:59:05+09:00 Subject: Re: DBI improvement "Ara.T.Howard" wrote: > > On Wed, 21 Jan 2004, Ferenc Engard wrote: > > > Date: Wed, 21 Jan 2004 04:43:33 +0900 > > From: Ferenc Engard > > Newsgroups: comp.lang.ruby > > Subject: DBI improvement > > > > Hello, > > > > I think all the DBI type classes (DBI::Timestamp etc.) should support > > the <=> operator. Lacking this makes life heavy; implementing them would > > be easy. > > how about special timestamps? for example, postgresql supports > > '-infinity' < all_other_times < 'infinity' > > and > > 'epoch' == '1970-01-01 00:00:00' > > things like this get tricky. And these can be DBI::Timestamp values? Well, then what is the result of '-infinity'.to_time? Or 'epoch'.to_s? How gets initialized a DBI::Timestamp object with the string 'infinity'? I do not want to compare e.g. a Time with a DBI::Timestamp, but I want to compare two DBI::Timestamps. Even the #== operator do something else what one would expect. Lacking these operators I cannot check equality of two values, or sort the result set on client side easily, as I have to check its class, and convert if it is DBI::*. (In fact, I can, thanks to open classes... :) Also, the idea is a bit vague why are these types needed. For example, a mysql timestamp is converted to DBI::Timestamp, although, if I want to use it, I have to use as a string, as both #to_time and #to_date loses information, and in itself, this class do not do much, even is lacks #==! Ferenc