File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 6
6
7
7
namespace NHibernate . Engine
8
8
{
9
- //Generates table group join if neccessary. Example of generated query wit table group join:
9
+ //Generates table group join if neccessary. Example of generated query with table group join:
10
10
// SELECT *
11
11
// FROM Person person0_
12
12
// INNER JOIN (
@@ -101,6 +101,13 @@ private static SqlString GetTableGroupJoinWithClause(SqlString[] withClauseFragm
101
101
}
102
102
}
103
103
104
+ AppendWithClause ( fromFragment , isAssociationJoin , withClauseFragments ) ;
105
+
106
+ return fromFragment . ToSqlString ( ) ;
107
+ }
108
+
109
+ private static void AppendWithClause ( SqlStringBuilder fromFragment , bool hasConditions , SqlString [ ] withClauseFragments )
110
+ {
104
111
for ( var i = 0 ; i < withClauseFragments . Length ; i ++ )
105
112
{
106
113
var withClause = withClauseFragments [ i ] ;
@@ -109,20 +116,19 @@ private static SqlString GetTableGroupJoinWithClause(SqlString[] withClauseFragm
109
116
110
117
if ( withClause . StartsWithCaseInsensitive ( " and " ) )
111
118
{
112
- if ( ! isAssociationJoin )
119
+ if ( ! hasConditions )
113
120
{
114
121
withClause = withClause . Substring ( 4 ) ;
115
122
}
116
123
}
117
- else if ( isAssociationJoin )
124
+ else if ( hasConditions )
118
125
{
119
126
fromFragment . Add ( " and " ) ;
120
127
}
121
128
122
129
fromFragment . Add ( withClause ) ;
130
+ hasConditions = true ;
123
131
}
124
-
125
- return fromFragment . ToSqlString ( ) ;
126
132
}
127
133
}
128
134
}
You can’t perform that action at this time.
0 commit comments