* BUCHMULLER Norbert <[EMAIL PROTECTED]> [081014 11:40]:
> On Tue, 14 Oct 2008 08:33:13 -0700 Marc Mims <[EMAIL PROTECTED]> wrote:
> Thanks, I know that, but that way I cannot use the column name in an
> 'order_by':

Are you sure you need the "as" alias for the order by?  The example you
gave to demonstrate the problem is perhaps too trivial.  Here's an
example that works just fine with an ORDER BY:

my $fn = \'length(me.name)';

$schema->resultset('Artist')->search(
    {
    },
    {
       select => [ $fn ],
       as     => [qw/one/],
       distinct => 1,
       order_by => [ $fn ],
    }
)->first;

Generated SQL:
SELECT length(me.name) FROM artist me GROUP BY length(me.name) ORDER BY
length(me.name)

        -Marc

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

Reply via email to