-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix problems with mysql. * use a prepared statement explicitly to make mysql happy when there are no query parameters * only attempt to use the prepared statement if there are no query parameters, as that's the bug in the mysql driver * simplify code 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).
- Loading branch information
Showing
2 changed files
with
93 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters