1 """ |
1 from django.db import connection |
2 This module provides the backend for spatial SQL construction with Django. |
|
3 |
2 |
4 Specifically, this module will import the correct routines and modules |
3 if hasattr(connection.ops, 'spatial_version'): |
5 needed for GeoDjango to interface with the spatial database. |
4 from warnings import warn |
6 """ |
5 warn('The `django.contrib.gis.db.backend` module was refactored and ' |
7 from django.conf import settings |
6 'renamed to `django.contrib.gis.db.backends` in 1.2. ' |
8 from django.contrib.gis.db.backend.util import gqn |
7 'All functionality of `SpatialBackend` ' |
9 |
8 'has been moved to the `ops` attribute of the spatial database ' |
10 # Retrieving the necessary settings from the backend. |
9 'backend. A `SpatialBackend` alias is provided here for ' |
11 if settings.DATABASE_ENGINE == 'postgresql_psycopg2': |
10 'backwards-compatibility, but will be removed in 1.3.') |
12 from django.contrib.gis.db.backend.postgis import create_test_spatial_db, get_geo_where_clause, SpatialBackend |
11 SpatialBackend = connection.ops |
13 elif settings.DATABASE_ENGINE == 'oracle': |
|
14 from django.contrib.gis.db.backend.oracle import create_test_spatial_db, get_geo_where_clause, SpatialBackend |
|
15 elif settings.DATABASE_ENGINE == 'mysql': |
|
16 from django.contrib.gis.db.backend.mysql import create_test_spatial_db, get_geo_where_clause, SpatialBackend |
|
17 elif settings.DATABASE_ENGINE == 'sqlite3': |
|
18 from django.contrib.gis.db.backend.spatialite import create_test_spatial_db, get_geo_where_clause, SpatialBackend |
|
19 else: |
|
20 raise NotImplementedError('No Geographic Backend exists for %s' % settings.DATABASE_ENGINE) |
|