Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.1.X] Fixed #12828 -- The table quoting function is now argument `g…

…et_geo_where_clause`.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12587 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 231eb1d3ac8da25c37a748785966ce543eea9fbe 1 parent 49194df
Justin Bronn authored February 24, 2010
5  django/contrib/gis/db/backend/mysql/query.py
@@ -7,9 +7,6 @@
7 7
  indices may only be used on MyISAM tables -- if you need 
8 8
  transactions, take a look at PostGIS.
9 9
 """
10  
-from django.db import connection
11  
-qn = connection.ops.quote_name
12  
-
13 10
 # To ease implementation, WKT is passed to/from MySQL.
14 11
 GEOM_FROM_TEXT = 'GeomFromText'
15 12
 GEOM_FROM_WKB = 'GeomFromWKB'
@@ -40,7 +37,7 @@
40 37
 MYSQL_GIS_TERMS += MISC_TERMS
41 38
 MYSQL_GIS_TERMS = dict((term, None) for term in MYSQL_GIS_TERMS) # Making dictionary 
42 39
 
43  
-def get_geo_where_clause(table_alias, name, lookup_type, geo_annot):
  40
+def get_geo_where_clause(table_alias, name, lookup_type, geo_annot, qn):
44 41
     "Returns the SQL WHERE clause for use in MySQL spatial SQL construction."
45 42
     # Getting the quoted field as `geo_col`.
46 43
     geo_col = '%s.%s' % (qn(table_alias), qn(name))
4  django/contrib/gis/db/backend/oracle/query.py
@@ -9,10 +9,8 @@
9 9
 """
10 10
 import re
11 11
 from decimal import Decimal
12  
-from django.db import connection
13 12
 from django.contrib.gis.db.backend.util import SpatialFunction
14 13
 from django.contrib.gis.measure import Distance
15  
-qn = connection.ops.quote_name
16 14
 
17 15
 # The GML, distance, transform, and union procedures.
18 16
 AREA = 'SDO_GEOM.SDO_AREA'
@@ -110,7 +108,7 @@ def __init__(self, mask):
110 108
 ORACLE_SPATIAL_TERMS = dict((term, None) for term in ORACLE_SPATIAL_TERMS) # Making dictionary for fast lookups
111 109
 
112 110
 #### The `get_geo_where_clause` function for Oracle ####
113  
-def get_geo_where_clause(table_alias, name, lookup_type, geo_annot):
  111
+def get_geo_where_clause(table_alias, name, lookup_type, geo_annot, qn):
114 112
     "Returns the SQL WHERE clause for use in Oracle spatial SQL construction."
115 113
     # Getting the quoted table name as `geo_col`.
116 114
     geo_col = '%s.%s' % (qn(table_alias), qn(name))
5  django/contrib/gis/db/backend/postgis/query.py
@@ -5,13 +5,10 @@
5 5
 
6 6
 import re
7 7
 from decimal import Decimal
8  
-from django.db import connection
9 8
 from django.conf import settings
10 9
 from django.contrib.gis.measure import Distance
11 10
 from django.contrib.gis.db.backend.util import SpatialOperation, SpatialFunction
12 11
 
13  
-qn = connection.ops.quote_name
14  
-
15 12
 # Get the PostGIS version information.
16 13
 # To avoid the need to do a database query to determine the PostGIS version
17 14
 # each time the server starts up, one can optionally specify a
@@ -250,7 +247,7 @@ def num_params(lookup_type, val):
250 247
     else: return exactly_two(val)
251 248
 
252 249
 #### The `get_geo_where_clause` function for PostGIS. ####
253  
-def get_geo_where_clause(table_alias, name, lookup_type, geo_annot):
  250
+def get_geo_where_clause(table_alias, name, lookup_type, geo_annot, qn):
254 251
     "Returns the SQL WHERE clause for use in PostGIS SQL construction."
255 252
     # Getting the quoted field as `geo_col`.
256 253
     geo_col = '%s.%s' % (qn(table_alias), qn(name))
4  django/contrib/gis/db/backend/spatialite/query.py
@@ -4,10 +4,8 @@
4 4
 """
5 5
 import re
6 6
 from decimal import Decimal
7  
-from django.db import connection
8 7
 from django.contrib.gis.measure import Distance
9 8
 from django.contrib.gis.db.backend.util import SpatialOperation, SpatialFunction
10  
-qn = connection.ops.quote_name
11 9
 
12 10
 GEOM_SELECT = 'AsText(%s)'
13 11
 
@@ -115,7 +113,7 @@ def get_dist_ops(operator):
115 113
 SPATIALITE_TERMS = dict((term, None) for term in SPATIALITE_TERMS) # Making a dictionary for fast lookups
116 114
 
117 115
 #### The `get_geo_where_clause` function for SpatiaLite. ####
118  
-def get_geo_where_clause(table_alias, name, lookup_type, geo_annot):
  116
+def get_geo_where_clause(table_alias, name, lookup_type, geo_annot, qn):
119 117
     "Returns the SQL WHERE clause for use in SpatiaLite SQL construction."
120 118
     # Getting the quoted field as `geo_col`.
121 119
     geo_col = '%s.%s' % (qn(table_alias), qn(name))
2  django/contrib/gis/db/models/sql/where.py
@@ -87,7 +87,7 @@ def make_atom(self, child, qn):
87 87
                 # will be populated in the GeoFieldSQL object returned by the
88 88
                 # GeometryField.
89 89
                 alias, col, db_type = obj
90  
-                gwc = get_geo_where_clause(alias, col, lookup_type, value_annot)
  90
+                gwc = get_geo_where_clause(alias, col, lookup_type, value_annot, qn)
91 91
                 return gwc % value_annot.where, params
92 92
             else:
93 93
                 raise TypeError('Invalid lookup type: %r' % lookup_type)

0 notes on commit 231eb1d

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