[Dbix-class] UNION, INTERSECTION, nested queries

Matt S Trout dbix-class at trout.me.uk
Thu May 24 16:52:59 GMT 2007


On Thu, May 24, 2007 at 08:37:34AM -0300, Fernan Aguero wrote:
> I'd like to simplify my code, be it the code in the
> controller or in the template (the outputting code). So
> instead of having to run each query, get the items, and try
> to sort them in code do something like:
> 
> $rs = $model->search(
> 	[ -union => 
> 		{ $query1->{where}, $query1->{attr} },
> 		{ $query2->{where}, $query2->{attr} },
> 		etc.
> 	],
> 	{ order_by => 'score DESC' }
> );
> 
> 
> Of course being able to use -union, -intersection, -minus,
> interchangeably.

I'd like to be able to do -union => [ $rs1, $rs2 ]
 
> That would be an elegant solution.
> 
> I was just wondering whether this syntax/functionality is
> available, being worked on, planned, drafted, or already
> discussed and discarded?
> 
> I'm not familiar with the DBIC internals (or those of
> SQL::Abstract), but I volunteer myself to the task if
> someone is willing to mentor me on this.

Getting to the point where this sort of thing works is a primary reason
I volunteered the DBIC team to take over SQL::Abstract maintenance, I was
hoping we could make a start on it as soon as we get 08000 out the door.

I'd love some help, somebody willing to really drive forwards on this
area would probably make more headway than me since I've got so many other
things I also want to work on, and I'd be delighted to take as much time as
you need to mentor, discuss and help shake the design out.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/             http://www.shadowcatsystems.co.uk/ 



More information about the Dbix-class mailing list