A. Pagaltzis wrote: > * Ash Berlin <[EMAIL PROTECTED]> [2006-06-22 13:50]: > >> 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' } ] } >> > > Errm, seriously: you find that more readable than literal SQL? > No, just more portable. What if you change the table name but forget to change it one place in your code, or add an age column to another table etc. etc. > As a sidenote, this will take effort to implement, because you’re > using the same notation for `case` as for functions, which means > the SQL renderer has to know it’s not, which means it needs > hardwired knowledge of specific constructs. And what about > vendor-specific SQL extensions. > $ash_said = q{Of course this would require special code to detect the case "function"} > All of this so you can cast fairly clean SQL as a jumble of > brackets, braces and arrows. > > I’m unconvinced. :-( > > Regards, >
_______________________________________________ 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/dbix-class@lists.rawmode.org/