Skip to content

Fix mysql for real - #49

Merged
jonbodner merged 5 commits into
masterfrom
fix_mysql
Sep 4, 2020
Merged

jonbodner merged 5 commits into
masterfrom
fix_mysql

Conversation

@jonbodner

Copy link
Copy Markdown
Owner

The problem with MySQL's Go driver (https://github.com/go-sql-driver/mysql) is that it won't translate numbers in the response when the text protocol is used (which happens when a query is run without any parameters). Multiple issues have been filed against this for years, but the developers have responded with a wontfix due to the dubious claim that it's too much of a performance hit. See go-sql-driver/mysql#861 for an example.

This update checks to see if a query has no query args. If it does, it checks to see if the Querier/ContextQuerier also implements Prepare/PrepareContext and if so, it creates a statement, forcing MySQL to use the binary protocol. (Postgres will also be using a prepared statement unnecessarily, but it probably has minimal performance difference).

@jonbodner
jonbodner merged commit fbbe783 into master Sep 4, 2020
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

Successfully merging this pull request may close these issues.

1 participant