forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCollectionJoinWalker.cs
48 lines (42 loc) · 1.23 KB
/
CollectionJoinWalker.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System.Collections.Generic;
using NHibernate.Engine;
using NHibernate.SqlCommand;
using NHibernate.Util;
namespace NHibernate.Loader.Collection
{
/// <summary>
/// Superclass of walkers for collection initializers
/// <seealso cref="CollectionLoader" />
/// <seealso cref="OneToManyJoinWalker" />
/// <seealso cref="BasicCollectionJoinWalker" />
/// </summary>
public abstract class CollectionJoinWalker : JoinWalker
{
public CollectionJoinWalker(ISessionFactoryImplementor factory, IDictionary<string, IFilter> enabledFilters)
: base(factory, enabledFilters)
{
}
protected SqlStringBuilder WhereString(string alias, string[] columnNames, SqlString subselect,
int batchSize)
{
if (subselect == null)
{
return WhereString(alias, columnNames, batchSize);
}
else
{
SqlStringBuilder buf = new SqlStringBuilder();
if (columnNames.Length > 1)
buf.Add("(");
buf.Add(StringHelper.Join(StringHelper.CommaSpace, StringHelper.Qualify(alias, columnNames)));
if (columnNames.Length > 1)
buf.Add(")");
buf.Add(" in ")
.Add("(")
.Add(subselect)
.Add(")");
return buf;
}
}
}
}