mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-17 19:37:34 +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;
|
return UtilMethods.CountSubstringOccurrences(sql,"WHERE")>1;
|
||||||
}
|
}
|
||||||
|
private bool IsCorrectErrorSqlParameterName()
|
||||||
|
{
|
||||||
|
return this.Context?.CurrentConnectionConfig?.MoreSettings?.IsCorrectErrorSqlParameterName == true;
|
||||||
|
}
|
||||||
|
|
||||||
private void ThrowUpdateByExpression()
|
private void ThrowUpdateByExpression()
|
||||||
{
|
{
|
||||||
|
@ -860,6 +860,10 @@ namespace SqlSugar
|
|||||||
UpdateBuilder.LambdaExpressions.ParameterIndex = 100;
|
UpdateBuilder.LambdaExpressions.ParameterIndex = 100;
|
||||||
}
|
}
|
||||||
var expResult = UpdateBuilder.GetExpressionValue(columns, ResolveExpressType.WhereSingle).GetResultString().Replace(")", " )").Replace("(", "( ").Trim().TrimStart('(').TrimEnd(')').Replace("= =","=");
|
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 "))
|
if (expResult.EndsWith(" IS NULL "))
|
||||||
{
|
{
|
||||||
expResult = Regex.Split(expResult, " IS NULL ")[0]+" = NULL ";
|
expResult = Regex.Split(expResult, " IS NULL ")[0]+" = NULL ";
|
||||||
@ -869,7 +873,15 @@ namespace SqlSugar
|
|||||||
expResult = Regex.Split(expResult, "IS NULL ")[0] + " = NULL ";
|
expResult = Regex.Split(expResult, "IS NULL ")[0] + " = NULL ";
|
||||||
}
|
}
|
||||||
string key = SqlBuilder.GetNoTranslationColumnName(expResult);
|
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)))
|
if (EntityInfo.Columns.Where(it=>it.IsJson||it.IsTranscoding).Any(it => it.DbColumnName.EqualCase(key) || it.PropertyName.EqualCase(key)))
|
||||||
{
|
{
|
||||||
CheckTranscodeing();
|
CheckTranscodeing();
|
||||||
|
Loading…
Reference in New Issue
Block a user