On 12/4/06, Clayton Scott <[EMAIL PROTECTED]> wrote: > On 12/4/06, John Siracusa <[EMAIL PROTECTED]> wrote: >> On 12/4/06, Clayton Scott <[EMAIL PROTECTED]> wrote: >>> There is a default (in the english world) of DD-MON-YY (23-JAN-00) >> >> Ick! A two-digit year? What are the rules for parsing that? > > [...] I guess parsing using a standard windowing technique circa 1999 would be > effective in this case.
Well what does Oracle do? Is a YY value of 50 the year 1950 or 2050 or something else? And so on for 00-99. And what about the 1800s and 2100s? Basically, to parse YY, we have to know exactly what Oracle does so we can follow the same rules. > How would the datetime column type handle the the fact that that the date that > was previously 23-JAN-00 (default) now comes back as dimanche, 23 janvier 2000 > (after nls_date_formatis set) if that's what how they specified the format? > Would they sub-class the RDBO Date column type to implement a parser? Yeah, I'm never going to support all possible nls_*_format strings, just the most reasonable ones. If someone wants to support something fancier, they'd have to either make a custom column class or a custom Rose::DB-derived class with a driver class for Oracle that implements parse_date() and format_date() according to their wishes. (All column data parsing/formatting is handled by Rose::DB and its associated driver-specific subclasses. RDBO's column classes delegate to a method maker, and the methods created by the method maker delegate to the current "db" (Rose::DB) object's parse_* and format_* methods.) > nls_date_format only actually applies to columns of type 'date'. Yeah, aren't there other nls_*_format settings for timestamp and datetime and so on? > I've had to work in many schemas where dates are stored as formatted strings > or as some kind epoch. Typically this is "enterprise software" that is trying > to be database agnostic. Is there a nicer way to deal with this in RDBO > already? There's already an Epoch column class in RDBO than translates seconds since the Unix epoch into DateTime objects. For strings, if they're in a format that the current Rose::DB::* database driver's parse_XXX() and format_XXX() methods can understand, just "lie" in your RDBO class and say the column is of type XXX, even, though it's really a varchar or whatever. (That's how Arrays are emulated in MySQL, for example.) -John ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object