Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added local 'qn' variable for backend.quote_name in django.db.models.…

…query.fill_table_cache

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3326 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit cfcd4a5875ae3368b6c2f88299d8c8c85dba0c55 1 parent 98597be
Adrian Holovaty authored July 11, 2006

Showing 1 changed file with 5 additions and 5 deletions. Show diff stats Hide diff stats

  1. 10  django/db/models/query.py
10  django/db/models/query.py
@@ -667,20 +667,20 @@ def fill_table_cache(opts, select, tables, where, old_prefix, cache_tables_seen)
667 667
     Helper function that recursively populates the select, tables and where (in
668 668
     place) for select_related queries.
669 669
     """
  670
+    qn = backend.quote_name
670 671
     for f in opts.fields:
671 672
         if f.rel and not f.null:
672 673
             db_table = f.rel.to._meta.db_table
673 674
             if db_table not in cache_tables_seen:
674  
-                tables.append(backend.quote_name(db_table))
  675
+                tables.append(qn(db_table))
675 676
             else: # The table was already seen, so give it a table alias.
676 677
                 new_prefix = '%s%s' % (db_table, len(cache_tables_seen))
677  
-                tables.append('%s %s' % (backend.quote_name(db_table), backend.quote_name(new_prefix)))
  678
+                tables.append('%s %s' % (qn(db_table), qn(new_prefix)))
678 679
                 db_table = new_prefix
679 680
             cache_tables_seen.append(db_table)
680 681
             where.append('%s.%s = %s.%s' % \
681  
-                (backend.quote_name(old_prefix), backend.quote_name(f.column),
682  
-                backend.quote_name(db_table), backend.quote_name(f.rel.get_related_field().column)))
683  
-            select.extend(['%s.%s' % (backend.quote_name(db_table), backend.quote_name(f2.column)) for f2 in f.rel.to._meta.fields])
  682
+                (qn(old_prefix), qn(f.column), qn(db_table), qn(f.rel.get_related_field().column)))
  683
+            select.extend(['%s.%s' % (qn(db_table), qn(f2.column)) for f2 in f.rel.to._meta.fields])
684 684
             fill_table_cache(f.rel.to._meta, select, tables, where, db_table, cache_tables_seen)
685 685
 
686 686
 def parse_lookup(kwarg_items, opts):

0 notes on commit cfcd4a5

Please sign in to comment.
Something went wrong with that request. Please try again.