Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[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
@jbronn jbronn authored
View
5 django/contrib/gis/db/backend/mysql/query.py
@@ -7,9 +7,6 @@
indices may only be used on MyISAM tables -- if you need
transactions, take a look at PostGIS.
"""
-from django.db import connection
-qn = connection.ops.quote_name
-
# To ease implementation, WKT is passed to/from MySQL.
GEOM_FROM_TEXT = 'GeomFromText'
GEOM_FROM_WKB = 'GeomFromWKB'
@@ -40,7 +37,7 @@
MYSQL_GIS_TERMS += MISC_TERMS
MYSQL_GIS_TERMS = dict((term, None) for term in MYSQL_GIS_TERMS) # Making dictionary
-def get_geo_where_clause(table_alias, name, lookup_type, geo_annot):
+def get_geo_where_clause(table_alias, name, lookup_type, geo_annot, qn):
"Returns the SQL WHERE clause for use in MySQL spatial SQL construction."
# Getting the quoted field as `geo_col`.
geo_col = '%s.%s' % (qn(table_alias), qn(name))
View
4 django/contrib/gis/db/backend/oracle/query.py
@@ -9,10 +9,8 @@
"""
import re
from decimal import Decimal
-from django.db import connection
from django.contrib.gis.db.backend.util import SpatialFunction
from django.contrib.gis.measure import Distance
-qn = connection.ops.quote_name
# The GML, distance, transform, and union procedures.
AREA = 'SDO_GEOM.SDO_AREA'
@@ -110,7 +108,7 @@ def __init__(self, mask):
ORACLE_SPATIAL_TERMS = dict((term, None) for term in ORACLE_SPATIAL_TERMS) # Making dictionary for fast lookups
#### The `get_geo_where_clause` function for Oracle ####
-def get_geo_where_clause(table_alias, name, lookup_type, geo_annot):
+def get_geo_where_clause(table_alias, name, lookup_type, geo_annot, qn):
"Returns the SQL WHERE clause for use in Oracle spatial SQL construction."
# Getting the quoted table name as `geo_col`.
geo_col = '%s.%s' % (qn(table_alias), qn(name))
View
5 django/contrib/gis/db/backend/postgis/query.py
@@ -5,13 +5,10 @@
import re
from decimal import Decimal
-from django.db import connection
from django.conf import settings
from django.contrib.gis.measure import Distance
from django.contrib.gis.db.backend.util import SpatialOperation, SpatialFunction
-qn = connection.ops.quote_name
-
# Get the PostGIS version information.
# To avoid the need to do a database query to determine the PostGIS version
# each time the server starts up, one can optionally specify a
@@ -250,7 +247,7 @@ def num_params(lookup_type, val):
else: return exactly_two(val)
#### The `get_geo_where_clause` function for PostGIS. ####
-def get_geo_where_clause(table_alias, name, lookup_type, geo_annot):
+def get_geo_where_clause(table_alias, name, lookup_type, geo_annot, qn):
"Returns the SQL WHERE clause for use in PostGIS SQL construction."
# Getting the quoted field as `geo_col`.
geo_col = '%s.%s' % (qn(table_alias), qn(name))
View
4 django/contrib/gis/db/backend/spatialite/query.py
@@ -4,10 +4,8 @@
"""
import re
from decimal import Decimal
-from django.db import connection
from django.contrib.gis.measure import Distance
from django.contrib.gis.db.backend.util import SpatialOperation, SpatialFunction
-qn = connection.ops.quote_name
GEOM_SELECT = 'AsText(%s)'
@@ -115,7 +113,7 @@ def get_dist_ops(operator):
SPATIALITE_TERMS = dict((term, None) for term in SPATIALITE_TERMS) # Making a dictionary for fast lookups
#### The `get_geo_where_clause` function for SpatiaLite. ####
-def get_geo_where_clause(table_alias, name, lookup_type, geo_annot):
+def get_geo_where_clause(table_alias, name, lookup_type, geo_annot, qn):
"Returns the SQL WHERE clause for use in SpatiaLite SQL construction."
# Getting the quoted field as `geo_col`.
geo_col = '%s.%s' % (qn(table_alias), qn(name))
View
2  django/contrib/gis/db/models/sql/where.py
@@ -87,7 +87,7 @@ def make_atom(self, child, qn):
# will be populated in the GeoFieldSQL object returned by the
# GeometryField.
alias, col, db_type = obj
- gwc = get_geo_where_clause(alias, col, lookup_type, value_annot)
+ gwc = get_geo_where_clause(alias, col, lookup_type, value_annot, qn)
return gwc % value_annot.where, params
else:
raise TypeError('Invalid lookup type: %r' % lookup_type)
Please sign in to comment.
Something went wrong with that request. Please try again.