-
Notifications
You must be signed in to change notification settings - Fork 982
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not search charset in mysql_real_connect if already set
In mysql_init() charset is set to NULL . In mysql_read_connect() charset is not changed if already set This allows proxysql to change it outside the library
- Loading branch information
1 parent
ccc0887
commit 1ecb00f
Showing
3 changed files
with
36 additions
and
1 deletion.
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,33 @@ | ||
@@ -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) | ||
{ |
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