You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SELECT m0.[id], m0.[is_enabled] FROM [Model] as m0 WHERE m0.[id] IN (@1, @2, @3) AND m0.[is_enabled] = @2
...and executed with parameters [1, 23, 43, true] which assigns wrong parameter value to last boolean expression.
Expected behavior
Expecting query to be prepared as
SELECT m0.[id], m0.[is_enabled] FROM [Model] as m0 WHERE m0.[id] IN (@1, @2, @3) AND m0.[is_enabled] = @4
...and executed with parameters [1, 23, 43, true]
NOTE
I'm working on tds_ecto repository for some time now. So far it is in good shape but issues like this is not possible to solve there. Expression index is not possible to track since when I try to build expression for both boolean expressions Index in second is always equal to 2. I've used length indefp expr({:in...}, sources, query) do... function to build "in" parameter names, since parameter lists are flatten anyways into single list when they are passed to adapter query function. Unfortunately MSSQL do not support array type so this cannot be solved as for postgresql with array parameter. The only way it can work is as I mentioned in "expected" section above. BTW, same issue is in MSSQL ODBC adapter, issue is reported here
The text was updated successfully, but these errors were encountered:
mjaric
changed the title
tds_ecto is unable to build parameter names correctly when used where columns in ^params
tds_ecto is unable to build align parameter names correctly when used WHERE ? IN (?) AND ? = ?
Sep 29, 2017
Environment
Current behavior
When building query with ecto, eg:
Query is built as
...and executed with parameters [1, 23, 43, true] which assigns wrong parameter value to last boolean expression.
Expected behavior
Expecting query to be prepared as
...and executed with parameters [1, 23, 43, true]
NOTE
I'm working on tds_ecto repository for some time now. So far it is in good shape but issues like this is not possible to solve there. Expression index is not possible to track since when I try to build expression for both boolean expressions Index in second is always equal to 2. I've used length indefp expr({:in...}, sources, query) do... function to build "in" parameter names, since parameter lists are flatten anyways into single list when they are passed to adapter query function. Unfortunately MSSQL do not support array type so this cannot be solved as for postgresql with array parameter. The only way it can work is as I mentioned in "expected" section above. BTW, same issue is in MSSQL ODBC adapter, issue is reported here
The text was updated successfully, but these errors were encountered: