-
Notifications
You must be signed in to change notification settings - Fork 977
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3249 from sysown/v2.0.16-collation
Do not search charset in mysql_real_connect if already set
- Loading branch information
Showing
11 changed files
with
309 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@@ -583,7 +583,7 @@ const MARIADB_CHARSET_INFO mariadb_compi | ||
{ 95, 1, "cp932", "cp932_japanese_ci", "", 932, "CP932", 1, 2, mysql_mbcharlen_cp932, check_mb_cp932}, | ||
{ 97, 1, "eucjpms", "eucjpms_japanese_ci", "", 932, "EUC-JP-MS", 1, 3, mysql_mbcharlen_eucjpms, check_mb_eucjpms}, | ||
{ 2, 1, "latin2", "latin2_czech_cs", "", 852, "LATIN2", 1, 1, NULL, NULL}, | ||
- { 5, 1, "latin1", "latin1_german_ci", "", 1252, "LATIN1", 1, 1, NULL, NULL}, | ||
+ { 5, 1, "latin1", "latin1_german1_ci", "", 1252, "LATIN1", 1, 1, NULL, NULL}, | ||
{ 14, 1, "cp1251", "cp1251_bulgarian_ci", "", 1251, "CP1251", 1, 1, NULL, NULL}, | ||
{ 15, 1, "latin1", "latin1_danish_ci", "", 1252, "LATIN1", 1, 1, NULL, NULL}, | ||
{ 17, 1, "filename", "filename", "", 0, "", 1, 5, NULL, NULL}, |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
@@ -1017,7 +1017,10 @@ mysql_init(MYSQL *mysql) | ||
goto error; | ||
mysql->options.report_data_truncation= 1; | ||
mysql->options.connect_timeout=CONNECT_TIMEOUT; | ||
- mysql->charset= mysql_find_charset_name(MARIADB_DEFAULT_CHARSET); | ||
+ // in proxysql we set mysql->charset to NULL during mysql_init() | ||
+ // proxysql will explicitly set it a value if needed | ||
+ mysql->charset = NULL; | ||
+ //mysql->charset= mysql_find_charset_name(MARIADB_DEFAULT_CHARSET); | ||
mysql->methods= &MARIADB_DEFAULT_METHODS; | ||
strcpy(mysql->net.sqlstate, "00000"); | ||
mysql->net.last_error[0]= mysql->net.last_errno= 0; | ||
@@ -1497,11 +1500,15 @@ MYSQL *mthd_my_real_connect(MYSQL *mysql | ||
} | ||
} | ||
|
||
- /* Set character set */ | ||
- if (mysql->options.charset_name) | ||
- mysql->charset= mysql_find_charset_name(mysql->options.charset_name); | ||
- else | ||
- mysql->charset=mysql_find_charset_name(MARIADB_DEFAULT_CHARSET); | ||
+ if (!mysql->charset) { // in proxysql we do not set charset during mysql_init | ||
+ /* Set character set */ | ||
+ if (mysql->options.charset_name) | ||
+ mysql->charset= mysql_find_charset_name(mysql->options.charset_name); | ||
+ else | ||
+ mysql->charset=mysql_find_charset_name(MARIADB_DEFAULT_CHARSET); | ||
+ } else { | ||
+ // proxysql has explicitly set charset | ||
+ } | ||
|
||
if (!mysql->charset) | ||
{ | ||
@@ -1759,10 +1766,16 @@ my_bool STDCALL mysql_change_user(MYSQL | ||
*s_db= mysql->db; | ||
int rc; | ||
|
||
- if (mysql->options.charset_name) | ||
- mysql->charset= mysql_find_charset_name(mysql->options.charset_name); | ||
- else | ||
- mysql->charset=mysql_find_charset_name(MARIADB_DEFAULT_CHARSET); | ||
+ // in proxysql we set charset directly, | ||
+ // therefore this code should never be called in proxysql. | ||
+ // we keep the code because compatibility (for example, an app using mysql_change_user) | ||
+ // we also change mysql_optionsv() for MYSQL_SET_CHARSET_NAME | ||
+ if (!mysql->charset) { | ||
+ if (mysql->options.charset_name) | ||
+ mysql->charset= mysql_find_charset_name(mysql->options.charset_name); | ||
+ else | ||
+ mysql->charset=mysql_find_charset_name(MARIADB_DEFAULT_CHARSET); | ||
+ } | ||
|
||
mysql->user= strdup(user ? user : ""); | ||
mysql->passwd= strdup(passwd ? passwd : ""); | ||
@@ -2767,6 +2780,12 @@ mysql_optionsv(MYSQL *mysql,enum mysql_o | ||
OPT_SET_VALUE_STR(&mysql->options, charset_dir, arg1); | ||
break; | ||
case MYSQL_SET_CHARSET_NAME: | ||
+ { | ||
+ // this is for applications other than proxysql. | ||
+ // This because proxysql doesn't use mysql_options() with MYSQL_SET_CHARSET_NAME , | ||
+ // but instead set mysql->charset directly | ||
+ mysql->charset = NULL; | ||
+ } | ||
OPT_SET_VALUE_STR(&mysql->options, charset_name, arg1); | ||
break; | ||
case MYSQL_OPT_RECONNECT: |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
#ifndef COMMAND_LINE_H | ||
#define COMMAND_LINE_H | ||
|
||
#include <string> | ||
|
||
class CommandLine { | ||
public: | ||
CommandLine(); | ||
|
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
Oops, something went wrong.