From: Chris W. <ch...@cw...> - 2003-01-06 17:23:16
|
Andrew Hurst wrote: > At 11:49 AM 1/6/2003 -0500, you wrote: >> Date/time formatting is *MUCH* worse, but fortunately that can be >> dealt with almost entirely within the application logic. Someone >> else's problem :-) > > Forgive me if I'm asking an obvious question, as I haven't actually > gotten OI running on my machine here yet, but how will this work? Will > you set it up so that no matter what the database it returns the date in > a standard format? like DD-MM-YYYY HH:MI:SS, then require the app to > format it as necessary... Will there be a set of routines for > formatting it built-in? I've used Date::Calc and Date::Format before > and they worked rather well, thought I'm not sure about speed/size > (never had the need to check on them before). Currently OI doesn't really care what format the date is in. My problem with the different types comes about because we have to create the schema -- no choice there. OI relies on you to know your database and what format the dates are returned in and what they need for an insert/update. This is partly a cop-out, but there aren't too many places where we have to rely on a date/time being in a particular format. When this does come up... > I could see the db driver always returning it in the same format, then > requiring it to be input in the same format as well. Maybe a > format_for_db() function, taking the format you currently have the date > in and the date, and it returning the string formatted for what the > driver expects.. ...we can use SPOPS::Tool::DateConvert to coerce a database date into a standard object (likely Time::Piece). That buys us the same interface for all dates no matter where they're from. Then on insert/update we need to put the date object into the necessary database format. The SPOPS tool allows you to specify the date type in a strftime format for parsing, so it's pretty simple to declare and transparent to use. I'll stick a note about this on the wiki for whenever the packages get converted to the OI2. Chris -- Chris Winters (ch...@cw...) Building enterprise-capable snack solutions since 1988. |