> I've been kicking around a few more changes to AR::Base lately and > perhaps we could do something along these lines. My thoughts on our > querying at present are: > > * It should be in / near the adapters. >
Exactly. So, every query from AR should look like @adapter.execute() - which would make it very simple to extend/optimize. > There's already some code that needs to be different but is currently > implemented in base, by checking what the adapters support: > > # Should primary key values be selected from their corresponding > # sequence before the insert statement? If true, next_sequence_value > # is called before each insert to set the record's primary key. > # This is false for all adapters but Firebird. > def prefetch_primary_key?(table_name = nil) > false > end > This reminds me to ask, are we gonna get rid of most of the adapters from core for 2.0 ? I guess, only mysql and postgres and may be sqlite deserves to be in core. Other adapter might be better off as external libs. > That could ideally simply be handled with polymorphism > > * It should be easier to inject conditions into the generated queries. > > Basically the only reason that people are currently using with_scope > is to merge :conditions arguments. It should be easier to define > scopes, inject conditions into queries etc. This probably means some > kind of query class. > I kinda like the approach taken by scope-out plugin - http://code.google.com/p/scope-out-rails/ Instead of query class, I guess we need a Condition class first. What Courtnay suggested, looks sweet too. Just my few cents. -- Cheers! - Pratik http://m.onkey.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" 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-core?hl=en -~----------~----~----~----~------~----~------~--~---
