mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-23 04:23:47 +08:00
Update diff log
This commit is contained in:
@@ -117,15 +117,25 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
UpdateBuilder.Parameters = UpdateBuilder.Parameters.Where(it => UtilMethods.NoErrorParameter(it.ParameterName)).ToList();
|
UpdateBuilder.Parameters = UpdateBuilder.Parameters.Where(it => UtilMethods.NoErrorParameter(it.ParameterName)).ToList();
|
||||||
}
|
}
|
||||||
|
List<SugarParameter> oldParas = null;
|
||||||
|
if (IsEnableDiffLogEvent)
|
||||||
|
{
|
||||||
|
oldParas=UtilMethods.CopySugarParameters(UpdateBuilder.Parameters);
|
||||||
|
}
|
||||||
if (sql != Environment.NewLine)
|
if (sql != Environment.NewLine)
|
||||||
{
|
{
|
||||||
result = this.Ado.ExecuteCommand(sql, UpdateBuilder.Parameters == null ? null : UpdateBuilder.Parameters.ToArray());
|
result = this.Ado.ExecuteCommand(sql, UpdateBuilder.Parameters == null ? null : UpdateBuilder.Parameters.ToArray());
|
||||||
}
|
}
|
||||||
|
if (oldParas != null&& UpdateBuilder.Parameters!=null)
|
||||||
|
{
|
||||||
|
if (string.Join(",", oldParas.Select(it => it.ParameterName)) != string.Join(",", UpdateBuilder.Parameters.Select(it => it.ParameterName)))
|
||||||
|
{
|
||||||
|
UpdateBuilder.Parameters = oldParas;
|
||||||
|
}
|
||||||
|
}
|
||||||
After(sql);
|
After(sql);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public bool ExecuteCommandHasChange()
|
public bool ExecuteCommandHasChange()
|
||||||
{
|
{
|
||||||
return this.ExecuteCommand() > 0;
|
return this.ExecuteCommand() > 0;
|
||||||
|
@@ -18,6 +18,37 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public class UtilMethods
|
public class UtilMethods
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public static List<SugarParameter> CopySugarParameters(List<SugarParameter> pars)
|
||||||
|
{
|
||||||
|
if(pars==null) return null;
|
||||||
|
var newParameters = pars.Select(it => new SugarParameter(it.ParameterName, it.Value)
|
||||||
|
{
|
||||||
|
TypeName = it.TypeName,
|
||||||
|
Value = it.Value,
|
||||||
|
IsRefCursor = it.IsRefCursor,
|
||||||
|
IsArray = it.IsArray,
|
||||||
|
IsJson = it.IsJson,
|
||||||
|
ParameterName = it.ParameterName,
|
||||||
|
IsNvarchar2 = it.IsNvarchar2,
|
||||||
|
IsNClob = it.IsClob,
|
||||||
|
IsClob = it.IsClob,
|
||||||
|
UdtTypeName = it.UdtTypeName,
|
||||||
|
CustomDbType = it.CustomDbType,
|
||||||
|
DbType = it.DbType,
|
||||||
|
Direction = it.Direction,
|
||||||
|
Precision = it.Precision,
|
||||||
|
Size = it.Size,
|
||||||
|
Scale = it.Scale,
|
||||||
|
IsNullable = it.IsNullable,
|
||||||
|
SourceColumn = it.SourceColumn,
|
||||||
|
SourceColumnNullMapping = it.SourceColumnNullMapping,
|
||||||
|
SourceVersion = it.SourceVersion,
|
||||||
|
TempDate = it.TempDate,
|
||||||
|
_Size = it._Size
|
||||||
|
});
|
||||||
|
return newParameters.ToList();
|
||||||
|
}
|
||||||
public static bool IsTuple(Type tType, List<PropertyInfo> classProperties)
|
public static bool IsTuple(Type tType, List<PropertyInfo> classProperties)
|
||||||
{
|
{
|
||||||
if (classProperties?.Any() != true)
|
if (classProperties?.Any() != true)
|
||||||
|
Reference in New Issue
Block a user