Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using library with MySQL 8.0; issues with MySQL platform #190

Open
zimmermanj42 opened this issue Jan 13, 2018 · 3 comments
Open

Using library with MySQL 8.0; issues with MySQL platform #190

zimmermanj42 opened this issue Jan 13, 2018 · 3 comments

Comments

@zimmermanj42
Copy link

First, I understand that MySQL 8.0 is still in development. I am working on a project that will most likely be done after this is out, so am using it in my development.

Initial testing and development work seems to show that things with this library seem to work fine with MySQL 8.0, except for the \CrEOF\Spatial\DBAL\Platform\MySql class.

Starting with MySQL 5.6, the "GeomFromText" and "AsBinary" functions were deprecated, and it is suggested that "ST_GeomFromText" and "ST_AsBinary" be used instead. With MySQL 8.0, these older functions have been removed and so their "ST_" counterparts must be used.

I assume that the library needs to keep MySQL 5.5 support. I think that MySQL 5.5 EOL was in 2015, but extended EOL goes until the end of 2018. If not, then we should be able to just use the "ST_" counterparts as they are available in 5.6 and above.

It's also possible to maybe detect that a later version of MySQL is being used and we can load a fine-tuned Platform class that has these methods fixed. In the \CrEOF\Spatial\DBAL\Types\AbstractSpatialType::getSpatialPlatform method, the DBAL platform datatype that is passed through does have a specific class for when a PHP 5.7+ database is used.

Some logic could be added to this method to detect this, and if so, load an extended MySQL platform from this library that has the necessary spatial functions. The only issue is that we'd have to check whether or not the passed in AbstractPlatform in that function is of a specific type as I don't think we can detect a specific MySQL version just from that. This may not be an ideal way to implement such a check.

If there is any kind of interest in this, I can submit a PR for review.

@kiler129
Copy link

@zimmermanj42 Did you actually modified the lib to work with 8.0 maybe? ;)

@holtkamp
Copy link

@zimmermanj42 refers to:

return sprintf('AsBinary(%s)', $sqlExpr);

and

return sprintf('GeomFromText(%s)', $sqlExpr);

Which need to be prefixed with ST_ to work on MySQL 8.0

@gerMdz
Copy link

gerMdz commented Jan 27, 2023

I made the change in the vendor, which is a very bad idea. It is implied in the documentation that we can make the function change from our code, but I can't figure out how to do it.
Do you have an example to implement?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants