mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-08 18:34:55 +08:00
Update exp to sql
This commit is contained in:
@@ -304,10 +304,22 @@ namespace SqlSugar
|
||||
{
|
||||
this.context.CurrentShortName=ExpressionTool.GetParameters(allMethods.FirstOrDefault()).FirstOrDefault().Name;
|
||||
}
|
||||
var hasNolock = false;
|
||||
List<string> result = isubList.Select(it =>
|
||||
{
|
||||
it.HasWhere = isHasWhere;
|
||||
return it.GetValue(it.Expression);
|
||||
if (it is SubWithNolock)
|
||||
{
|
||||
hasNolock = true;
|
||||
}
|
||||
var result = it.GetValue(it.Expression);
|
||||
var isJoin = (it is SubLeftJoin || it is SubInnerJoin);
|
||||
var isSqlServer =UtilMethods.GetDatabaseType(this.context) == DbType.SqlServer;
|
||||
if (hasNolock && isJoin&& isSqlServer)
|
||||
{
|
||||
result = result.Replace("] ON (", "] " + SqlWith.NoLock + " ON (");
|
||||
}
|
||||
return result;
|
||||
}).ToList();
|
||||
if (this.context?.SugarContext?.Context?.CurrentConnectionConfig?.DbType == DbType.Oracle && isubList.Any(s => s is SubSelect) && isubList.Any(s => s is SubOrderBy || s is SubOrderByDesc))
|
||||
{
|
||||
@@ -319,6 +331,7 @@ namespace SqlSugar
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private static void SetOrderByIndex(List<ISubOperation> isubList)
|
||||
{
|
||||
var orderByIndex = 0;
|
||||
|
||||
@@ -19,6 +19,10 @@ namespace SqlSugar
|
||||
public class UtilMethods
|
||||
{
|
||||
|
||||
internal static DbType? GetDatabaseType(ExpressionContext context)
|
||||
{
|
||||
return context?.SugarContext?.Context?.CurrentConnectionConfig?.DbType;
|
||||
}
|
||||
internal static void SetDefaultValueForBoolean(EntityColumnInfo item, Type propertyType)
|
||||
{
|
||||
if (propertyType == UtilConstants.BoolType && item.DefaultValue != null && item.DefaultValue.EqualCase("true"))
|
||||
|
||||
Reference in New Issue
Block a user