mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-05 17:37:58 +08:00
Update IsCorrectErrorSqlParameterName
This commit is contained in:
parent
08653ed84d
commit
020d2d1c32
@ -881,6 +881,10 @@ namespace SqlSugar
|
||||
{
|
||||
return UtilMethods.CountSubstringOccurrences(sql,"WHERE")>1;
|
||||
}
|
||||
private bool IsCorrectErrorSqlParameterName()
|
||||
{
|
||||
return this.Context?.CurrentConnectionConfig?.MoreSettings?.IsCorrectErrorSqlParameterName == true;
|
||||
}
|
||||
|
||||
private void ThrowUpdateByExpression()
|
||||
{
|
||||
|
@ -860,6 +860,10 @@ namespace SqlSugar
|
||||
UpdateBuilder.LambdaExpressions.ParameterIndex = 100;
|
||||
}
|
||||
var expResult = UpdateBuilder.GetExpressionValue(columns, ResolveExpressType.WhereSingle).GetResultString().Replace(")", " )").Replace("(", "( ").Trim().TrimStart('(').TrimEnd(')').Replace("= =","=");
|
||||
if (IsCorrectErrorSqlParameterName())
|
||||
{
|
||||
expResult = UpdateBuilder.GetExpressionValue(columns, ResolveExpressType.WhereSingle).GetResultString().Trim().TrimStart('(').TrimEnd(')').Replace("= =", "=");
|
||||
}
|
||||
if (expResult.EndsWith(" IS NULL "))
|
||||
{
|
||||
expResult = Regex.Split(expResult, " IS NULL ")[0]+" = NULL ";
|
||||
@ -869,7 +873,15 @@ namespace SqlSugar
|
||||
expResult = Regex.Split(expResult, "IS NULL ")[0] + " = NULL ";
|
||||
}
|
||||
string key = SqlBuilder.GetNoTranslationColumnName(expResult);
|
||||
|
||||
if (IsCorrectErrorSqlParameterName()&& binaryExp.Left is MemberExpression member)
|
||||
{
|
||||
key =this.EntityInfo.Columns.First(it=>it.PropertyName== member.Member.Name).DbColumnName;
|
||||
if (expResult.Contains($" {key} "))
|
||||
{
|
||||
expResult = expResult.Replace($" {key} ", $" {SqlBuilder.GetTranslationColumnName(key)} ");
|
||||
|
||||
}
|
||||
}
|
||||
if (EntityInfo.Columns.Where(it=>it.IsJson||it.IsTranscoding).Any(it => it.DbColumnName.EqualCase(key) || it.PropertyName.EqualCase(key)))
|
||||
{
|
||||
CheckTranscodeing();
|
||||
|
Loading…
Reference in New Issue
Block a user