Changeset 7836 for django/branches/gis/django/contrib/gis/db/backend/oracle
- Timestamp:
- 07/04/08 15:16:22 (5 months ago)
- Files:
-
- django/branches/gis (modified) (1 prop)
- django/branches/gis/django/contrib/gis/db/backend/oracle/query.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/gis
- Property svnmerge-integrated changed from /django/trunk:1-7767 to /django/trunk:1-7835
django/branches/gis/django/contrib/gis/db/backend/oracle/query.py
r7641 r7836 111 111 112 112 #### The `get_geo_where_clause` function for Oracle #### 113 def get_geo_where_clause( lookup_type, table_prefix, field, value):113 def get_geo_where_clause(table_alias, name, lookup_type, geo_annot): 114 114 "Returns the SQL WHERE clause for use in Oracle spatial SQL construction." 115 115 # Getting the quoted table name as `geo_col`. 116 geo_col = '%s.%s' % (qn(table_ prefix), qn(field.column))116 geo_col = '%s.%s' % (qn(table_alias), qn(name)) 117 117 118 118 # See if a Oracle Geometry function matches the lookup type next … … 127 127 128 128 # Ensuring that a tuple _value_ was passed in from the user 129 if not isinstance( value, tuple):129 if not isinstance(geo_annot.value, tuple): 130 130 raise TypeError('Tuple required for `%s` lookup type.' % lookup_type) 131 if len( value) != 2:131 if len(geo_annot.value) != 2: 132 132 raise ValueError('2-element tuple required for %s lookup type.' % lookup_type) 133 133 134 134 # Ensuring the argument type matches what we expect. 135 if not isinstance( value[1], arg_type):136 raise TypeError('Argument type should be %s, got %s instead.' % (arg_type, type( value[1])))135 if not isinstance(geo_annot.value[1], arg_type): 136 raise TypeError('Argument type should be %s, got %s instead.' % (arg_type, type(geo_annot.value[1]))) 137 137 138 138 if lookup_type == 'relate': 139 139 # The SDORelate class handles construction for these queries, 140 140 # and verifies the mask argument. 141 return sdo_op( value[1]).as_sql(geo_col)141 return sdo_op(geo_annot.value[1]).as_sql(geo_col) 142 142 else: 143 143 # Otherwise, just call the `as_sql` method on the SDOOperation instance. … … 150 150 elif lookup_type == 'isnull': 151 151 # Handling 'isnull' lookup type 152 return "%s IS %sNULL" % (geo_col, (not value and 'NOT ' or ''))152 return "%s IS %sNULL" % (geo_col, (not geo_annot.value and 'NOT ' or '')) 153 153 154 154 raise TypeError("Got invalid lookup_type: %s" % repr(lookup_type))
