On Wed, Sep 2, 2009 at 2:44 PM, Waldemar Kornewald<wkornew...@gmail.com> wrote: > > Hi, > why does the backend's query_class() function get the default query > class as its parameter? Can't the backend just import BaseQuery? I'm > asking because with different BaseQuery implementations (for SQL and > non-SQL) there is no real default query class, anymore.
I'll be the first to admit that the Query/BaseQuery/query_class() infrastruture is a little bit messy. The query_class() method on the backend exists for the benefit of Oracle. Oracle requires special handling for queries that involve LIMIT and OFFSET, as well as some custom type conversions. The reason you pass in the base class is because the Oracle backend takes the BaseQuery class, and constructs a subclass of BaseQuery that has the Oracle-specific modifications. This can't be done using simple subclassing because the InsertQuery, DeleteQuery et al are themselves subclasses of Query - or, in the case of Oracle, the generated Oracle subclass. You'll note that the only place that query_class() is used is at the bottom of sql/query.py, where the call to query_class is used to determine whether BaseQuery or a backend-generated query_class() will be used as sql.Query. This is an area of the code that is currently causing difficulty for the multi-database project. Obviously, this is also an area that affects non-SQL backends. If you have any particular requirements or design suggestions here, it would be helpful to know what they are. I was hoping to dig into this during the sprints at DjangoCon when Malcolm and I will be in the same room; the more background and requirements we have, the better. Yours, Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---