7 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: MySQL Point compatib...| From | Sent On | Attachments |
|---|---|---|
| DJW | 27 Feb 2008 00:20 | |
| Michael Bayer | 27 Feb 2008 11:14 | |
| DJW | 27 Feb 2008 18:20 | |
| Michael Bayer | 28 Feb 2008 07:12 | |
| jason kirtland | 28 Feb 2008 09:01 | |
| DJW | 28 Feb 2008 09:58 | |
| jason kirtland | 28 Feb 2008 10:05 |
| Subject: | [sqlalchemy] Re: MySQL Point compatibility - hack attempt #1![]() |
|---|---|
| From: | Michael Bayer (mike...@zzzcomputing.com) |
| Date: | 02/28/2008 07:12:13 AM |
| List: | com.googlegroups.sqlalchemy |
On Feb 27, 2008, at 9:20 PM, DJW wrote:
One of a sucession of quick hacks involved repacking the points, but some problems came up
Before the two doubles, theres a couple bytes of semi-useless data. A big/small endian flag, then a 8 bit flag, that tells the engine that the data is a POINT class/object/variable.
I read today: http://dev.mysql.com/doc/refman/5.0/en/populating-spatial-columns.html
That shows I'd still need some sort of function in the VALUES() element of an update to make it work, even as hex.
well for now, you'd have to render INSERT and UPDATE statements and any other time you want to use this using table.update(values={'mycol':func.GeomFromText(x, y)}).
We dont yet have a feature whereby the type of a column will render a function call into the SQL automatically based on bind parameter type. A hack to make it work would be to override bindparam_string() in MySQLCompiler to check the type of bind param, get the dialect-specific type from it if needed, and then render the function if appropriate. A generalized solution would be to add an additional method, or preferably an optional template string attribute, to AbstractTypeEngine. In this case it would be something like "GeomFromText(%s)".
if we wanted to include the feature for generic types whose dialect- specific type may require this behavior (which is not the case here), this call would become expensive, since we'd have to call type = bindparam.type.dialect_impl(dialect); if type.sqltemplate; , which would add a handful more method calls to all SQL statement construction.
but generally I'm almost annoyed at MySQL for being such a piece of crap in this case.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqla...@googlegroups.com
To unsubscribe from this group, send email to
sqla...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---




