On 12/4/06, John Siracusa <[EMAIL PROTECTED]> wrote: > On 12/4/06, Clayton Scott <[EMAIL PROTECTED]> wrote: > > On 12/4/06, John Siracusa <[EMAIL PROTECTED]> wrote: > >> Perhaps Rose::DB::Oracle could have a hard-coded default bit of > >> post_connect_sql to set nls_date_format, but I'd prefer it if I could > >> handle whatever Oracle produces if you do not set nls_date_format > >> explicitly. Or is there no default and it must always be set > >> explicitly? (I've never really used Oracle, obviously...) > > > > 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?
Well, further research show that that is only the default output format. I guess parsing using a standard windowing technique circa 1999 would be effective in this case. Oracle will take ANSI SQL date formats for input YYYY-MM-DD etc. I got this info from here DBD docs: http://search.cpan.org/~timb/dbd-summaries/dbd-oracle.pod#Date_Data_Handling (Thanks Tim!) 90% of applications that I've seen go against oracle use to_date and to_char very liberally to parse and format dates in a sane manner. Sadly the other 10% (I bet it's really a lot worse in reality) implement the conversions themselves in perl/c/php/whatever code. > > but the DBA may change it on you, that's why it's safer to reset it for > > each session to enforce your expectations > > Well, if possible, I'd like to handle that DD-MON-YY idiocy by > default, and then just put a note in the documentation about > explicitly setting nls_date_format in post_connect_sql in your data > source if you want something different. That seems like the least > invasive solution. 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? > > Another method would be to setup some metadata on > > Rose::DB::Object::Metadata::Column::Datetime to a strptime > > pattern to be used to parse the datetime format? > No other database requires that, and I'd rather not do it unless it > adds some sort of useful flexibility. > When would you want two different columns to have different formats? > Would that even be possible, let alone useful? It seems to me that setting > nls_date_format "globally" at the data source level is all that'll > ever be needed. nls_date_format only actually applies to columns of type 'date'. 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? I only ask these questions because I'm still only using RDBO sparingly and only against Postgres for a single application, but I hope to be able to use it more in the future. Clayton ------------------------------------------------------------------------- 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