Skip Menu |

This queue is for tickets about the DBIx-Class CPAN distribution.

Report information
The Basics
Id: 27905
Status: resolved
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: abram [...] arin.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.08002
Fixed in: (no value)



Subject: InflateColumn::DateTime in Oracle
Currently DBIx::Class::Storage::DBI::Oracle calls DBIx::Class::Storage::DBI's datetime_parser_type method which is hard-coded to 'DateTime::Format::MySQL'. The included patch adds that method to DBIx::Class::Storage::DBI::Oracle::Generic with the proper value 'DateTime::Format::Oracle'.
Subject: oracle_inflate_dt.patch
--- DBIx-Class-0.08002/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm 2007-06-17 13:40:02.000000000 -0400 +++ DBIx-Class-0.08002-at/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm 2007-07-02 12:45:10.000000000 -0400 @@ -84,6 +84,15 @@ $self->next::method(uc($table)); } +=head2 datetime_parser_type + +This sets the proper DateTime::Format module for use with +L<DBIx::Class::InflateColumn::DateTime>. + +=cut + +sub datetime_parser_type { return "DateTime::Format::Oracle"; } + =head1 AUTHORS Andy Grundman <andy@hybridized.org>
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #27905] InflateColumn::DateTime in Oracle
Date: Tue, 17 Jul 2007 23:48:47 +0100
To: Abram Thielke via RT <bug-DBIx-Class [...] rt.cpan.org>
From: Matt S Trout <mst [...] shadowcatsystems.co.uk>
On Mon, Jul 02, 2007 at 03:07:31PM -0400, Abram Thielke via RT wrote: Show quoted text
> > Mon Jul 02 15:07:28 2007: Request 27905 was acted upon. > Transaction: Ticket created by abram@arin.net > Queue: DBIx-Class > Subject: InflateColumn::DateTime in Oracle > Broken in: 0.08002 > Severity: Normal > Owner: Nobody > Requestors: abram@arin.net > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=27905 > > > > Currently DBIx::Class::Storage::DBI::Oracle calls > DBIx::Class::Storage::DBI's datetime_parser_type method which is > hard-coded to 'DateTime::Format::MySQL'. The included patch adds that > method to DBIx::Class::Storage::DBI::Oracle::Generic with the proper > value 'DateTime::Format::Oracle'.
Can you patch the oracle test as well, please? Show quoted text
> --- DBIx-Class-0.08002/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm 2007-06-17 13:40:02.000000000 -0400 > +++ DBIx-Class-0.08002-at/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm 2007-07-02 12:45:10.000000000 -0400 > @@ -84,6 +84,15 @@ > $self->next::method(uc($table)); > } > > +=head2 datetime_parser_type > + > +This sets the proper DateTime::Format module for use with > +L<DBIx::Class::InflateColumn::DateTime>. > + > +=cut > + > +sub datetime_parser_type { return "DateTime::Format::Oracle"; } > + > =head1 AUTHORS > > Andy Grundman <andy@hybridized.org>
-- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Director Want a managed development or deployment platform? Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/
From: abram [...] exiledllama.com
Done. This is patched against 0.08003 Thanks, Abram On Tue Jul 17 18:49:26 2007, mst@shadowcatsystems.co.uk wrote: Show quoted text
> On Mon, Jul 02, 2007 at 03:07:31PM -0400, Abram Thielke via RT wrote:
> > > > Mon Jul 02 15:07:28 2007: Request 27905 was acted upon. > > Transaction: Ticket created by abram@arin.net > > Queue: DBIx-Class > > Subject: InflateColumn::DateTime in Oracle > > Broken in: 0.08002 > > Severity: Normal > > Owner: Nobody > > Requestors: abram@arin.net > > Status: new > > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=27905 > > > > > > > Currently DBIx::Class::Storage::DBI::Oracle calls > > DBIx::Class::Storage::DBI's datetime_parser_type method which is > > hard-coded to 'DateTime::Format::MySQL'. The included patch adds
> that
> > method to DBIx::Class::Storage::DBI::Oracle::Generic with the proper > > value 'DateTime::Format::Oracle'.
> > Can you patch the oracle test as well, please? >
> > --- DBIx-Class-0.08002/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
> 2007-06-17 13:40:02.000000000 -0400
> > +++ DBIx-Class-0.08002-
> at/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm 2007-07-02 > 12:45:10.000000000 -0400
> > @@ -84,6 +84,15 @@ > > $self->next::method(uc($table)); > > } > > > > +=head2 datetime_parser_type > > + > > +This sets the proper DateTime::Format module for use with > > +L<DBIx::Class::InflateColumn::DateTime>. > > + > > +=cut > > + > > +sub datetime_parser_type { return "DateTime::Format::Oracle"; } > > + > > =head1 AUTHORS > > > > Andy Grundman <andy@hybridized.org>
> >
diff -Naur DBIx-Class-0.08003/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm at-DBIx-Class-0.08003/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm --- DBIx-Class-0.08003/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm 2007-06-17 13:40:02.000000000 -0400 +++ at-DBIx-Class-0.08003/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm 2007-07-31 11:26:53.000000000 -0400 @@ -84,6 +84,15 @@ $self->next::method(uc($table)); } +=head2 datetime_parser_type + +This sets the proper DateTime::Format module for use with +L<DBIx::Class::InflateColumn::DateTime>. + +=cut + +sub datetime_parser_type { return "DateTime::Format::Oracle"; } + =head1 AUTHORS Andy Grundman <andy@hybridized.org> diff -Naur DBIx-Class-0.08003/t/73oracle_inflate.t at-DBIx-Class-0.08003/t/73oracle_inflate.t --- DBIx-Class-0.08003/t/73oracle_inflate.t 1969-12-31 19:00:00.000000000 -0500 +++ at-DBIx-Class-0.08003/t/73oracle_inflate.t 2007-07-31 13:45:33.000000000 -0400 @@ -0,0 +1,64 @@ +use strict; +use warnings; + +use Test::More; +use lib qw(t/lib); +use DBICTest; + +my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_ORA_${_}" } qw/DSN USER PASS/}; + +eval "use DateTime; use DateTime::Format::Oracle;"; +if ($@) { + plan skip_all => 'needs DateTime and DateTime::Format::Oracle for testing'; +} +elsif (not ($dsn && $user && $pass)) { + plan skip_all => 'Set $ENV{DBICTEST_ORA_DSN}, _USER and _PASS to run this test. ' . + 'Warning: This test drops and creates a table called \'track\''; +} +else { + plan tests => 4; +} + +# DateTime::Format::Oracle needs this set +$ENV{NLS_DATE_FORMAT} = 'DD-MON-YY'; + +my $schema = DBICTest::Schema->connect($dsn, $user, $pass); + +# Need to redefine the last_updated_on column +my $col_metadata = $schema->class('Track')->column_info('last_updated_on'); +$schema->class('Track')->add_column( 'last_updated_on' => { + data_type => 'date' }); + +my $dbh = $schema->storage->dbh; + +eval { + $dbh->do("DROP TABLE track"); +}; +$dbh->do("CREATE TABLE track (trackid NUMBER(12), cd NUMBER(12), position NUMBER(12), title VARCHAR(255), last_updated_on DATE)"); + +# insert a row to play with +my $new = $schema->resultset('Track')->create({ trackid => 1, cd => 1, position => 1, title => 'Track1', last_updated_on => '06-MAY-07' }); +is($new->trackid, 1, "insert sucessful"); + +my $track = $schema->resultset('Track')->find( 1 ); + +is( ref($track->last_updated_on), 'DateTime', "last_updated_on inflated ok"); + +is( $track->last_updated_on->month, 5, "DateTime methods work on inflated column"); + +my $dt = DateTime->now(); +$track->last_updated_on($dt); +$track->update; + +is( $track->last_updated_on->month, $dt->month, "deflate ok"); + +# clean up our mess +END { + # Set the metadata back for the last_updated_on column + $schema->class('Track')->add_column( 'last_updated_on' => $col_metadata ); + + if($dbh) { + $dbh->do("DROP TABLE track"); + } +} +
Subject: RE: [rt.cpan.org #27905] InflateColumn::DateTime in Oracle
Date: Tue, 31 Jul 2007 13:46:46 -0400
To: "bug-DBIx-Class [...] rt.cpan.org" <bug-DBIx-Class [...] rt.cpan.org>, "abram [...] arin.net" <abram [...] arin.net>
From: Abram Thielke <athielke [...] arin.net>
Done. This is patched against 0.08003 Thanks, Abram Show quoted text
________________________________________ From: Matt S Trout via RT [bug-DBIx-Class@rt.cpan.org] Sent: Tuesday, July 17, 2007 6:49 PM To: abram@arin.net Subject: Re: [rt.cpan.org #27905] InflateColumn::DateTime in Oracle <URL: http://rt.cpan.org/Ticket/Display.html?id=27905 > On Mon, Jul 02, 2007 at 03:07:31PM -0400, Abram Thielke via RT wrote:
> > Mon Jul 02 15:07:28 2007: Request 27905 was acted upon. > Transaction: Ticket created by abram@arin.net > Queue: DBIx-Class > Subject: InflateColumn::DateTime in Oracle > Broken in: 0.08002 > Severity: Normal > Owner: Nobody > Requestors: abram@arin.net > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=27905 > > > > Currently DBIx::Class::Storage::DBI::Oracle calls > DBIx::Class::Storage::DBI's datetime_parser_type method which is > hard-coded to 'DateTime::Format::MySQL'. The included patch adds that > method to DBIx::Class::Storage::DBI::Oracle::Generic with the proper > value 'DateTime::Format::Oracle'.
Can you patch the oracle test as well, please?
> --- DBIx-Class-0.08002/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm 2007-06-17 13:40:02.000000000 -0400 > +++ DBIx-Class-0.08002-at/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm 2007-07-02 12:45:10.000000000 -0400 > @@ -84,6 +84,15 @@ > $self->next::method(uc($table)); > } > > +=head2 datetime_parser_type > + > +This sets the proper DateTime::Format module for use with > +L<DBIx::Class::InflateColumn::DateTime>. > + > +=cut > + > +sub datetime_parser_type { return "DateTime::Format::Oracle"; } > + > =head1 AUTHORS > > Andy Grundman <andy@hybridized.org>
-- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Director Want a managed development or deployment platform? Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/

Message body is not shown because sender requested not to inline it.

On Tue Jul 31 14:12:13 2007, athielke@arin.net wrote: Show quoted text
> Done. This is patched against 0.08003
Released in 08004 Thanks!
Subject: Re: [rt.cpan.org #27905] Resolved: InflateColumn::DateTime in Oracle
Date: Wed, 8 Aug 2007 09:44:43 -0400
To: "bug-DBIx-Class [...] rt.cpan.org" <bug-DBIx-Class [...] rt.cpan.org>
From: Abram Thielke <abram [...] arin.net>
Did this get released? I don't see it... On Wednesday 08 August 2007 06:05:51 am via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=27905 > > > According to our records, your request has been resolved. If you have any > further questions or concerns, please respond to this message.
On Wed Aug 08 09:45:26 2007, abram@arin.net wrote: Show quoted text
> Did this get released? I don't see it...
Apparently I'm an idiot, sorry. Applied in r3702.