This is killing me..
My code below creates SQL that is essentially:
SELECT t1.* , t2.* FROM useraccount_link t1 LEFT OUTER JOIN
useraccount_link_privacysetting_override t2 ON(t1.id =
t2.useraccount_link_id)
WHERE
t1.is_deleted = false AND
t1.useraccount_id = 129 AND
t1.id <> 161 AND
(
t2.useraccount_link_id = 161 OR
t2.useraccount_link_id IS NULL
)
I've spent all day trying to get the results, not realize that I was
after a conditional join all along
SELECT t1.* , t2.* FROM useraccount_link t1 LEFT OUTER JOIN
useraccount_link_privacysetting_override t2 ON
(
(t1.id = t2.useraccount_link_id) AND
(
t2.useraccount_link_id = 161 OR
t2.useraccount_link_id IS NULL
)
)
WHERE
t1.is_deleted = false AND
t1.useraccount_id = 129 AND
t1.id <> 161
is there anything in rose that will let me explicitly control the
join at run time? the Manager and Relationship docs suggest that I'm
s.o.l on this
if not... i guess i could run a second query after the first and
associate the results from the second table onto the first manually-
but thats a mess.
===
package UseraccountLink;
__PACKAGE__->meta->relationships(
privacy_override__subordinates=> {
class=>
'MyApp:RoseDB::Object::UseraccountLinkPrivacysettingOverride',
key_columns=> { id=> 'useraccount_link_id__viewed_by' },
type=> 'one to one',
},
);
package UseraccountLink::Manager;
sub get_other_useraccount_links__with_overrides {
my ( $class, %args )= @_ ;
my $results;
eval {
$results= $class->get_useraccount_link(
with_objects=> [ 'privacy_override__subordinates'],
query=> [
useraccount_id=> $args{'useraccount_id'},
is_deleted=> 0,
id=> { ne=> $args{'useraccount_link_id'} },
or=> [
'useraccount_link_privacysetting_override.useraccount_link_id'=> {
eq => $args{'useraccount_link_id'} },
'useraccount_link_privacysetting_override.useraccount_link_id'=> u
ndef,
]
],
db=> $args{'db'},
);
};
if ( $@ ) { print STDERR $@; }
return $results;
}
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object