Skip to content

Commit 0230648

Browse files
NH-4004 - Simplifies scalar sub-select support condition.
1 parent 26cfb0b commit 0230648

File tree

16 files changed

+90
-99
lines changed

16 files changed

+90
-99
lines changed

src/NHibernate.Test/Criteria/CriteriaQueryTest.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ public void ScrollCriteria()
112112
[Test]
113113
public void AllowToSetLimitOnSubqueries()
114114
{
115-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
116-
Assert.Ignore(Dialect.GetType().Name + " does not support subqueries in where clause");
115+
if (!Dialect.SupportsScalarSubSelects)
116+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
117117

118118
using (ISession session = OpenSession())
119119
{
@@ -132,8 +132,8 @@ public void AllowToSetLimitOnSubqueries()
132132
[Test]
133133
public void TestSubcriteriaBeingNull()
134134
{
135-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
136-
Assert.Ignore(Dialect.GetType().Name + " does not support subqueries in where clause");
135+
if (!Dialect.SupportsScalarSubSelects)
136+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
137137

138138
ISession session = OpenSession();
139139
ITransaction t = session.BeginTransaction();
@@ -211,7 +211,7 @@ public void Subselect()
211211
.Add(Subqueries.In("Gavin King", dc))
212212
.List();
213213

214-
if (TestDialect.SupportsNakedSubqueryInWhereClause)
214+
if (Dialect.SupportsScalarSubSelects)
215215
{
216216
DetachedCriteria dc2 = DetachedCriteria.For(typeof(Student), "st")
217217
.Add(Property.ForName("st.StudentNumber").EqProperty("e.StudentNumber"))

src/NHibernate.Test/Criteria/Lambda/SubQueryIntegrationFixture.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ public void JoinQueryOverProjectionAlias()
117117
[Test]
118118
public void SubQuery()
119119
{
120-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
121-
Assert.Ignore(Dialect.GetType().Name + " does not support subqueries in where clause");
120+
if (!Dialect.SupportsScalarSubSelects)
121+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
122122

123123
using (var s = OpenSession())
124124
{

src/NHibernate.Test/Linq/LinqQuerySamples.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ from c in db.Customers
220220
"a shaped subset of the data about Customers.")]
221221
public void DLinq16()
222222
{
223-
if (!TestDialect.SupportsSubqueryInSelectClause)
224-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in select clause");
223+
if (!Dialect.SupportsScalarSubSelects)
224+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
225225

226226
var q =
227227
from c in db.Customers
@@ -1456,8 +1456,8 @@ from e2 in e1.Subordinates
14561456
[Test(Description = "This sample explictly joins two tables and projects results from both tables using a group join.")]
14571457
public void DLinqJoin5()
14581458
{
1459-
if (!TestDialect.SupportsSubqueryInSelectClause)
1460-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in select clause");
1459+
if (!Dialect.SupportsScalarSubSelects)
1460+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
14611461

14621462
var q =
14631463
from c in db.Customers
@@ -1520,8 +1520,8 @@ from c in db.Customers
15201520
[Test(Description = "This sample explictly joins three tables and projects results from each of them.")]
15211521
public void DLinqJoin6()
15221522
{
1523-
if (!TestDialect.SupportsSubqueryInSelectClause)
1524-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in select clause");
1523+
if (!Dialect.SupportsScalarSubSelects)
1524+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
15251525

15261526
var q =
15271527
from c in db.Customers

src/NHibernate.Test/Linq/MiscellaneousTextFixture.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public void TelerikGridWhereClause()
5050
[Test(Description = "Predicated count on a child list")]
5151
public void PredicatedCountOnChildList()
5252
{
53-
if (!TestDialect.SupportsSubqueryInSelectClause)
54-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in select clause");
53+
if (!Dialect.SupportsScalarSubSelects)
54+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
5555

5656
var results = (from c in db.Customers
5757
select new

src/NHibernate.Test/Linq/SelectionTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ public void CanSelectWithAnySubQuery()
283283
[Test]
284284
public void CanSelectWithAggregateSubQuery()
285285
{
286-
if (!TestDialect.SupportsSubqueryInSelectClause)
287-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in select clause");
286+
if (!Dialect.SupportsScalarSubSelects)
287+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
288288

289289
var timesheets = (from timesheet in db.Timesheets
290290
select new
@@ -393,8 +393,8 @@ public void CanSelectCollection()
393393
[Test]
394394
public void CanSelectConditionalKnownTypes()
395395
{
396-
if (!TestDialect.SupportsSubqueryInSelectClause)
397-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in select clause");
396+
if (!Dialect.SupportsScalarSubSelects)
397+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
398398

399399
var moreThanTwoOrderLinesBool = db.Orders.Select(o => new { Id = o.OrderId, HasMoreThanTwo = o.OrderLines.Count() > 2 ? true : false }).ToList();
400400
Assert.That(moreThanTwoOrderLinesBool.Count(x => x.HasMoreThanTwo == true), Is.EqualTo(410));

src/NHibernate.Test/Linq/WhereSubqueryTests.cs

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ where timesheet.Entries.Count() >= 1
3434
[Test]
3535
public void TimeSheetsWithCountSubqueryReversed()
3636
{
37-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
38-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in where clause");
37+
if (!Dialect.SupportsScalarSubSelects)
38+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
3939

4040
// ReSharper disable UseMethodAny.1
4141
var query = (from timesheet in db.Timesheets
@@ -49,8 +49,8 @@ public void TimeSheetsWithCountSubqueryReversed()
4949
[Test]
5050
public void TimeSheetsWithCountSubqueryComparedToProperty()
5151
{
52-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
53-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in where clause");
52+
if (!Dialect.SupportsScalarSubSelects)
53+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
5454

5555
var query = (from timesheet in db.Timesheets
5656
where timesheet.Entries.Count() > timesheet.Id
@@ -62,8 +62,8 @@ where timesheet.Entries.Count() > timesheet.Id
6262
[Test]
6363
public void TimeSheetsWithCountSubqueryComparedToPropertyReversed()
6464
{
65-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
66-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in where clause");
65+
if (!Dialect.SupportsScalarSubSelects)
66+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
6767

6868
var query = (from timesheet in db.Timesheets
6969
where timesheet.Id < timesheet.Entries.Count()
@@ -75,8 +75,8 @@ public void TimeSheetsWithCountSubqueryComparedToPropertyReversed()
7575
[Test]
7676
public void TimeSheetsWithAverageSubquery()
7777
{
78-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
79-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in where clause");
78+
if (!Dialect.SupportsScalarSubSelects)
79+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
8080

8181
var query = (from timesheet in db.Timesheets
8282
where timesheet.Entries.Average(e => e.NumberOfHours) > 12
@@ -88,8 +88,8 @@ where timesheet.Entries.Average(e => e.NumberOfHours) > 12
8888
[Test]
8989
public void TimeSheetsWithAverageSubqueryReversed()
9090
{
91-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
92-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in where clause");
91+
if (!Dialect.SupportsScalarSubSelects)
92+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
9393

9494
var query = (from timesheet in db.Timesheets
9595
where 12 < timesheet.Entries.Average(e => e.NumberOfHours)
@@ -102,8 +102,8 @@ public void TimeSheetsWithAverageSubqueryReversed()
102102
[Ignore("Need to coalesce the subquery - timesheet with no entries should return average of 0, not null")]
103103
public void TimeSheetsWithAverageSubqueryComparedToProperty()
104104
{
105-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
106-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in where clause");
105+
if (!Dialect.SupportsScalarSubSelects)
106+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
107107

108108
var query = (from timesheet in db.Timesheets
109109
where timesheet.Entries.Average(e => e.NumberOfHours) < timesheet.Id
@@ -116,8 +116,8 @@ where timesheet.Entries.Average(e => e.NumberOfHours) < timesheet.Id
116116
[Ignore("Need to coalesce the subquery - timesheet with no entries should return average of 0, not null")]
117117
public void TimeSheetsWithAverageSubqueryComparedToPropertyReversed()
118118
{
119-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
120-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in where clause");
119+
if (!Dialect.SupportsScalarSubSelects)
120+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
121121

122122
var query = (from timesheet in db.Timesheets
123123
where timesheet.Id > timesheet.Entries.Average(e => e.NumberOfHours)
@@ -129,8 +129,8 @@ public void TimeSheetsWithAverageSubqueryComparedToPropertyReversed()
129129
[Test]
130130
public void TimeSheetsWithMaxSubquery()
131131
{
132-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
133-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in where clause");
132+
if (!Dialect.SupportsScalarSubSelects)
133+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
134134

135135
var query = (from timesheet in db.Timesheets
136136
where timesheet.Entries.Max(e => e.NumberOfHours) == 14
@@ -142,8 +142,8 @@ where timesheet.Entries.Max(e => e.NumberOfHours) == 14
142142
[Test]
143143
public void TimeSheetsWithMaxSubqueryReversed()
144144
{
145-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
146-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in where clause");
145+
if (!Dialect.SupportsScalarSubSelects)
146+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
147147

148148
var query = (from timesheet in db.Timesheets
149149
where 14 == timesheet.Entries.Max(e => e.NumberOfHours)
@@ -155,8 +155,8 @@ public void TimeSheetsWithMaxSubqueryReversed()
155155
[Test]
156156
public void TimeSheetsWithMaxSubqueryComparedToProperty()
157157
{
158-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
159-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in where clause");
158+
if (!Dialect.SupportsScalarSubSelects)
159+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
160160

161161
var query = (from timesheet in db.Timesheets
162162
where timesheet.Entries.Max(e => e.NumberOfHours) > timesheet.Id
@@ -168,8 +168,8 @@ where timesheet.Entries.Max(e => e.NumberOfHours) > timesheet.Id
168168
[Test]
169169
public void TimeSheetsWithMaxSubqueryComparedToPropertyReversed()
170170
{
171-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
172-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in where clause");
171+
if (!Dialect.SupportsScalarSubSelects)
172+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
173173

174174
var query = (from timesheet in db.Timesheets
175175
where timesheet.Id < timesheet.Entries.Max(e => e.NumberOfHours)
@@ -181,8 +181,8 @@ public void TimeSheetsWithMaxSubqueryComparedToPropertyReversed()
181181
[Test]
182182
public void TimeSheetsWithMinSubquery()
183183
{
184-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
185-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in where clause");
184+
if (!Dialect.SupportsScalarSubSelects)
185+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
186186

187187
var query = (from timesheet in db.Timesheets
188188
where timesheet.Entries.Min(e => e.NumberOfHours) < 7
@@ -194,8 +194,8 @@ where timesheet.Entries.Min(e => e.NumberOfHours) < 7
194194
[Test]
195195
public void TimeSheetsWithMinSubqueryReversed()
196196
{
197-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
198-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in where clause");
197+
if (!Dialect.SupportsScalarSubSelects)
198+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
199199

200200
var query = (from timesheet in db.Timesheets
201201
where 7 > timesheet.Entries.Min(e => e.NumberOfHours)
@@ -207,8 +207,8 @@ public void TimeSheetsWithMinSubqueryReversed()
207207
[Test]
208208
public void TimeSheetsWithMinSubqueryComparedToProperty()
209209
{
210-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
211-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in where clause");
210+
if (!Dialect.SupportsScalarSubSelects)
211+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
212212

213213
var query = (from timesheet in db.Timesheets
214214
where timesheet.Entries.Min(e => e.NumberOfHours) > timesheet.Id
@@ -220,8 +220,8 @@ where timesheet.Entries.Min(e => e.NumberOfHours) > timesheet.Id
220220
[Test]
221221
public void TimeSheetsWithMinSubqueryComparedToPropertyReversed()
222222
{
223-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
224-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in where clause");
223+
if (!Dialect.SupportsScalarSubSelects)
224+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
225225

226226
var query = (from timesheet in db.Timesheets
227227
where timesheet.Id < timesheet.Entries.Min(e => e.NumberOfHours)
@@ -233,8 +233,8 @@ public void TimeSheetsWithMinSubqueryComparedToPropertyReversed()
233233
[Test]
234234
public void TimeSheetsWithSumSubquery()
235235
{
236-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
237-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in where clause");
236+
if (!Dialect.SupportsScalarSubSelects)
237+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
238238

239239
var query = (from timesheet in db.Timesheets
240240
where timesheet.Entries.Sum(e => e.NumberOfHours) <= 20
@@ -246,8 +246,8 @@ where timesheet.Entries.Sum(e => e.NumberOfHours) <= 20
246246
[Test]
247247
public void TimeSheetsWithSumSubqueryReversed()
248248
{
249-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
250-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in where clause");
249+
if (!Dialect.SupportsScalarSubSelects)
250+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
251251

252252
var query = (from timesheet in db.Timesheets
253253
where 20 >= timesheet.Entries.Sum(e => e.NumberOfHours)
@@ -260,8 +260,8 @@ public void TimeSheetsWithSumSubqueryReversed()
260260
[Ignore("Need to coalesce the subquery - timesheet with no entries should return sum of 0, not null")]
261261
public void TimeSheetsWithSumSubqueryComparedToProperty()
262262
{
263-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
264-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in where clause");
263+
if (!Dialect.SupportsScalarSubSelects)
264+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
265265

266266
var query = (from timesheet in db.Timesheets
267267
where timesheet.Entries.Sum(e => e.NumberOfHours) <= timesheet.Id
@@ -274,8 +274,8 @@ where timesheet.Entries.Sum(e => e.NumberOfHours) <= timesheet.Id
274274
[Ignore("Need to coalesce the subquery - timesheet with no entries should return sum of 0, not null")]
275275
public void TimeSheetsWithSumSubqueryComparedToPropertyReversed()
276276
{
277-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
278-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in where clause");
277+
if (!Dialect.SupportsScalarSubSelects)
278+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
279279

280280
var query = (from timesheet in db.Timesheets
281281
where timesheet.Id >= timesheet.Entries.Sum(e => e.NumberOfHours)
@@ -595,7 +595,7 @@ public void SubqueryWithGroupBy()
595595
[Test(Description = "NH-3111")]
596596
public void SubqueryWhereFailingTest()
597597
{
598-
if (!TestDialect.SupportsSubqueryInSelectClause)
598+
if (!Dialect.SupportsScalarSubSelects)
599599
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in select clause");
600600

601601
var list = (db.OrderLines
@@ -614,7 +614,7 @@ public void SubqueryWhereFailingTest()
614614
[Test(Description = "NH-3111")]
615615
public void SubqueryWhereFailingTest2()
616616
{
617-
if (!TestDialect.SupportsSubqueryInSelectClause)
617+
if (!Dialect.SupportsScalarSubSelects)
618618
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in select clause");
619619

620620
var list = db.OrderLines
@@ -633,7 +633,7 @@ public void SubqueryWhereFailingTest2()
633633
[Test(Description = "NH-3111")]
634634
public void SubqueryWhereFailingTest3()
635635
{
636-
if (!TestDialect.SupportsSubqueryInSelectClause)
636+
if (!Dialect.SupportsScalarSubSelects)
637637
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in select clause");
638638

639639
var list = db.OrderLines
@@ -652,8 +652,8 @@ public void SubqueryWhereFailingTest3()
652652
[Test(Description = "NH-3190")]
653653
public void ProductsWithSubqueryReturningBoolFirstOrDefaultEq()
654654
{
655-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
656-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in where clause");
655+
if (!Dialect.SupportsScalarSubSelects)
656+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
657657

658658
var result = (from p in db.Products
659659
where (from c in db.Categories
@@ -669,8 +669,8 @@ public void ProductsWithSubqueryReturningBoolFirstOrDefaultEq()
669669
[Test(Description = "NH-3190")]
670670
public void SubselectCanHaveBoolResult()
671671
{
672-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
673-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in where clause");
672+
if (!Dialect.SupportsScalarSubSelects)
673+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
674674

675675
var result = (from c in db.Categories
676676
where c.Products.OrderBy(p => p.ProductId).Select(p => p.Discontinued).FirstOrDefault() == false
@@ -683,8 +683,8 @@ where c.Products.OrderBy(p => p.ProductId).Select(p => p.Discontinued).FirstOrDe
683683
[Ignore("Not fixed yet.")]
684684
public void ProductsWithSubqueryReturningProjectionBoolFirstOrDefaultEq()
685685
{
686-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
687-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in where clause");
686+
if (!Dialect.SupportsScalarSubSelects)
687+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
688688

689689
//NH-3190
690690
var result = (from p in db.Products
@@ -701,8 +701,8 @@ public void ProductsWithSubqueryReturningProjectionBoolFirstOrDefaultEq()
701701
[Test(Description = "NH-3190")]
702702
public void ProductsWithSubqueryReturningStringFirstOrDefaultEq()
703703
{
704-
if (!TestDialect.SupportsNakedSubqueryInWhereClause)
705-
Assert.Ignore(Dialect.GetType().Name + " does not support subquery in where clause");
704+
if (!Dialect.SupportsScalarSubSelects)
705+
Assert.Ignore(Dialect.GetType().Name + " does not support scalar sub-queries");
706706

707707
var result = (from p in db.Products
708708
where (from c in db.Categories

src/NHibernate.Test/NHSpecificTest/NH1359/Fixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class Fixture : BugTestCase
1313
{
1414
protected override bool AppliesTo(Dialect.Dialect dialect)
1515
{
16-
return TestDialect.SupportsSubqueryInSelectClause;
16+
return Dialect.SupportsScalarSubSelects;
1717
}
1818

1919
protected override void OnTearDown()

0 commit comments

Comments
 (0)