John, thanks for the advice. Settting post_connect_sql in register_db is a lot cleaner than what I was doing. As for the default dates Clayton is 100% correct, and "Ick!" is also a correct feeling. Oracle defaults to DD-MON-YY, YY being the last two digits of the year. So for this query:
select to_date('01-01-1970', 'mm-dd-yyyy'), to_date('01-01-2070', 'mm-dd-yyyy') from dual; The results are: 01-JAN-70 01-JAN-70 Which I why I usually always set nls_date_format when I start a session. Plus it's nice to use DateTime for everything on the perl side. I also think setting nls_date_format globally is the best way to go, either by default or just a mention in the Rose::DB::Oracle perldoc to do so yourself if you want type => 'datetime' to work. -Kevin -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Siracusa Sent: Monday, December 04, 2006 2:59 PM To: Rose::DB::Object list Subject: Re: [RDBO] Oracle and DateTime 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? > 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. > 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. -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 ------------------------------------------------------------------------- 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