7
7
8
8
namespace NHibernate . Test . ExpressionTest . Projection
9
9
{
10
- using Util ;
11
- using NHibernate . Dialect . Function ;
10
+ using NHibernate . Dialect . Function ;
12
11
13
12
[ TestFixture ]
14
13
public class ProjectionFixture : BaseExpressionFixture
@@ -19,7 +18,7 @@ public void RowCountTest()
19
18
ISession session = factory . OpenSession ( ) ;
20
19
IProjection expression = Projections . RowCount ( ) ;
21
20
CreateObjects ( typeof ( Simple ) , session ) ;
22
- SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery , new CollectionHelper . EmptyMapClass < string , IFilter > ( ) ) ;
21
+ SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery ) ;
23
22
string expectedSql = "count(*) as y0_" ;
24
23
CompareSqlStrings ( sqlString , expectedSql , 0 ) ;
25
24
session . Close ( ) ;
@@ -34,7 +33,7 @@ public void AvgTest()
34
33
IType nhType = NHibernateUtil . GuessType ( typeof ( double ) ) ;
35
34
SqlType [ ] sqlTypes = nhType . SqlTypes ( this . factoryImpl ) ;
36
35
string sqlTypeString = factoryImpl . Dialect . GetCastTypeName ( sqlTypes [ 0 ] ) ;
37
- SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery , new CollectionHelper . EmptyMapClass < string , IFilter > ( ) ) ;
36
+ SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery ) ;
38
37
string expectedSql = string . Format ( "avg(cast(sql_alias.Pay as {0})) as y0_" , sqlTypeString ) ;
39
38
CompareSqlStrings ( sqlString , expectedSql , 0 ) ;
40
39
session . Close ( ) ;
@@ -46,7 +45,7 @@ public void MaxTest()
46
45
ISession session = factory . OpenSession ( ) ;
47
46
IProjection expression = Projections . Max ( "Pay" ) ;
48
47
CreateObjects ( typeof ( Simple ) , session ) ;
49
- SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery , new CollectionHelper . EmptyMapClass < string , IFilter > ( ) ) ;
48
+ SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery ) ;
50
49
string expectedSql = "max(sql_alias.Pay) as y0_" ;
51
50
CompareSqlStrings ( sqlString , expectedSql , 0 ) ;
52
51
session . Close ( ) ;
@@ -58,7 +57,7 @@ public void MinTest()
58
57
ISession session = factory . OpenSession ( ) ;
59
58
IProjection expression = Projections . Min ( "Pay" ) ;
60
59
CreateObjects ( typeof ( Simple ) , session ) ;
61
- SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery , new CollectionHelper . EmptyMapClass < string , IFilter > ( ) ) ;
60
+ SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery ) ;
62
61
string expectedSql = "min(sql_alias.Pay) as y0_" ;
63
62
CompareSqlStrings ( sqlString , expectedSql , 0 ) ;
64
63
session . Close ( ) ;
@@ -70,7 +69,7 @@ public void CountTest()
70
69
ISession session = factory . OpenSession ( ) ;
71
70
IProjection expression = Projections . Count ( "Pay" ) ;
72
71
CreateObjects ( typeof ( Simple ) , session ) ;
73
- SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery , new CollectionHelper . EmptyMapClass < string , IFilter > ( ) ) ;
72
+ SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery ) ;
74
73
string expectedSql = "count(sql_alias.Pay) as y0_" ;
75
74
CompareSqlStrings ( sqlString , expectedSql , 0 ) ;
76
75
session . Close ( ) ;
@@ -82,7 +81,7 @@ public void CountDistinctTest()
82
81
ISession session = factory . OpenSession ( ) ;
83
82
IProjection expression = Projections . CountDistinct ( "Pay" ) ;
84
83
CreateObjects ( typeof ( Simple ) , session ) ;
85
- SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery , new CollectionHelper . EmptyMapClass < string , IFilter > ( ) ) ;
84
+ SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery ) ;
86
85
string expectedSql = "count(distinct sql_alias.Pay) as y0_" ;
87
86
CompareSqlStrings ( sqlString , expectedSql , 0 ) ;
88
87
session . Close ( ) ;
@@ -95,7 +94,7 @@ public void NvlTest()
95
94
IProjection expression = Projections . SqlFunction ( new NvlFunction ( ) ,
96
95
NHibernateUtil . String , Projections . Property ( "Name" ) , Projections . Property ( "Address" ) ) ;
97
96
CreateObjects ( typeof ( Simple ) , session ) ;
98
- SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery , new CollectionHelper . EmptyMapClass < string , IFilter > ( ) ) ;
97
+ SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery ) ;
99
98
string expectedSql = "nvl(sql_alias.Name, sql_alias.address) as y0_" ;
100
99
CompareSqlStrings ( sqlString , expectedSql , 0 ) ;
101
100
session . Close ( ) ;
@@ -107,7 +106,7 @@ public void DistinctTest()
107
106
ISession session = factory . OpenSession ( ) ;
108
107
IProjection expression = Projections . Distinct ( Projections . Property ( "Pay" ) ) ;
109
108
CreateObjects ( typeof ( Simple ) , session ) ;
110
- SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery , new CollectionHelper . EmptyMapClass < string , IFilter > ( ) ) ;
109
+ SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery ) ;
111
110
string expectedSql = "distinct sql_alias.Pay as y0_" ;
112
111
CompareSqlStrings ( sqlString , expectedSql , 0 ) ;
113
112
session . Close ( ) ;
@@ -119,10 +118,10 @@ public void GroupPropertyTest()
119
118
ISession session = factory . OpenSession ( ) ;
120
119
IProjection expression = Projections . GroupProperty ( "Pay" ) ;
121
120
CreateObjects ( typeof ( Simple ) , session ) ;
122
- SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery , new CollectionHelper . EmptyMapClass < string , IFilter > ( ) ) ;
121
+ SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery ) ;
123
122
string expectedSql = "sql_alias.Pay as y0_" ;
124
123
CompareSqlStrings ( sqlString , expectedSql , 0 ) ;
125
- SqlString groupSql = expression . ToGroupSqlString ( criteria , criteriaQuery , new CollectionHelper . EmptyMapClass < string , IFilter > ( ) ) ;
124
+ SqlString groupSql = expression . ToGroupSqlString ( criteria , criteriaQuery ) ;
126
125
string expectedGroupSql = "sql_alias.Pay" ;
127
126
CompareSqlStrings ( groupSql , expectedGroupSql ) ;
128
127
session . Close ( ) ;
@@ -134,7 +133,7 @@ public void IdTest()
134
133
ISession session = factory . OpenSession ( ) ;
135
134
IProjection expression = Projections . Id ( ) ;
136
135
CreateObjects ( typeof ( Simple ) , session ) ;
137
- SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery , new CollectionHelper . EmptyMapClass < string , IFilter > ( ) ) ;
136
+ SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery ) ;
138
137
string expectedSql = "sql_alias.id_ as y0_" ;
139
138
CompareSqlStrings ( sqlString , expectedSql , 0 ) ;
140
139
session . Close ( ) ;
@@ -146,7 +145,7 @@ public void PropertyTest()
146
145
ISession session = factory . OpenSession ( ) ;
147
146
IProjection expression = Projections . Property ( "Pay" ) ;
148
147
CreateObjects ( typeof ( Simple ) , session ) ;
149
- SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery , new CollectionHelper . EmptyMapClass < string , IFilter > ( ) ) ;
148
+ SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery ) ;
150
149
string expectedSql = "sql_alias.Pay as y0_" ;
151
150
CompareSqlStrings ( sqlString , expectedSql , 0 ) ;
152
151
session . Close ( ) ;
@@ -161,7 +160,7 @@ public void SqlGroupProjectionTest()
161
160
new IType [ ] { NHibernateUtil . Double }
162
161
) ;
163
162
CreateObjects ( typeof ( Simple ) , session ) ;
164
- SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery , new CollectionHelper . EmptyMapClass < string , IFilter > ( ) ) ;
163
+ SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery ) ;
165
164
string expectedSql = "count(Pay)" ;
166
165
CompareSqlStrings ( sqlString , expectedSql , 0 ) ;
167
166
session . Close ( ) ;
@@ -175,7 +174,7 @@ public void SqlProjectionTest()
175
174
new string [ ] { "CountOfPay" } , new
176
175
IType [ ] { NHibernateUtil . Double } ) ;
177
176
CreateObjects ( typeof ( Simple ) , session ) ;
178
- SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery , new CollectionHelper . EmptyMapClass < string , IFilter > ( ) ) ;
177
+ SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery ) ;
179
178
string expectedSql = "count(Pay)" ;
180
179
CompareSqlStrings ( sqlString , expectedSql , 0 ) ;
181
180
session . Close ( ) ;
@@ -187,7 +186,7 @@ public void SumTest()
187
186
ISession session = factory . OpenSession ( ) ;
188
187
IProjection expression = Projections . Sum ( "Pay" ) ;
189
188
CreateObjects ( typeof ( Simple ) , session ) ;
190
- SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery , new CollectionHelper . EmptyMapClass < string , IFilter > ( ) ) ;
189
+ SqlString sqlString = expression . ToSqlString ( criteria , 0 , criteriaQuery ) ;
191
190
string expectedSql = "sum(sql_alias.Pay) as y0_" ;
192
191
CompareSqlStrings ( sqlString , expectedSql , 0 ) ;
193
192
session . Close ( ) ;
0 commit comments