A. Pagaltzis wrote:
> * Ash Berlin <[EMAIL PROTECTED]> [2006-06-21 17:05]:
>   
>> Hows about:
>>
>> order_by => [ asc => 'name', 'lastname', desc => {sum => [ 'age' ] } ]
>>
>> (A cross between yours and what Jess had)
>>     
>
> What’s the point of that arrayref? What does the following mean?
>
>     { sum => [ 'foo', 'bar' ] }
>
> Also, what syntax do folks suggest for specifying something like
> the following contrived order clause?
>
>     CASE
>         WHEN age < 18 THEN NULL
>         WHEN age > 45 THEN NULL
>         ELSE age
>     END
>
> Or think about writing casts.
>
> Seems pretty pointless to me to invent any syntax beyond
> accepting literal SQL…
>
> Regards,
>   
The reason for they array ref is if a function takes more than one param.

As for a go at taking that contrived CASE clause:

{ case => [ [ age => '<' => 18 => 'NULL'], [age => '>' => 45 => 'NULL'], 
['age'] ] }

Possible with WHEN/ELSE keys:

{ case => [ { where => 'age' => '<' => 18 => 'NULL'}, {where => 'age' => 
'>' => 45 => 'NULL'}, { else => 'age' } ] }

(This could also apply as a where clause.) Of course this would require 
special code to detect the case "function" but currently the only other 
solution is raw SQL anyway.

Perhaps overly complex - thoughts?

Ash



_______________________________________________
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