Changeset 6527
- Timestamp:
- 10/18/07 19:34:29 (1 year ago)
- Files:
-
- django/branches/gis/django/contrib/gis/db/backend/__init__.py (modified) (1 diff)
- django/branches/gis/django/contrib/gis/db/backend/mysql (added)
- django/branches/gis/django/contrib/gis/db/backend/mysql/creation.py (added)
- django/branches/gis/django/contrib/gis/db/backend/mysql/field.py (added)
- django/branches/gis/django/contrib/gis/db/backend/mysql/__init__.py (added)
- django/branches/gis/django/contrib/gis/db/backend/mysql/query.py (added)
- django/branches/gis/django/contrib/gis/db/backend/oracle/__init__.py (modified) (1 diff)
- django/branches/gis/django/contrib/gis/db/backend/oracle/query.py (modified) (1 diff)
- django/branches/gis/django/contrib/gis/tests/geoapp/models.py (modified) (2 diffs)
- django/branches/gis/django/contrib/gis/tests/geoapp/sql/city.mysql.sql (added)
- django/branches/gis/django/contrib/gis/tests/geoapp/sql/country.mysql.sql (added)
- django/branches/gis/django/contrib/gis/tests/geoapp/sql/state.mysql.sql (added)
- django/branches/gis/django/contrib/gis/tests/geoapp/tests_mysql.py (added)
- django/branches/gis/django/contrib/gis/tests/__init__.py (modified) (2 diffs)
- django/branches/gis/django/contrib/gis/tests/test_spatialrefsys.py (modified) (4 diffs)
- django/branches/gis/django/contrib/gis/tests/utils.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/gis/django/contrib/gis/db/backend/__init__.py
r6524 r6527 44 44 ASGML, GEOM_SELECT, TRANSFORM, UNION 45 45 SPATIAL_BACKEND = 'oracle' 46 elif settings.DATABASE_ENGINE == 'mysql': 47 from django.contrib.gis.db.backend.mysql import \ 48 MySQLGeoField as GeoBackendField, \ 49 MYSQL_GIS_TERMS as GIS_TERMS, \ 50 create_spatial_db, get_geo_where_clause, gqn, \ 51 GEOM_SELECT 52 SPATIAL_BACKEND = 'mysql' 46 53 else: 47 54 raise NotImplementedError('No Geographic Backend exists for %s' % settings.DATABASE_ENGINE) django/branches/gis/django/contrib/gis/db/backend/oracle/__init__.py
r6524 r6527 2 2 The Oracle spatial database backend module. 3 3 4 Please note that WKT support is broken on the XE version, and this will 5 not work. 4 Please note that WKT support is broken on the XE version, and thus 5 this backend will not work on such platforms. Specifically, XE lacks 6 support for an internal JVM, and Java libraries are required to use 7 the WKT constructors. 6 8 """ 7 9 from django.contrib.gis.db.backend.oracle.creation import create_spatial_db django/branches/gis/django/contrib/gis/db/backend/oracle/query.py
r6524 r6527 36 36 field_name = qn(field_name) 37 37 38 # See if a PostGISGeometry function matches the lookup type next38 # See if a Oracle Geometry function matches the lookup type next 39 39 lookup_info = ORACLE_GEOMETRY_FUNCTIONS.get(lookup_type, False) 40 40 if lookup_info: django/branches/gis/django/contrib/gis/tests/geoapp/models.py
r6467 r6527 1 1 from django.contrib.gis.db import models 2 from django.contrib.gis.tests.utils import mysql 3 4 # MySQL spatial indices can't handle NULL geometries. 5 null_flag = not mysql 2 6 3 7 class Country(models.Model): … … 13 17 class State(models.Model): 14 18 name = models.CharField(max_length=30) 15 poly = models.PolygonField(null= True) # Allowing NULL geometries here.19 poly = models.PolygonField(null=null_flag) # Allowing NULL geometries here. 16 20 objects = models.GeoManager() 17 21 django/branches/gis/django/contrib/gis/tests/__init__.py
r6441 r6527 3 3 from unittest import TestSuite, TextTestRunner 4 4 from django.contrib.gis.gdal import HAS_GDAL 5 from django.contrib.gis.tests.utils import mysql 5 6 6 7 # Tests that do not require setting up and tearing down a spatial database. … … 85 86 for test_model in test_models: 86 87 module_name = 'django.contrib.gis.tests.%s' % test_model 88 if mysql: 89 test_module_name = 'tests_mysql' 90 else: 91 test_module_name = 'tests' 87 92 settings.INSTALLED_APPS.append(module_name) 88 tsuite = getattr(__import__('django.contrib.gis.tests.%s' % test_model, globals(), locals(), [ 'tests']), 'tests')93 tsuite = getattr(__import__('django.contrib.gis.tests.%s' % test_model, globals(), locals(), [test_module_name]), test_module_name) 89 94 test_suite.addTest(tsuite.suite()) 90 95 django/branches/gis/django/contrib/gis/tests/test_spatialrefsys.py
r6524 r6527 1 1 import unittest 2 from django.contrib.gis.models import SpatialRefSys 3 from django.contrib.gis.tests.utils import oracle, postgis 2 from django.contrib.gis.tests.utils import mysql, no_mysql, oracle, postgis 3 if not mysql: 4 from django.contrib.gis.models import SpatialRefSys 4 5 5 6 test_srs = ({'srid' : 4326, … … 27 28 class SpatialRefSysTest(unittest.TestCase): 28 29 30 @no_mysql 29 31 def test01_retrieve(self): 30 32 "Testing retrieval of SpatialRefSys model objects." … … 47 49 self.assertEqual(sd['proj4'], srs.proj4text) 48 50 51 @no_mysql 49 52 def test02_osr(self): 50 53 "Testing getting OSR objects from SpatialRefSys model objects." … … 62 65 self.assertEqual(sd['srtext'], srs.wkt) 63 66 67 @no_mysql 64 68 def test03_ellipsoid(self): 65 69 "Testing the ellipsoid property." django/branches/gis/django/contrib/gis/tests/utils.py
r6524 r6527 15 15 def no_oracle(func): return no_backend(func, 'oracle') 16 16 def no_postgis(func): return no_backend(func, 'postgresql_psycopg2') 17 def no_mysql(func): return no_backend(func, 'mysql') 17 18 18 19 # Shortcut booleans to omit only portions of tests. 19 20 oracle = settings.DATABASE_ENGINE == 'oracle' 20 21 postgis = settings.DATABASE_ENGINE == 'postgresql_psycopg2' 22 mysql = settings.DATABASE_ENGINE == 'mysql'
