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.
Bye,
Ferenc
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.
Bye,
Ferenc
Date: Wed, 21 Jan 2004 04:43:33 +0900
From: Ferenc Engard ferenc@engard.hu
Newsgroups: comp.lang.ruby
Subject: DBI improvementHello,
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.
On Wed, 21 Jan 2004, Ferenc Engard wrote:
Bye,
Ferenc
–
ATTN: please update your address books with address below!
===============================================================================
EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
PHONE :: 303.497.6469
ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
STP :: Solar-Terrestrial Physics Data | NCEI
NGDC :: http://www.ngdc.noaa.gov/
NESDIS :: http://www.nesdis.noaa.gov/
NOAA :: http://www.noaa.gov/
US DOC :: http://www.commerce.gov/The difference between art and science is that science is what we
understand well enough to explain to a computer.
Art is everything else.
– Donald Knuth, “Discover”/bin/sh -c ‘for l in ruby perl;do $l -e “print "\x3a\x2d\x29\x0a"”;done’
===============================================================================
“Ara.T.Howard” wrote:
Date: Wed, 21 Jan 2004 04:43:33 +0900
From: Ferenc Engard ferenc@engard.hu
Newsgroups: comp.lang.ruby
Subject: DBI improvementHello,
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
On Wed, 21 Jan 2004, Ferenc Engard wrote: