Browse Source

add compartibility with mysql versions like 5.5.33a

umatomba 10 years ago
parent
commit
7525739e3d
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/mysql_protocol.erl

+ 1 - 1
src/mysql_protocol.erl

@@ -256,7 +256,7 @@ parse_handshake(<<Protocol:8, _/binary>>) when Protocol /= 10 ->
 -spec server_version_to_list(binary()) -> [integer()].
 server_version_to_list(ServerVersion) ->
     %% Remove stuff after dash for e.g. "5.5.40-0ubuntu0.12.04.1-log"
-    [ServerVersion1 | _] = binary:split(ServerVersion, <<"-">>),
+    {match, [ServerVersion1]} = re:run(ServerVersion, "\\d+\\.\\d+\\.\\d+", [{capture,first,binary}]),
     lists:map(fun binary_to_integer/1,
               binary:split(ServerVersion1, <<".">>, [global])).