[1.1.X] Fixed #12828 -- The table quoting function is now argument get_geo_where_clause
.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12587 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
49194df8c3
commit
231eb1d3ac
@ -7,9 +7,6 @@
|
|||||||
indices may only be used on MyISAM tables -- if you need
|
indices may only be used on MyISAM tables -- if you need
|
||||||
transactions, take a look at PostGIS.
|
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.
|
# To ease implementation, WKT is passed to/from MySQL.
|
||||||
GEOM_FROM_TEXT = 'GeomFromText'
|
GEOM_FROM_TEXT = 'GeomFromText'
|
||||||
GEOM_FROM_WKB = 'GeomFromWKB'
|
GEOM_FROM_WKB = 'GeomFromWKB'
|
||||||
@ -40,7 +37,7 @@ MYSQL_GIS_TERMS = MYSQL_GIS_FUNCTIONS.keys()
|
|||||||
MYSQL_GIS_TERMS += MISC_TERMS
|
MYSQL_GIS_TERMS += MISC_TERMS
|
||||||
MYSQL_GIS_TERMS = dict((term, None) for term in MYSQL_GIS_TERMS) # Making dictionary
|
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."
|
"Returns the SQL WHERE clause for use in MySQL spatial SQL construction."
|
||||||
# Getting the quoted field as `geo_col`.
|
# Getting the quoted field as `geo_col`.
|
||||||
geo_col = '%s.%s' % (qn(table_alias), qn(name))
|
geo_col = '%s.%s' % (qn(table_alias), qn(name))
|
||||||
|
@ -9,10 +9,8 @@
|
|||||||
"""
|
"""
|
||||||
import re
|
import re
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from django.db import connection
|
|
||||||
from django.contrib.gis.db.backend.util import SpatialFunction
|
from django.contrib.gis.db.backend.util import SpatialFunction
|
||||||
from django.contrib.gis.measure import Distance
|
from django.contrib.gis.measure import Distance
|
||||||
qn = connection.ops.quote_name
|
|
||||||
|
|
||||||
# The GML, distance, transform, and union procedures.
|
# The GML, distance, transform, and union procedures.
|
||||||
AREA = 'SDO_GEOM.SDO_AREA'
|
AREA = 'SDO_GEOM.SDO_AREA'
|
||||||
@ -110,7 +108,7 @@ ORACLE_SPATIAL_TERMS += MISC_TERMS
|
|||||||
ORACLE_SPATIAL_TERMS = dict((term, None) for term in ORACLE_SPATIAL_TERMS) # Making dictionary for fast lookups
|
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 ####
|
#### 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."
|
"Returns the SQL WHERE clause for use in Oracle spatial SQL construction."
|
||||||
# Getting the quoted table name as `geo_col`.
|
# Getting the quoted table name as `geo_col`.
|
||||||
geo_col = '%s.%s' % (qn(table_alias), qn(name))
|
geo_col = '%s.%s' % (qn(table_alias), qn(name))
|
||||||
|
@ -5,13 +5,10 @@
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from django.db import connection
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.gis.measure import Distance
|
from django.contrib.gis.measure import Distance
|
||||||
from django.contrib.gis.db.backend.util import SpatialOperation, SpatialFunction
|
from django.contrib.gis.db.backend.util import SpatialOperation, SpatialFunction
|
||||||
|
|
||||||
qn = connection.ops.quote_name
|
|
||||||
|
|
||||||
# Get the PostGIS version information.
|
# Get the PostGIS version information.
|
||||||
# To avoid the need to do a database query to determine the PostGIS version
|
# 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
|
# 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)
|
else: return exactly_two(val)
|
||||||
|
|
||||||
#### The `get_geo_where_clause` function for PostGIS. ####
|
#### 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."
|
"Returns the SQL WHERE clause for use in PostGIS SQL construction."
|
||||||
# Getting the quoted field as `geo_col`.
|
# Getting the quoted field as `geo_col`.
|
||||||
geo_col = '%s.%s' % (qn(table_alias), qn(name))
|
geo_col = '%s.%s' % (qn(table_alias), qn(name))
|
||||||
|
@ -4,10 +4,8 @@
|
|||||||
"""
|
"""
|
||||||
import re
|
import re
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from django.db import connection
|
|
||||||
from django.contrib.gis.measure import Distance
|
from django.contrib.gis.measure import Distance
|
||||||
from django.contrib.gis.db.backend.util import SpatialOperation, SpatialFunction
|
from django.contrib.gis.db.backend.util import SpatialOperation, SpatialFunction
|
||||||
qn = connection.ops.quote_name
|
|
||||||
|
|
||||||
GEOM_SELECT = 'AsText(%s)'
|
GEOM_SELECT = 'AsText(%s)'
|
||||||
|
|
||||||
@ -115,7 +113,7 @@ SPATIALITE_TERMS += MISC_TERMS # Adding any other miscellaneous terms (e.g., 'is
|
|||||||
SPATIALITE_TERMS = dict((term, None) for term in SPATIALITE_TERMS) # Making a dictionary for fast lookups
|
SPATIALITE_TERMS = dict((term, None) for term in SPATIALITE_TERMS) # Making a dictionary for fast lookups
|
||||||
|
|
||||||
#### The `get_geo_where_clause` function for SpatiaLite. ####
|
#### 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."
|
"Returns the SQL WHERE clause for use in SpatiaLite SQL construction."
|
||||||
# Getting the quoted field as `geo_col`.
|
# Getting the quoted field as `geo_col`.
|
||||||
geo_col = '%s.%s' % (qn(table_alias), qn(name))
|
geo_col = '%s.%s' % (qn(table_alias), qn(name))
|
||||||
|
@ -87,7 +87,7 @@ class GeoWhereNode(WhereNode):
|
|||||||
# will be populated in the GeoFieldSQL object returned by the
|
# will be populated in the GeoFieldSQL object returned by the
|
||||||
# GeometryField.
|
# GeometryField.
|
||||||
alias, col, db_type = obj
|
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
|
return gwc % value_annot.where, params
|
||||||
else:
|
else:
|
||||||
raise TypeError('Invalid lookup type: %r' % lookup_type)
|
raise TypeError('Invalid lookup type: %r' % lookup_type)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user