diff options
| author | Claude Paroz <claude@2xlibre.net> | 2013-09-12 11:14:16 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2013-09-12 11:14:16 +0200 |
| commit | 4c5641dd92e5cfa0223f417f30d109ff998b8041 (patch) | |
| tree | 40e8327ead29ecb65ef09bb848047d1056f759d7 | |
| parent | c82f6c2227f1b86df8726293e8d6d59449b0ab93 (diff) | |
Fixed inspectdb test for spatialite >=4
| -rw-r--r-- | django/contrib/gis/db/backends/spatialite/introspection.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/django/contrib/gis/db/backends/spatialite/introspection.py b/django/contrib/gis/db/backends/spatialite/introspection.py index 4f12ade114..90ed83fa08 100644 --- a/django/contrib/gis/db/backends/spatialite/introspection.py +++ b/django/contrib/gis/db/backends/spatialite/introspection.py @@ -25,9 +25,10 @@ class SpatiaLiteIntrospection(DatabaseIntrospection): cursor = self.connection.cursor() try: # Querying the `geometry_columns` table to get additional metadata. - cursor.execute('SELECT "coord_dimension", "srid", "type" ' - 'FROM "geometry_columns" ' - 'WHERE "f_table_name"=%s AND "f_geometry_column"=%s', + type_col = 'type' if self.connection.ops.spatial_version < (4, 0, 0) else 'geometry_type' + cursor.execute('SELECT coord_dimension, srid, %s ' + 'FROM geometry_columns ' + 'WHERE f_table_name=%%s AND f_geometry_column=%%s' % type_col, (table_name, geo_col)) row = cursor.fetchone() if not row: |
