Merge 'trunk' into 'prefetch'
Rob Kinyon [Fri, 6 Mar 2009 19:56:18 +0000 (19:56 +0000)]
r5696@rkinyon-lt-osx (orig r5695):  robkinyon | 2009-03-06 12:55:52 -0500
Changed how the EXPERIMENTAL tag for subqueries and as_query is noted
r5697@rkinyon-lt-osx (orig r5696):  ribasushi | 2009-03-06 12:56:54 -0500
Remove erroneously merged file

lib/DBIx/Class/Manual/Cookbook.pod
lib/DBIx/Class/ResultSet.pm
lib/DBIx/Class/ResultSetColumn.pm
t/lib/DBICTest/Taint/Test.pm [deleted file]
t/prefetch/rows_bug.t

index d4458eb..27119b6 100644 (file)
@@ -295,7 +295,7 @@ Please see L<DBIx::Class::ResultSet/ATTRIBUTES> documentation if you
 are in any way unsure about the use of the attributes above (C< join
 >, C< select >, C< as > and C< group_by >).
 
-=head2 Subqueries
+=head2 Subqueries (EXPERIMENTAL)
 
 You can write subqueries relatively easily in DBIC.
 
index c29d604..5969744 100644 (file)
@@ -1807,7 +1807,7 @@ sub _remove_alias {
   return \%unaliased;
 }
 
-=head2 as_query
+=head2 as_query (EXPERIMENTAL)
 
 =over 4
 
index 5ec2a05..fbedf88 100644 (file)
@@ -54,7 +54,7 @@ sub new {
   return $new;
 }
 
-=head2 as_query
+=head2 as_query (EXPERIMENTAL)
 
 =over 4
 
diff --git a/t/lib/DBICTest/Taint/Test.pm b/t/lib/DBICTest/Taint/Test.pm
deleted file mode 100644 (file)
index e950278..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-package # hide from PAUSE 
-    DBICTest::Plain::Test;
-
-use base 'DBIx::Class::Core';
-
-__PACKAGE__->table('test');
-__PACKAGE__->add_columns(
-  'id' => {
-    data_type => 'integer',
-    is_auto_increment => 1
-  },
-  'name' => {
-    data_type => 'varchar',
-  },
-);
-__PACKAGE__->set_primary_key('id');
-
-1;
index 821c84e..8683b16 100644 (file)
@@ -40,6 +40,26 @@ TODO: {
     . " \$use_prefetch_count == $use_prefetch_count)"
   );
 }
+__END__
+my $rs1 = $schema->resultset('Artist')->search(
+    undef, {
+#        join => 'cds',
+    },
+);
+warn ${$rs1->as_query}->[0], $/;
+{ my @x = $rs1->all; warn "$#x\n"; }
+
+my $rs2 = $schema->resultset('Artist')->search(
+    undef, {
+        from => [{
+            me => $rs1->as_query,
+        }],
+        prefetch => 'cds',
+    },
+);
+
+warn ${$rs2->as_query}->[0], $/;
+{ my @x = $rs2->all; warn "$#x\n"; }
 
 __END__
 The fix is to, when using prefetch, take the query and put it into a subquery
@@ -78,3 +98,6 @@ becomes:
 Problem:
   * The prefetch->join change needs to happen ONLY IF there are conditions
     that depend on bar being joined.
+  * How will this work when the $rs is further searched on? Those clauses
+    need to be added to the subquery, not the outer one. This is particularly
+    true if rows is added in the attribute later per the Pager.