[Bast-commits] r3358 - in branches/DBIx-Class-current: .
lib/DBIx/Class t t/lib t/lib/DBICTest/Schema
claco at dev.catalyst.perl.org
claco at dev.catalyst.perl.org
Tue May 22 03:36:30 GMT 2007
Author: claco
Date: 2007-05-22 03:36:28 +0100 (Tue, 22 May 2007)
New Revision: 3358
Modified:
branches/DBIx-Class-current/Changes
branches/DBIx-Class-current/lib/DBIx/Class/InflateColumn.pm
branches/DBIx-Class-current/t/60core.t
branches/DBIx-Class-current/t/lib/DBICTest/Schema/Track.pm
branches/DBIx-Class-current/t/lib/sqlite.sql
Log:
%colinfo accessor and inflate_column now work together
Modified: branches/DBIx-Class-current/Changes
===================================================================
--- branches/DBIx-Class-current/Changes 2007-05-22 01:44:57 UTC (rev 3357)
+++ branches/DBIx-Class-current/Changes 2007-05-22 02:36:28 UTC (rev 3358)
@@ -12,6 +12,7 @@
class; requires Class::Accessor::Grouped 0.05002+
- added 97result_class.t test, failing ATM
- added get_inflated_columns to Row
+ - %colinfo accessor and inflate_column now work together
0.07006 2007-04-17 23:18:00
- Lots of documentation updates
Modified: branches/DBIx-Class-current/lib/DBIx/Class/InflateColumn.pm
===================================================================
--- branches/DBIx-Class-current/lib/DBIx/Class/InflateColumn.pm 2007-05-22 01:44:57 UTC (rev 3357)
+++ branches/DBIx-Class-current/lib/DBIx/Class/InflateColumn.pm 2007-05-22 02:36:28 UTC (rev 3358)
@@ -73,7 +73,7 @@
$self->throw_exception("inflate_column needs attr hashref")
unless ref $attrs eq 'HASH';
$self->column_info($col)->{_inflate_info} = $attrs;
- $self->mk_group_accessors('inflated_column' => $col);
+ $self->mk_group_accessors('inflated_column' => [$self->column_info($col)->{accessor} || $col, $col]);
return 1;
}
Modified: branches/DBIx-Class-current/t/60core.t
===================================================================
--- branches/DBIx-Class-current/t/60core.t 2007-05-22 01:44:57 UTC (rev 3357)
+++ branches/DBIx-Class-current/t/60core.t 2007-05-22 02:36:28 UTC (rev 3358)
@@ -7,7 +7,7 @@
my $schema = DBICTest->init_schema();
-plan tests => 74;
+plan tests => 77;
# figure out if we've got a version of sqlite that is older than 3.2.6, in
# which case COUNT(DISTINCT()) doesn't work
@@ -166,6 +166,7 @@
cd => 1,
position => 4,
title => 'Insert or Update',
+ last_updated_on => '1973-07-19 12:01:02'
} );
$new->update_or_insert;
ok($new->in_storage, 'update_or_insert insert ok');
@@ -176,12 +177,15 @@
is( $schema->resultset("Track")->find(100)->pos, 5, 'update_or_insert update ok');
# get_inflated_columns w/relation and accessor alias
+isa_ok($new->updated_date, 'DateTime', 'have inflated object via accessor');
my %tdata = $new->get_inflated_columns;
is($tdata{'trackid'}, 100, 'got id');
isa_ok($tdata{'cd'}, 'DBICTest::CD', 'cd is CD object');
is($tdata{'cd'}->id, 1, 'cd object is id 1');
is($tdata{'position'}, 5, 'got position from pos');
is($tdata{'title'}, 'Insert or Update');
+is($tdata{'last_updated_on'}, '1973-07-19T12:01:02');
+isa_ok($tdata{'last_updated_on'}, 'DateTime', 'inflated accessored column');
eval { $schema->class("Track")->load_components('DoesNotExist'); };
Modified: branches/DBIx-Class-current/t/lib/DBICTest/Schema/Track.pm
===================================================================
--- branches/DBIx-Class-current/t/lib/DBICTest/Schema/Track.pm 2007-05-22 01:44:57 UTC (rev 3357)
+++ branches/DBIx-Class-current/t/lib/DBICTest/Schema/Track.pm 2007-05-22 02:36:28 UTC (rev 3358)
@@ -2,6 +2,7 @@
DBICTest::Schema::Track;
use base 'DBIx::Class::Core';
+__PACKAGE__->load_components(qw/InflateColumn::DateTime/);
__PACKAGE__->table('track');
__PACKAGE__->add_columns(
@@ -20,6 +21,11 @@
data_type => 'varchar',
size => 100,
},
+ last_updated_on => {
+ data_type => 'datetime',
+ accessor => 'updated_date',
+ is_nullable => 1
+ },
);
__PACKAGE__->set_primary_key('trackid');
Modified: branches/DBIx-Class-current/t/lib/sqlite.sql
===================================================================
--- branches/DBIx-Class-current/t/lib/sqlite.sql 2007-05-22 01:44:57 UTC (rev 3357)
+++ branches/DBIx-Class-current/t/lib/sqlite.sql 2007-05-22 02:36:28 UTC (rev 3358)
@@ -108,7 +108,8 @@
trackid INTEGER PRIMARY KEY NOT NULL,
cd integer NOT NULL,
position integer NOT NULL,
- title varchar(100) NOT NULL
+ title varchar(100) NOT NULL,
+ last_updated_on datetime NULL
);
--
More information about the Bast-commits
mailing list