Update to DBConnection 2.0 - #235
Conversation
| assert capture_log(fn -> | ||
| {:ok, pid} = Mariaex.start_link([username: "non_existing", database: "mariaex_test"] ++ opts) | ||
| assert_receive {:EXIT, ^pid, :killed}, 5000 | ||
| end) =~ "** (Mariaex.Error) (1045): Access denied for user 'non_existing'@'localhost'" |
There was a problem hiding this comment.
We should check up to and including the @ I guess. Unsure what happens on other languages though. Ideally we would have similar style to postgrex where every error code has a matching atom.
| assert query("SELECT 42", []) == [[42]] | ||
| end | ||
|
|
||
| test "can not begin, commit or rollback savepoint transaction if not begun", context do |
There was a problem hiding this comment.
we should mention savepoint in this name as its confusing to say can not begin if mnot not begun without that context.
There was a problem hiding this comment.
Wait, we do mention savepoint. Or should we not mention it? Btw, you wrote this. :)
There was a problem hiding this comment.
You're right, this test is wonderful ;)
| {:ok, {result, nil}, clean_state(s, flags)} | ||
| end | ||
|
|
||
| defp clean_state(state, flags) do |
There was a problem hiding this comment.
We need to test that we always call this function after a query finishes.
Need some time to think about that this TODO means. Likely on the first |
|
This looks good to merge if we open issues for the TODO items so we can unblock ecto dev. |
| """ | ||
| @spec execute(conn, Mariaex.Query.t, list, Keyword.t) :: | ||
| {:ok, Mariaex.Result.t} | {:error, Mariaex.Error.t} | ||
| {:ok, Mariaex.Query.t, Mariaex.Result.t} | {:error, Mariaex.Error.t} |
There was a problem hiding this comment.
I think this can now return other exceptions in the error case?
| error | ||
| {:error, err} -> | ||
| raise err | ||
| err |
There was a problem hiding this comment.
I dont think this right, don't we want to return the error tuple?
| error | ||
| {:error, err} -> | ||
| raise err | ||
| err |
fishcakez
left a comment
There was a problem hiding this comment.
Seems I reviewed only one commit before and you fixed all the comments in later ones. If we have Exception.t as return make sure docs have that everywhere, I left comment in one place.
|
|
||
| @doc """ | ||
| Prepares and executes a query and returns the result as | ||
| `{:ok, %Mariaex.Query{}, %Mariaex.Result{}}` or `{:error, %Mariaex.Error{}}` |
There was a problem hiding this comment.
It can be any exception?
|
Thank you ❤️ |
Includes #196 and #234. Note DBConnection 2.0 has not been released yet. There is also some work pending:
/cc @wojtekmach @fishcakez