Hi,
I was wondering if anyone could offer some insight into a problem I'm
finding. I wish to create a relationship using a left join by this doesn't
appear to be happening when I trace the SQL. My only thought is that it is
something to do with using a 'table' without a primary key or whose
underlying database object is actually not a table but a view?
The example class / relationship below doe snot produce a left join, but
would have thought it aught to:
package MyApp::Schema::Result::IndexStatus;
__PACKAGE__->table("index_statuses");
__PACKAGE__->add_columns(
"myindex",
{ data_type => "bigint", is_nullable => 0 },
"myoldindex",
{ data_type => "bigint", is_nullable => 0 },
"mystatus",
{ data_type => "varchar", default_value => "", is_nullable => 0, size =>
45 },
);
#relationship to find all old index statuses:
__PACKAGE__->has_many(
"old_statuses"=>"MyApp::IndexStatus",
{ "foreign.myindex" => "self.myoldindex"},
);
----
then (in Cat app)
$c->model('MyApp::IndexStatus')->search_related('old_statuses');
produces SQL something like:
SELECT me.myindex, me.myoldindex, me.mystatus FROM index_statuses me JOIN
index_statuses old_statuses ON old_statuses.myindex = me.myoldindex:
even adding {join_type=>'LEFT'} to the arguments of has_many does not
produce a left join.
DBIx::Class has been pretty robust, I'm assuming that this is an
undocumented feature rather than a bug. However how can I get it to do a
left join?
Thanks in advance
Stephen
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/