Skip to content

Simplify SqlGenerator.FromFragmentSeparator #3116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 4 additions & 25 deletions src/NHibernate/Hql/Ast/ANTLR/SqlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@ protected virtual void FromFragmentSeparator(IASTNode a)
return;
}

var left = (FromElement)a;
var right = (FromElement)next;
var right = (FromElement) next;

///////////////////////////////////////////////////////////////////////
// HACK ALERT !!!!!!!!!!!!!!!!!!!!!!!!!!!!
Expand All @@ -210,34 +209,14 @@ protected virtual void FromFragmentSeparator(IASTNode a)
{
return;
}
if (right.Type == ENTITY_JOIN)

if (right.JoinSequence?.IsThetaStyle == false && right.JoinSequence.JoinCount != 0)
{
Out(" ");
}
else if (right.RealOrigin == left || (right.RealOrigin != null && right.RealOrigin == left.RealOrigin))
{
// right represents a joins originating from left; or
// both right and left reprersent joins originating from the same FromElement
if (right.JoinSequence != null && right.JoinSequence.IsThetaStyle)
{
Out(", ");
}
else
{
Out(" ");
}
}
else
{
if (right.JoinSequence?.IsThetaStyle == false && right.JoinSequence.JoinCount != 0)
{
Out(" ");
}
else
{
// these are just two unrelated table references
Out(", ");
}
Out(", ");
}
}

Expand Down