mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-05 17:37:58 +08:00
Optimizing automatic nolock does not need to be manually disabled in unionall and mergetable
This commit is contained in:
parent
bfca7a63d0
commit
c1f5db962e
@ -1578,7 +1578,18 @@ namespace SqlSugar
|
||||
var tableinfo = this.QueryBuilder.AsTables.First();
|
||||
if (this.QueryBuilder.TableWithString != SqlWith.Null && this.Context.CurrentConnectionConfig?.MoreSettings?.IsWithNoLockQuery == true && this.QueryBuilder.AsTables.First().Value.ObjToString().Contains(SqlWith.NoLock) == false)
|
||||
{
|
||||
this.QueryBuilder.AsTables[tableinfo.Key] = " (SELECT * FROM " + this.QueryBuilder.AsTables.First().Value + $" {SqlWith.NoLock} )";
|
||||
if (this.QueryBuilder.AsTables.First().Value.EndsWith(") unionTable "))
|
||||
{
|
||||
this.QueryBuilder.AsTables[tableinfo.Key] = " (SELECT * FROM " + this.QueryBuilder.AsTables.First().Value + ")";
|
||||
}
|
||||
else if (this.QueryBuilder.AsTables.First().Value.EndsWith(") MergeTable "))
|
||||
{
|
||||
this.QueryBuilder.AsTables[tableinfo.Key] = " (SELECT * FROM " + this.QueryBuilder.AsTables.First().Value + ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.QueryBuilder.AsTables[tableinfo.Key] = " (SELECT * FROM " + this.QueryBuilder.AsTables.First().Value + $" {SqlWith.NoLock} )";
|
||||
}
|
||||
}
|
||||
else if (this.QueryBuilder.IsSqlQuery && this.QueryBuilder.AsTables.First().Value.ObjToString().StartsWith("("))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user