[DB-SIG] Date/Time question

M.-A. Lemburg mal@lemburg.com
Thu, 23 Mar 2000 13:58:16 +0100


hme@informatik.uni-rostock.de wrote:
> ...
> > > Most database systems, that support temporal data, have a notation of
> > > `now' and `today', why these values not make default parameters?
> >
> > I'm not sure I understand what you mean here... why should all
> > date/time columns default to now() or today() ?
> 
> If no values are supplied to input parameter of type DATETIME, e.g.
> just using Date() as an input parameter.  When using `now' the dbms is
> substituting transaction time, in contrast to building a default
> paramter (e.g. using UNIX time()) at PREPARE time.

Hmm, I guess you could add this to your implementation, but
it would not be portable.
 
> > > As
> > > far as I know some Systems internally represent date/time as strings
> > > (Informix, Ingres).  Since there's no string parameter to the date/time
> > > methods, conversion takes place two times.
> >
> > Why ? You could implement the date/time constructors in such
> > a way that also accepts string on input... note that the
> > constructors are only meant for the input side of the interface
> 
> Yup, but if it's O.K. to overload the constructors, than it works.
> So the API is more a at-least-thing?

Right. It tries to provide the essentials and a few guidelines
on how to implement extensions. IMHO, it does a pretty good
job at that...
 
> > (and then mostly because some DBs don't provide column type
> > information in their APIs). The output side is not defined and
> > usually varies between DBs.
> 
> But the type_code should compare equal to one of the types defined by
> the API?

Well, that depends... if you have a column type which does
not fall into the given categories, it is probably ok to define
a new interface dependent one. In general, you shouldn't refrain from
implementing a feature just because the DB API doesn't specify
it -- the only thing to watch out for is not to use different
semantics for things already defined in the spec...

-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/