Allow using modern features when connecting to MariaDB servers #53
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
MariaDB uses a "hack" to encode its version since it bumped it to 10.x: it reports 5.5.5-(a.b.c), being 5.5.5 a version not used by the original MySQL source and a.b.c the real server version.
Since the connector only parses the first part of the version string, 5.5.5 is always incorrectly reported when connecting to MariaDB.
This patch attempts to detect this version string format and return the appropiate version tuple.
I noticed it after a fresh install of the connector from pypy. Just after calling ctx.close():
Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/mysql/connector/connection.py", line 811, in reset_session self.cmd_reset_connection() File "/usr/lib/python3.7/site-packages/mysql/connector/connection.py", line 1158, in cmd_reset_connection raise errors.NotSupportedError("MySQL version 5.7.2 and " mysql.connector.errors.NotSupportedError: MySQL version 5.7.2 and earlier does not support COM_RESET_CONNECTION.
I am not sure this is the best approach, to be honest, or whether it could have more implications that I'm unaware of.