On 12/4/06, Kevin McGrath <[EMAIL PROTECTED]> wrote:
> For now I've added the following code to my init_db function in my base
> module:
>
> sub init_db {
>     my $db = My::DB->new;
>     my $dbh = $db->dbh or die $db->error;
>     $dbh->do(q[alter session set nls_date_format = 'yyyy-mm-dd
> hh24:mi:ss']);
>     return $db;
> }
>
> This will convert all dates returned for the session to a format the
> DateTime module can understand.  Is init_db the best place to do this?

Setting post_connect_sql on your data source is the more appropriate
way to do this:

http://search.cpan.org/dist/Rose-DB/lib/Rose/DB.pm#post_connect_sql

> is this something that might make sense to be added to Rose::DB::Oracle
> (either by default or maybe an option in the config)?

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...)

-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

Reply via email to