Skip to content

Commit 32fc8be

Browse files
Make MySQL8 work with MySQL 4.1 wire protocol
It seems compatible so far, but it was defaulting to 4.0 otherwise - which mistyped integers coming from the DB. Co-authored-by: Gustavo Giráldez <ggiraldez@manas.tech>
1 parent d2192d5 commit 32fc8be

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/mysql_conn.erl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -879,12 +879,15 @@ normalize_version([$4,$.,$1|_T], _LogFun) ->
879879
?MYSQL_4_1;
880880
normalize_version([$5|_T], _LogFun) ->
881881
%% MySQL version 5.x protocol is compliant with MySQL 4.1.x:
882-
?MYSQL_4_1;
882+
?MYSQL_4_1;
883+
normalize_version([$8|_T], _LogFun) ->
884+
%% MySQL version 8.0 protocol is compliant with MySQL 4.1.x:
885+
?MYSQL_4_1;
883886
normalize_version(_Other, LogFun) ->
884887
?Log(LogFun, error, "MySQL version not supported: MySQL Erlang module "
885888
"might not work correctly."),
886-
%% Error, but trying the oldest protocol anyway:
887-
?MYSQL_4_0.
889+
%% Error, but assume newest protocol just in case:
890+
?MYSQL_4_1.
888891

889892
%%--------------------------------------------------------------------
890893
% Function: get_field_datatype(DataType)

0 commit comments

Comments
 (0)