diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2009-12-22 15:18:51 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2009-12-22 15:18:51 +0000 |
| commit | ff60c5f9de3e8690d1e86f3e9e3f7248a15397c8 (patch) | |
| tree | a4cb0ebdd55fcaf8c8855231b6ad3e1a7bf45bee /django/contrib/gis/db/backend/mysql/field.py | |
| parent | 7ef212af149540aa2da577a960d0d87029fd1514 (diff) | |
| download | django-ff60c5f9de3e8690d1e86f3e9e3f7248a15397c8.tar.gz | |
Fixed #1142 -- Added multiple database support.
This monster of a patch is the result of Alex Gaynor's 2009 Google Summer of Code project.
Congratulations to Alex for a job well done.
Big thanks also go to:
* Justin Bronn for keeping GIS in line with the changes,
* Karen Tracey and Jani Tiainen for their help testing Oracle support
* Brett Hoerner, Jon Loyens, and Craig Kimmerer for their feedback.
* Malcolm Treddinick for his guidance during the GSoC submission process.
* Simon Willison for driving the original design process
* Cal Henderson for complaining about ponies he wanted.
... and everyone else too numerous to mention that helped to bring this feature into fruition.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11952 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/contrib/gis/db/backend/mysql/field.py')
| -rw-r--r-- | django/contrib/gis/db/backend/mysql/field.py | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/django/contrib/gis/db/backend/mysql/field.py b/django/contrib/gis/db/backend/mysql/field.py deleted file mode 100644 index e5c22f58e6..0000000000 --- a/django/contrib/gis/db/backend/mysql/field.py +++ /dev/null @@ -1,53 +0,0 @@ -from django.db import connection -from django.db.models.fields import Field # Django base Field class -from django.contrib.gis.db.backend.mysql.query import GEOM_FROM_TEXT - -# Quotename & geographic quotename, respectively. -qn = connection.ops.quote_name - -class MySQLGeoField(Field): - """ - The backend-specific geographic field for MySQL. - """ - - def _geom_index(self, style, db_table): - """ - Creates a spatial index for the geometry column. If MyISAM tables are - used an R-Tree index is created, otherwise a B-Tree index is created. - Thus, for best spatial performance, you should use MyISAM tables - (which do not support transactions). For more information, see Ch. - 16.6.1 of the MySQL 5.0 documentation. - """ - - # Getting the index name. - idx_name = '%s_%s_id' % (db_table, self.column) - - sql = (style.SQL_KEYWORD('CREATE SPATIAL INDEX ') + - style.SQL_TABLE(qn(idx_name)) + - style.SQL_KEYWORD(' ON ') + - style.SQL_TABLE(qn(db_table)) + '(' + - style.SQL_FIELD(qn(self.column)) + ');') - return sql - - def post_create_sql(self, style, db_table): - """ - Returns SQL that will be executed after the model has been - created. - """ - # Getting the geometric index for this Geometry column. - if self.spatial_index: - return (self._geom_index(style, db_table),) - else: - return () - - def db_type(self): - "The OpenGIS name is returned for the MySQL database column type." - return self.geom_type - - def get_placeholder(self, value): - """ - The placeholder here has to include MySQL's WKT constructor. Because - MySQL does not support spatial transformations, there is no need to - modify the placeholder based on the contents of the given value. - """ - return '%s(%%s)' % GEOM_FROM_TEXT |
