[Catalyst] Support distinct in search() and search_like()

Pedro Melo melo at simplicidade.org
Mon Nov 7 17:56:03 CET 2005


Hi,

I needed Class::DBI::Sweet search() to use SELECT DISTINCT in one 
project I'm working on.

Attached it's a patch that adds a new search attribute, distinct, that 
forces the distinct keyword.

I'm using it like this:

   return EFO::M::CDBI::Cursos->search({
       'estado' => 3,
       'events.formador_id' => $self->id,
       'events.data_inicio' => \'>= now()',
     },
     {
       order_by => 'nome',
       distinct => 1,
     }
   );

I don't know if other people need this, but it was very useful to me, 
specially when your search uses other joined tables via a one-to-many 
relationship.

thanks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sweet.diff
Type: application/octet-stream
Size: 802 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20051107/e1a8534e/sweet.obj
-------------- next part --------------

--
Pedro Melo
JID: melo at simplicidade.org


More information about the Catalyst mailing list