[email protected] wrote in post #972869: > On Jan 5, 12:10pm, Marnen Laibow-Koser <[email protected]> wrote: >> syntax, without proprietary extensions. This gives the best portability >> across databases. > > Just tacking on another suggestion to this if people are reading back > through here: if you do need literal SQL its a good idea to put it in > a configuration file with a lookup key > (i.e. :count_all_my_angry_birds);
Why not just use a named scope (or the Rails 3 equivalent)? That's what I tend to do for complex queries. Granted, you don't get all the SQL in one file, but that's a *good* thing: it means you're looking at the SQL in context. I want to like your config file idea, but I think it's just reinventing stored procedures in a way that removes their remaining advantages. > that way if you switch db engines or > support multiple ones all your specific SQL is in one location that > you can ensure works for whatever different dbs you need to support. > And of course keep that file as ANSI compliant so that there are as > little changes required as possible. ...in which case your proposed solution isn't necessary anyway. :) > > \Peter Best, -- Marnen Laibow-Koser http://www.marnen.org [email protected] -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

