I can’t seem to figure out why DBI uses its own set of date/time
classes. They all seem to be pretty thin, incomplete wrappers around
the existing classes. Why not just use the existing classes directly?
It’s pretty annoying that you have to cast to the proper class every
time you deal with a row that uses dates and want to use methods like
strftime.
indeed, why not just use the existing classes directly and bypass dbi
altogether?
-a
···
On Thu, 29 Jan 2004, David Heinemeier Hansson wrote:
Date: Thu, 29 Jan 2004 01:57:43 +0900
From: David Heinemeier Hansson david@loudthinking.com
Newsgroups: comp.lang.ruby
Subject: Why does DBI insist on using it’s own date/time classes?
I can’t seem to figure out why DBI uses its own set of date/time classes.
They all seem to be pretty thin, incomplete wrappers around the existing
classes. Why not just use the existing classes directly? It’s pretty
annoying that you have to cast to the proper class every time you deal with
a row that uses dates and want to use methods like strftime.
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’
===============================================================================
Class Time cannot handle dates before the year 1970. And class Date
does not store hours, minutes and seconds.
Regards,
Michael
···
On Thu, Jan 29, 2004 at 01:57:43AM +0900, David Heinemeier Hansson wrote:
I can't seem to figure out why DBI uses its own set of date/time
classes. They all seem to be pretty thin, incomplete wrappers around
the existing classes. Why not just use the existing classes directly?
It's pretty annoying that you have to cast to the proper class every
time you deal with a row that uses dates and want to use methods like
strftime.
On Thu, 29 Jan 2004, David Heinemeier Hansson wrote:
Date: Thu, 29 Jan 2004 01:57:43 +0900
From: David Heinemeier Hansson david@loudthinking.com
Newsgroups: comp.lang.ruby
Subject: Why does DBI insist on using it’s own date/time classes?
I can’t seem to figure out why DBI uses its own set of date/time classes.
They all seem to be pretty thin, incomplete wrappers around the existing
classes. Why not just use the existing classes directly? It’s pretty
annoying that you have to cast to the proper class every time you deal with
a row that uses dates and want to use methods like strftime.
indeed, why not just use the existing classes directly and bypass dbi
altogether?
because it’s a bit of a problem to deal with classes like these. and a
time can’t be represented using ruby’s Time class, only timestamps can.
Ruby/libgda of the Ruby-GNOME2 project, however, deals well with these
kinds of values, so if you require this and can consider loading GLib,
then you should check it out,
nikolai
–
::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka :::
::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden :::
::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 :::
main(){printf(&linux[“\021%six\012\0”],(linux)[“have”]+“fun”-97);}