So I have this search:

my $addr = 16843009;

$rs->search( {
            address => { '<=', $addr },
            $addr => \'<= (address - 1 + (2 << 31 - bits))'
});


(Essentially, this finds the parent networks of an IP address whose int
val is $addr (aka 1.1.1.1))

And I want to turn it into a join (so I can prefetch it), but I'm running
into problems.  I've tried something like this:

__PACKAGE__->belongs_to( parent => 'MyApp::DB::Network',
    {
        'foreign.address'      => { '<=', 'self.address' },
        'self.address'         => \'<= (foreign.address - 1 + (2 << 31 -
foreign.bits))'
    },
    { join     => [qw(network)] }
);


but it looks like DBIx::Class joins won't accept anything but /^foreign./
named keys.  Any ideas on how I could get something like this to work?

--
/chris/


_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to