mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Pr/add tests (#1103)
* ADD: Testcase for Sqlserver-6.2.0 driver * CHG: Removed Row-limit - so we need no special handling when sqlserver-platform generates a "select top 100" statement * ADD: additional asserts to TestQueryCache * CHG: Ignore test for sqlserver
This commit is contained in:
committed by
Rob Bygrave
parent
96e3f4138f
commit
e908d16ba8
@@ -62,11 +62,10 @@ public class TestQuerySingleAttribute extends BaseTestCase {
|
||||
.setDistinct(true)
|
||||
.select("name")
|
||||
.where().eq("status", Customer.Status.NEW)
|
||||
.orderBy().asc("name")
|
||||
.setMaxRows(100);
|
||||
.orderBy().asc("name");
|
||||
|
||||
query.findSingleAttributeList();
|
||||
assertThat(sqlOf(query)).contains("select distinct t0.name from o_customer t0 where t0.status = ? order by t0.name ");
|
||||
assertThat(sqlOf(query)).contains("select distinct t0.name from o_customer t0 where t0.status = ? order by t0.name");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -155,8 +154,7 @@ public class TestQuerySingleAttribute extends BaseTestCase {
|
||||
|
||||
Query<Customer> query = Ebean.find(Customer.class)
|
||||
.setDistinct(true)
|
||||
.fetch("billingAddress","city")
|
||||
.setMaxRows(100);
|
||||
.fetch("billingAddress","city");
|
||||
|
||||
List<String> cities = query.findSingleAttributeList();
|
||||
|
||||
@@ -185,11 +183,10 @@ public class TestQuerySingleAttribute extends BaseTestCase {
|
||||
|
||||
Query<ChildA> query = Ebean.find(ChildA.class)
|
||||
.setDistinct(true)
|
||||
.select("more")
|
||||
.setMaxRows(100);
|
||||
.select("more");
|
||||
|
||||
query.findSingleAttributeList();
|
||||
assertThat(sqlOf(query)).contains("select distinct t0.more from rawinherit_parent t0 where t0.type = 'A' limit 100");
|
||||
assertThat(sqlOf(query)).contains("select distinct t0.more from rawinherit_parent t0 where t0.type = 'A' ");
|
||||
|
||||
}
|
||||
|
||||
@@ -200,12 +197,11 @@ public class TestQuerySingleAttribute extends BaseTestCase {
|
||||
|
||||
Query<EUncle> query = Ebean.find(EUncle.class)
|
||||
.setDistinct(true)
|
||||
.fetch("parent","more")
|
||||
.setMaxRows(100);
|
||||
.fetch("parent","more");
|
||||
|
||||
query.findSingleAttributeList();
|
||||
|
||||
assertThat(sqlOf(query)).contains("select distinct t1.more from rawinherit_uncle t0 join rawinherit_parent t1 on t1.id = t0.parent_id and t1.type in ('A','B')");
|
||||
assertThat(sqlOf(query)).contains("select distinct t1.more from rawinherit_uncle t0 join rawinherit_parent t1 on t1.id = t0.parent_id");
|
||||
|
||||
}
|
||||
|
||||
@@ -231,8 +227,7 @@ public class TestQuerySingleAttribute extends BaseTestCase {
|
||||
ResetBasicData.reset();
|
||||
|
||||
Query<Customer> query = Ebean.find(Customer.class)
|
||||
.fetch("billingAddress","city")
|
||||
.setMaxRows(100);
|
||||
.fetch("billingAddress","city");
|
||||
|
||||
List<String> cities = query.findSingleAttributeList();
|
||||
|
||||
@@ -246,11 +241,10 @@ public class TestQuerySingleAttribute extends BaseTestCase {
|
||||
ResetBasicData.reset();
|
||||
|
||||
Query<ChildA> query = Ebean.find(ChildA.class)
|
||||
.select("more")
|
||||
.setMaxRows(100);
|
||||
.select("more");
|
||||
|
||||
query.findSingleAttributeList();
|
||||
assertThat(sqlOf(query)).contains("select t0.more from rawinherit_parent t0 where t0.type = 'A' limit 100");
|
||||
assertThat(sqlOf(query)).contains("select t0.more from rawinherit_parent t0 where t0.type = 'A'");
|
||||
|
||||
}
|
||||
|
||||
@@ -260,12 +254,11 @@ public class TestQuerySingleAttribute extends BaseTestCase {
|
||||
ResetBasicData.reset();
|
||||
|
||||
Query<EUncle> query = Ebean.find(EUncle.class)
|
||||
.fetch("parent","more")
|
||||
.setMaxRows(100);
|
||||
.fetch("parent","more");
|
||||
|
||||
query.findSingleAttributeList();
|
||||
|
||||
assertThat(sqlOf(query)).contains("select t1.more from rawinherit_uncle t0 join rawinherit_parent t1 on t1.id = t0.parent_id and t1.type in ('A','B')");
|
||||
assertThat(sqlOf(query)).contains("select t1.more from rawinherit_uncle t0 join rawinherit_parent t1 on t1.id = t0.parent_id");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -274,12 +267,11 @@ public class TestQuerySingleAttribute extends BaseTestCase {
|
||||
ResetBasicData.reset();
|
||||
|
||||
Query<EUncle> query = Ebean.find(EUncle.class)
|
||||
.fetch("parent","more")
|
||||
.setMaxRows(100);
|
||||
.fetch("parent","more");
|
||||
|
||||
Ebean.getDefaultServer().findSingleAttributeList(query, null);
|
||||
|
||||
assertThat(sqlOf(query)).contains("select t1.more from rawinherit_uncle t0 join rawinherit_parent t1 on t1.id = t0.parent_id and t1.type in ('A','B')");
|
||||
assertThat(sqlOf(query)).contains("select t1.more from rawinherit_uncle t0 join rawinherit_parent t1 on t1.id = t0.parent_id");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user