-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for multiple result sets #108
Comments
Last year I refactored decoder part, it reads and keeps all results until it must hadoff result to user code. Reason is that ecto expects only single result, so Since ecto adapter does not use def query(pid, statement, params, opts \\ []) do
query = %Query{statement: statement}
opts =
opts
|> Keyword.put_new(:parameters, params)
|> Keyword.put(:resultset, true) # <----- THE FLAG!
case DBConnection.prepare_execute(pid, query, params, opts) do
{:ok, _query, result} -> {:ok, result}
{:error, err} -> {:error, err}
end
end Then it could pack among all results additional info, like messages server returned (info, error ...), num_results, and result set count. It is worth mentioning that results are in reverse order so they need to be |
One more note, since unit tests also expect single Tds.Result, all must be refactored to pass with this change |
Perhaps the best option is to introduce a separate function, such as |
@josevalim, @ekstrom , I think this is going to work for any multi batch script for MSSQL Server. It even follows inserts without output. We were lucky I refactored decoder last winter so this was easy to expose |
@ekstrom BTW, please point your fork to tds master and run test, but there shouldn't be anything broken |
Tested it and it works as expected. Thanks for the good work 😄 |
Released in v2.1.1. Thank you! |
It would be useful to have support for multiple result sets.
Example code:
Expected result:
Actual result:
The text was updated successfully, but these errors were encountered: