Skip to content

Instantly share code, notes, and snippets.

@tjheeta
Created May 31, 2015 23:50
Show Gist options
  • Save tjheeta/800deab2b9e7b2b9651b to your computer and use it in GitHub Desktop.
Save tjheeta/800deab2b9e7b2b9651b to your computer and use it in GitHub Desktop.
Convert mariaex to mysqlex for ecto
diff --git a/lib/ecto/adapters/mysql.ex b/lib/ecto/adapters/mysql.ex
index 964aaf2..53d2a07 100644
--- a/lib/ecto/adapters/mysql.ex
+++ b/lib/ecto/adapters/mysql.ex
@@ -3,7 +3,7 @@ defmodule Ecto.Adapters.MySQL do
Adapter module for MySQL.
It handles and pools the connections to the MySQL
- database using `mariaex` with `poolboy`.
+ database using `mysqlex` with `poolboy`.
## Options
@@ -85,7 +85,7 @@ defmodule Ecto.Adapters.MySQL do
"""
# Inherit all behaviour from Ecto.Adapters.SQL
- use Ecto.Adapters.SQL, :mariaex
+ use Ecto.Adapters.SQL, :mysqlex
# And provide a custom storage implementation
@behaviour Ecto.Adapter.Storage
diff --git a/lib/ecto/adapters/mysql/connection.ex b/lib/ecto/adapters/mysql/connection.ex
index 17bc2ce..2dfc16b 100644
--- a/lib/ecto/adapters/mysql/connection.ex
+++ b/lib/ecto/adapters/mysql/connection.ex
@@ -1,4 +1,4 @@
-if Code.ensure_loaded?(Mariaex.Connection) do
+if Code.ensure_loaded?(Mysqlex.Connection) do
defmodule Ecto.Adapters.MySQL.Connection do
@moduledoc false
@@ -11,12 +11,12 @@ if Code.ensure_loaded?(Mariaex.Connection) do
def connect(opts) do
opts = Keyword.update(opts, :port, @default_port, &normalize_port/1)
- Mariaex.Connection.start_link(opts)
+ Mysqlex.Connection.start_link(opts)
end
def disconnect(conn) do
try do
- Mariaex.Connection.stop(conn)
+ Mysqlex.Connection.stop(conn)
catch
:exit, {:noproc, _} -> :ok
end
@@ -29,9 +29,9 @@ if Code.ensure_loaded?(Mariaex.Connection) do
value -> value
end
- case Mariaex.Connection.query(conn, sql, params, opts) do
- {:ok, %Mariaex.Result{} = result} -> {:ok, Map.from_struct(result)}
- {:error, %Mariaex.Error{}} = err -> err
+ case Mysqlex.Connection.query(conn, sql, params, opts) do
+ {:ok, %Mysqlex.Result{} = result} -> {:ok, Map.from_struct(result)}
+ {:error, %Mysqlex.Error{}} = err -> err
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment