Re: [Dbix-class] relationship with additional constraints?

2018-05-18 Thread Stuart Dodds
On 17/05/18 22:25, Matt S Trout wrote: > Surely http://p3rl.org/DBIx::Class::ParameterizedJoinHack is exactly > what's needed here - just use it on a belongs_to rel with a join_type of > left so non-matching entries are still returned, then prefetch that rel? > > (ironic since I'm replying to the

[Dbix-class] relationship with additional constraints?

2018-05-17 Thread Stuart Dodds
Hello all, Is it possible to create a relationship which has, along with the join condition, an additional constraint where the value could somehow be passed when the search() method is called? What I would like to achieve (in sql) is this: (it's a contrived example, but the structure matches

Re: [Dbix-class] has_one over joining table

2018-01-30 Thread Stuart Dodds
On 29/01/18 17:31, Andrew Beverley wrote: > Something like (in Result::Town): > > __PACKAGE__->might_have( > "town_people_mayor", > "MyApp::Schema::Result::TownPeople", > sub { > my $args = shift; > return { > "$args->{foreign_alias}.town_id" => { -ident

[Dbix-class] has_one over joining table

2018-01-29 Thread Stuart Dodds
Hi, I have a many to many relationship over a joining table, eg. towns -> town_people -> people In some cases it is possible for there to be has_one relationships between the two outer tables. It's a bit of a contrived example but lets say a person can live in multiple towns but only one is her

Re: [Dbix-class] Bug in resultset?

2010-07-07 Thread Stuart Dodds
On Wed, 2010-07-07 at 10:18 +0100, Chris Cole wrote: I'm finding when restricting a search on the same column for multiple criteria only one of them is being applied. e.g. my $rs = $self-resultset('NgsMappings')-search( { 'mp_start' = {'=', $start}, 'mp_start' = {'',

[Dbix-class] [Fwd: Re: [Catalyst] db delete]

2010-05-12 Thread Stuart Dodds
May 2010, at 17:12, Stuart Dodds wrote: This is more of a Catalyst/DBIx problem and i've probably got it wrong and it should be in the DBIx mailing list, but i know most of you guys here use both, so hopefully someone can help me out. Yes, this should be on the DBIC mailing list, sorry. Also

Re: [Dbix-class] SQL::Abstract regression?

2009-07-13 Thread Stuart Dodds
I had the exact same problem today.the only way I could fix it was to remove the prefetch from the search. -Original Message- From: Paul Makepeace pa...@paulm.com Reply-to: DBIx::Class user and developer list dbix-class@lists.scsys.co.uk To: DBIx::Class user and developer list

[Dbix-class] search NOT IN

2009-07-06 Thread Stuart Dodds
Is it possible to do a search on a field where it is not equal to a list of values. For example, the sql I would like to produce is as follows: WHERE id NOT IN (?,?,?) however doing: -search({ id = { '!=', \...@id_list } }); doesn't do the right thing as you get: WHERE id != ? OR id != ?

Re: [Dbix-class] Re: search NOT IN

2009-07-06 Thread Stuart Dodds
On Mon, Jul 06, 2009 at 04:26:27PM +0200, Stuart Dodds wrote: For example, the sql I would like to produce is as follows: WHERE id NOT IN (?,?,?) Assuming you use a recent version of SQL::Abstract, see: http://search.cpan.org/~ribasushi/SQL-Abstract-1.56/lib/SQL/Abstract.pm