Browse Source

Synchronization code

pull/40/head
sunkaixuan 1 year ago
parent
commit
69d63b90a8
  1. 2
      Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve_Helper.cs
  2. 6
      Src/Asp.NetCore2/SqlSugar/Realization/SqlServer/DbMaintenance/SqlServerDbMaintenance.cs

2
Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve_Helper.cs

@ -711,7 +711,7 @@ namespace SqlSugar
return this.Context.DbMehtods.AggregateDistinctCount(model); return this.Context.DbMehtods.AggregateDistinctCount(model);
case "MappingColumn": case "MappingColumn":
var mappingColumnResult = this.Context.DbMehtods.MappingColumn(model); var mappingColumnResult = this.Context.DbMehtods.MappingColumn(model);
if (model.Args.Count == 1) if (model.Args.Count == 1&& mappingColumnResult.IsNullOrEmpty())
{ {
return model.Args[0].MemberName.ObjToString().TrimStart('\'').TrimEnd('\''); return model.Args[0].MemberName.ObjToString().TrimStart('\'').TrimEnd('\'');
} }

6
Src/Asp.NetCore2/SqlSugar/Realization/SqlServer/DbMaintenance/SqlServerDbMaintenance.cs

@ -57,7 +57,7 @@ namespace SqlSugar
WHERE upper(xtype) IN('U', WHERE upper(xtype) IN('U',
'V') ) 'V') )
AND (systypes.name <> 'sysname') AND (systypes.name <> 'sysname')
AND sysobjects.name='{0}' AND sysobjects.name=N'{0}'
AND systypes.name<>'geometry' AND systypes.name<>'geometry'
AND systypes.name<>'geography' AND systypes.name<>'geography'
ORDER BY syscolumns.colid"; ORDER BY syscolumns.colid";
@ -371,7 +371,7 @@ namespace SqlSugar
} }
else else
{ {
var result= this.Context.Ado.GetInt($"select object_id('{tableName}')"); var result= this.Context.Ado.GetInt($"select object_id(N'{tableName}')");
return result > 0; return result > 0;
} }
} }
@ -386,7 +386,7 @@ namespace SqlSugar
tableName = SqlBuilder.GetNoTranslationColumnName(tableName); tableName = SqlBuilder.GetNoTranslationColumnName(tableName);
} }
var sql = @"IF EXISTS (SELECT * FROM sys.objects var sql = @"IF EXISTS (SELECT * FROM sys.objects
WHERE type='u' AND name='"+tableName.ToSqlFilter()+@"') WHERE type='u' AND name=N'"+tableName.ToSqlFilter()+@"')
SELECT 1 AS res ELSE SELECT 0 AS res;"; SELECT 1 AS res ELSE SELECT 0 AS res;";
return this.Context.Ado.GetInt(sql) > 0; return this.Context.Ado.GetInt(sql) > 0;
} }

Loading…
Cancel
Save