On Tue, 28 Oct 2008 00:10:12 +0100 BUCHMULLER Norbert
<[EMAIL PROTECTED]> wrote:
> So, the patch for t/88_result_set_column.t contains modifications
> related to 3 different issues:
>
> 1. a new test for chained search() and '+select'/'+as'
> 2. a new test for a $rs->get_column() for a nonexistent column
> 3. $rs->get_column() calls replaced with $rs->first->get_column() calls
>
> Would it help if I send the changes broken up into 3 (stacked) patches?
> (So that you can review the changes separately.)
I think that they will make your work easier, so I did not wait for your
answer. Here they are:
1. dbic_chained_plusselect_test.diff
2. dbic_resultsetcolumn_nonexistent_column_test.diff
3. dbic_resultsetcolumn_nonexistent_column_fix.diff
norbi
Index: t/88result_set_column.t
===================================================================
--- t/88result_set_column.t (revision 5010)
+++ t/88result_set_column.t (working copy)
@@ -7,7 +7,7 @@
my $schema = DBICTest->init_schema();
-plan tests => 10;
+plan tests => 12;
my $cd;
my $rs = $cd = $schema->resultset("CD")->search({});
@@ -44,6 +44,20 @@
ok(defined($psrs->get_column('count')), '+select/+as arrayref count');
ok(defined($psrs->get_column('addedtitle')), '+select/+as title');
+$psrs = $schema->resultset('CD')->search({},
+ {
+ '+select' => \'COUNT(*)',
+ '+as' => 'count'
+ }
+)->search({},
+ {
+ '+select' => 'title',
+ '+as' => 'addedtitle'
+ }
+);
+ok(defined($psrs->get_column('count')), '+select/+as chained count');
+ok(defined($psrs->get_column('addedtitle')), '+select/+as chained title');
+
{
my $rs = $schema->resultset("CD")->search({}, { prefetch => 'artist' });
my $rsc = $rs->get_column('year');
--- a/t/88result_set_column.t 2008-10-28 00:18:10.000000000 +0100
+++ b/t/88result_set_column.t 2008-10-28 00:17:07.000000000 +0100
@@ -7,7 +7,7 @@
my $schema = DBICTest->init_schema();
-plan tests => 12;
+plan tests => 13;
my $cd;
my $rs = $cd = $schema->resultset("CD")->search({});
@@ -34,6 +34,9 @@
}
);
ok(defined($psrs->get_column('count')), '+select/+as count');
+my $nonexistent_column;
+eval { $nonexistent_column = $psrs->get_column('nonexistent_column'); };
+ok(!defined($nonexistent_column), '+select/+as nonexistent_column');
$psrs = $schema->resultset('CD')->search({},
{
--- a/t/88result_set_column.t 2008-10-28 00:17:07.000000000 +0100
+++ b/t/88result_set_column.t 2008-10-16 15:09:03.000000000 +0200
@@ -33,9 +33,9 @@
'+as' => 'count'
}
);
-ok(defined($psrs->get_column('count')), '+select/+as count');
+ok(defined($psrs->first->get_column('count')), '+select/+as count');
my $nonexistent_column;
-eval { $nonexistent_column = $psrs->get_column('nonexistent_column'); };
+eval { $nonexistent_column = $psrs->first->get_column('nonexistent_column'); };
ok(!defined($nonexistent_column), '+select/+as nonexistent_column');
$psrs = $schema->resultset('CD')->search({},
@@ -44,8 +44,8 @@
'+as' => [ 'count', 'addedtitle' ]
}
);
-ok(defined($psrs->get_column('count')), '+select/+as arrayref count');
-ok(defined($psrs->get_column('addedtitle')), '+select/+as title');
+ok(defined($psrs->first->get_column('count')), '+select/+as arrayref count');
+ok(defined($psrs->first->get_column('addedtitle')), '+select/+as title');
$psrs = $schema->resultset('CD')->search({},
{
@@ -58,8 +58,8 @@
'+as' => 'addedtitle'
}
);
-ok(defined($psrs->get_column('count')), '+select/+as chained count');
-ok(defined($psrs->get_column('addedtitle')), '+select/+as chained title');
+ok(defined($psrs->first->get_column('count')), '+select/+as chained count');
+ok(defined($psrs->first->get_column('addedtitle')), '+select/+as chained title');
{
my $rs = $schema->resultset("CD")->search({}, { prefetch => 'artist' });
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]