Skip to content
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

.Contains("") operation Exception #49

Closed
jostin957 opened this issue Oct 19, 2016 · 4 comments
Closed

.Contains("") operation Exception #49

jostin957 opened this issue Oct 19, 2016 · 4 comments

Comments

@jostin957
Copy link

I have an error when I use in my query Where(Name.Contains("value")) but only when I use MySql, with SqlServer works fine.

Error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '+ '%'' at line 3

I think the problem is how the sql query is sent to the database:
select * from entity where Name like '%' + 'value' + '%'

The same happens with the StartsWith() and the EndsWith() operations.

Is this a problem with the database provider?

Versions:
MySql: "MySql.Data.EntityFrameworkCore": "7.0.5-IR21"
"MySql.Data": "7.0.5-IR21"
"System.Linq.Dynamic.Core": "1.0.6.5"
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0"

The stacktrace:
at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)
at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, String executeMethod, IReadOnlyDictionary2 parameterValues, Boolean openConnection, Boolean closeConnection) at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteReader(IRelationalConnection connection, IReadOnlyDictionary2 parameterValues, Boolean manageConnection)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable.Enumerator.MoveNext()
at Microsoft.EntityFrameworkCore.Query.QueryMethodProvider.<_ShapedQuery>d__31.MoveNext() at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.<_TrackEntities>d__152.MoveNext()
at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor1.EnumeratorExceptionInterceptor.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
at System.Linq.Dynamic.Core.DynamicEnumerableExtensions.ToDynamicList(IEnumerable source)
at DatesAndRates.Host.Controllers.ProviderController.Filtros(jqGridViewModel jqGridParameters)
at lambda_method(Closure , Object , Object[] )
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__28.MoveNext()

@jostin957 jostin957 changed the title MySql .Contains Exception .Contains("") operation Exception Oct 19, 2016
@jogibear9988
Copy link
Contributor

i think it's a mysql ef core problem?

@StefH
Copy link
Collaborator

StefH commented Nov 16, 2016

@jogibear9988 Seems so, can we log an issue somewhere on this?

@jogibear9988
Copy link
Contributor

i think so. if it works with sqlserver and linq2objects, i don't think it's a dynamic linq error

@StefH
Copy link
Collaborator

StefH commented Apr 9, 2017

Closing...

@StefH StefH closed this as completed Apr 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants