Mariaex is a popular MySQL driver for Elixir.
Below is a list of differences that should ease the transition between drivers.
Note, even though MyXQL may not support a given feature right now (or does it differently) it doesn't necessarily preclude changing that in the future.
Connection:
-
MyXQL supports MySQL Pluggable Authentication system and ships with
mysql_native_password,sha256_password, andcaching_sha2_passwordauthentication methods.Note: Mariaex added pluggable authentication support on master.
-
MyXQL defaults to using UNIX domain socket for connecting to the server. Forcing TCP with default options can be done by doing:
MyXQL.start_link(protocol: :tcp). Mariaex defaults to TCP. -
MyXQL does not support
:sock_typeoption and uses:protocoloption instead -
MyXQL does not support
:skip_databaseoption, setdatabase: nilinstead -
MyXQL does not support
:datetimeoption and only works with Elixir calendar types (and not Erlang-style tuples) -
MyXQL does not support
:timeoutoption which specifies default timeout for queries, pass explicit:timeoutwhen invokingMyXQL.query,MyXQL.executeetc instead -
MyXQL does not support
:encoder,:decoder,sync_connect,formatter,:parameters, and:insecure_authoptions
Queries:
-
Mariaex.query/4 function uses
query_type: niloption to try executing binary query and if that fails, fallback to using a text query. MyXQL usesquery_type: :binary_then_textfor that instead.Mariaex defaults to
query_type: nil, MyXQL defaults toquery_type: :binary. -
MyXQL represents bit type
B'101'as<<1::1, 0::0, 1::1>>(<<5::size(3)>>), Mariaex represents it as<<5>> -
MyXQL does not support
:type_names,result_types,:decode,:encode_mapper,:decode_mapper,:include_table_name, and:binary_asoptions -
Mariaex has incomplete support for executing queries with multiple statements (e.g.
SELECT 1; SELECT 2); MyXQL does not support them at all and will return an SQL error
Error struct:
-
MyXQL.Errorstruct contains:mysqlfield for MySQL errors (e.g.:%{mysql: %{code: 1062, name: :ER_DUP_ENTRY}})Mariaex.Error contains a similar field called
:mariadbwith:codeand:messagefields -
MyXQL.Errordoes not have:tag,:action, and:reasonfields