- 修复 RawJoin 可能生成错误的 SQL;

This commit is contained in:
2881099 2023-09-25 18:50:58 +08:00
parent d40036dce8
commit aa56b2bf2f

View File

@ -672,9 +672,12 @@ namespace FreeSql.Internal.CommonProvider
_join.Append(" \r\n").Append(sql); _join.Append(" \r\n").Append(sql);
//fsql.Select<User1, UserGroup>().RawJoin("FULL JOIN UserGroup b ON b.id = a.GroupId").ToSql((a, b) => new { user = a, group = b }); //fsql.Select<User1, UserGroup>().RawJoin("FULL JOIN UserGroup b ON b.id = a.GroupId").ToSql((a, b) => new { user = a, group = b });
foreach (var tb in _tables) for (var a = 1; a < _tables.Count; a++)
{
var tb = _tables[a];
if (sql.Contains($" {tb.Table.DbName} ") || sql.Contains($" {_commonUtils.QuoteSqlName(tb.Table.DbName)} ")) if (sql.Contains($" {tb.Table.DbName} ") || sql.Contains($" {_commonUtils.QuoteSqlName(tb.Table.DbName)} "))
tb.Type = SelectTableInfoType.RawJoin; tb.Type = SelectTableInfoType.RawJoin;
}
return this as TSelect; return this as TSelect;
} }