Open haxney opened 13 years ago
Thanks, I'm pretty sure how to fix it, but I'm trying to get the tests updated first, and having trouble with the dependencies, not having worked on this for a while.
The problem seems to lie here: https://github.com/fragility/spatial_adapter/blob/master/lib/spatial_adapter/mysql2.rb#L20
Yup, it seems like the srid isn't being set for the objects, event though it should be defaulting to DEFAULT_SRID. I don't know why it would be set to nil, it might be something within the way fixtures create instances.
I have a fixture defined like so:
But trying to use it in a test suite results in the following error:
The key part of the problem is:
Where there is an extra comma inside the
GeomFromWKB
function call. Looking through the source, atlib/spatial_adapter/mysql2.rb:20
it looks like ifvalue.srid
is nil, then it would cause the erroneous SQL statement to be returned. I'm not sure how or why thesrid
isn't being set toDEFAULT_SRID
when the object is being created, but if I manually set it in the YAML like so:Then it works fine. Also, it doesn't need to be set in the child objects, since the GeoRuby
srid=
method takes care of propagatingsrid
changes down through the tree.This isn't the end of the world because of the simple workaround, but it does seem to go against the expected behavior.