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
I found that if subquery for select parameters for In clause returns empty set, Simple.Data throws ArgumentOutOfRangeException with message "startIndex cannot be larger than length of string.
Parameter name: startIndex" and stack trace " at System.String.Substring(Int32 startIndex, Int32 length)
at Simple.Data.Ado.CommandBuilder.d__10.MoveNext()
at Simple.Data.Ado.CommandBuilder.SetParameters(IDbParameterFactory parameterFactory, IDbCommand command, IEnumerable1 parameters) at Simple.Data.Ado.CommandBuilder.CreateCommand(IDbParameterFactory parameterFactory, ICommandBuilder[] commandBuilders, IDbConnection connection, AdoOptions options) at Simple.Data.Ado.AdoAdapterQueryRunner.RunQuery(SimpleQuery query, IEnumerable1& unhandledClauses)
at Simple.Data.Ado.AdoAdapter.RunQuery(SimpleQuery query, IEnumerable1& unhandledClauses) at Simple.Data.DatabaseRunner.RunQuery(SimpleQuery query, IEnumerable1& unhandledClauses)
at Simple.Data.SimpleQuery.Run()
at Simple.Data.SimpleQuery.CastT
at Simple.Data.SimpleQuery.ToListT
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet ](CallSite site, T0 arg0)
at ....".
Is it correct implementations of the In clause?
For example, there are two tables tblA(a_id, a_name) and tblB(b_id, b_name, b_a_id) where b_a_id is FK to the tblA(a_id field) and I want to select all a_name values for tblB objects which have b_name containig "a" sign.
The sql query is "SELECT a_name FROM tblA WHERE a_id IN(SELECT b_a_id FROM tblB WHERE b_name LIKE '%a%')".
Using Simple.Data, query is DB.tblA.FindAll(DB.tblA.a_id == DB.tblB.FindAll(DB.tblB.b_name.Like("%a%").ToScalarList()).ToScalarList().
If I execute "native" query, sql server returns empty query result, if I execute simple.data query, Simple.Data throws exception instead of returning empty list.
Ie problem is the query result inside "in" clause. If result of the query inside "In" clause is empty set, Simple.Data query throws exception at runtime. This exception is thrown even if I pass empty array to "In" clause to Simple.Data query:
DB.tblA.FindAll(DB.tblA.a_id == new int[]{}).ToScalarList()
The text was updated successfully, but these errors were encountered:
I found that if subquery for select parameters for In clause returns empty set, Simple.Data throws ArgumentOutOfRangeException with message "startIndex cannot be larger than length of string.
Parameter name: startIndex" and stack trace " at System.String.Substring(Int32 startIndex, Int32 length)
at Simple.Data.Ado.CommandBuilder.d__10.MoveNext()
at Simple.Data.Ado.CommandBuilder.SetParameters(IDbParameterFactory parameterFactory, IDbCommand command, IEnumerable
1 parameters) at Simple.Data.Ado.CommandBuilder.CreateCommand(IDbParameterFactory parameterFactory, ICommandBuilder[] commandBuilders, IDbConnection connection, AdoOptions options) at Simple.Data.Ado.AdoAdapterQueryRunner.RunQuery(SimpleQuery query, IEnumerable
1& unhandledClauses)at Simple.Data.Ado.AdoAdapter.RunQuery(SimpleQuery query, IEnumerable
1& unhandledClauses) at Simple.Data.DatabaseRunner.RunQuery(SimpleQuery query, IEnumerable
1& unhandledClauses)at Simple.Data.SimpleQuery.Run()
at Simple.Data.SimpleQuery.CastT
at Simple.Data.SimpleQuery.ToListT
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet ](CallSite site, T0 arg0)
at ....".
Is it correct implementations of the In clause?
For example, there are two tables tblA(a_id, a_name) and tblB(b_id, b_name, b_a_id) where b_a_id is FK to the tblA(a_id field) and I want to select all a_name values for tblB objects which have b_name containig "a" sign.
The sql query is "SELECT a_name FROM tblA WHERE a_id IN(SELECT b_a_id FROM tblB WHERE b_name LIKE '%a%')".
Using Simple.Data, query is DB.tblA.FindAll(DB.tblA.a_id == DB.tblB.FindAll(DB.tblB.b_name.Like("%a%").ToScalarList()).ToScalarList().
If I execute "native" query, sql server returns empty query result, if I execute simple.data query, Simple.Data throws exception instead of returning empty list.
Ie problem is the query result inside "in" clause. If result of the query inside "In" clause is empty set, Simple.Data query throws exception at runtime. This exception is thrown even if I pass empty array to "In" clause to Simple.Data query:
DB.tblA.FindAll(DB.tblA.a_id == new int[]{}).ToScalarList()
The text was updated successfully, but these errors were encountered: