mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-19 23:02:24 +00:00
Update tests only for Oracle
This commit is contained in:
1 parent
35a6ff7f02
commit
9af006b15b
14 files changed
+51
-41
No files matched your search
@@ -72,7 +72,7 @@ public class TestSubQuery extends BaseTestCase {
|
||||
if (isPostgres()) {
|
||||
assertThat(debugSq.getGeneratedSql()).isEqualTo("select t1.id from o_order_detail t0 join o_order t1 on t1.id = t0.order_id where t0.product_id = any(?)");
|
||||
} else {
|
||||
assertThat(debugSq.getGeneratedSql()).isEqualTo("select t1.id from o_order_detail t0 join o_order t1 on t1.id = t0.order_id where t0.product_id in (?)");
|
||||
assertSql(debugSq.getGeneratedSql()).isEqualTo("select t1.id from o_order_detail t0 join o_order t1 on t1.id = t0.order_id where t0.product_id in (?)");
|
||||
}
|
||||
|
||||
Query<Order> query = DB.find(Order.class).select("shipDate").where().isIn("id", sq).query();
|
||||
@@ -81,7 +81,7 @@ public class TestSubQuery extends BaseTestCase {
|
||||
if (isPostgres()) {
|
||||
assertThat(query.getGeneratedSql()).isEqualTo("select t0.ship_date from o_order t0 where (t0.id) in (" + debugSq.getGeneratedSql() + ")");
|
||||
} else {
|
||||
assertThat(query.getGeneratedSql()).isEqualTo("select t0.ship_date from o_order t0 where (t0.id) in (" + debugSq.getGeneratedSql() + ")");
|
||||
assertSql(query.getGeneratedSql()).isEqualTo("select t0.ship_date from o_order t0 where (t0.id) in (" + trimSql(debugSq.getGeneratedSql()) + ")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,8 +101,8 @@ public class TestSubQuery extends BaseTestCase {
|
||||
|
||||
Query<Order> query = DB.find(Order.class).select("status").where().isIn("shipDate", sq).query();
|
||||
query.findSingleAttribute();
|
||||
assertThat(query.getGeneratedSql())
|
||||
.isEqualTo("select t0.status from o_order t0 where (t0.ship_date) in (" + debugSq.getGeneratedSql() + ")");
|
||||
assertSql(query.getGeneratedSql())
|
||||
.isEqualTo("select t0.status from o_order t0 where (t0.ship_date) in (" + trimSql(debugSq.getGeneratedSql()) + ")");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,13 +120,13 @@ public class TestSubQuery extends BaseTestCase {
|
||||
// execute the subQuery as copy (generatedSQL must be part of original query)
|
||||
Query<OrderDetail> debugSq = sq.copy();
|
||||
debugSq.findSingleAttribute();
|
||||
assertThat(debugSq.getGeneratedSql()).contains("select t2.id from o_order_detail t0 join o_order t1 on t1.id = t0.order_id left join or_order_ship t2");
|
||||
assertSql(debugSq.getGeneratedSql()).contains("select t2.id from o_order_detail t0 join o_order t1 on t1.id = t0.order_id left join or_order_ship t2");
|
||||
|
||||
Query<OrderShipment> query = DB.find(OrderShipment.class).select("shipTime").where().isIn("id", sq).query();
|
||||
query.findSingleAttribute();
|
||||
|
||||
assertThat(query.getGeneratedSql())
|
||||
.isEqualTo("select t0.ship_time from or_order_ship t0 where (t0.id) in (" + debugSq.getGeneratedSql() + ")");
|
||||
assertSql(query.getGeneratedSql())
|
||||
.isEqualTo("select t0.ship_time from or_order_ship t0 where (t0.id) in (" + trimSql(debugSq.getGeneratedSql()) + ")");
|
||||
}
|
||||
|
||||
public void testCompositeKey() {
|
||||
|
||||
@@ -81,7 +81,7 @@ public class TestQueryJoinOnFormula extends BaseTestCase {
|
||||
.order().asc("order.totalAmount");
|
||||
|
||||
shipQuery.findList();
|
||||
assertThat(shipQuery.getGeneratedSql()).isEqualTo("select t0.id "
|
||||
assertSql(shipQuery.getGeneratedSql()).isEqualTo("select t0.id "
|
||||
+ "from or_order_ship t0 "
|
||||
+ "left join o_order t1 on t1.id = t0.order_id "
|
||||
+ "left join (select order_id, count(*) as total_items, sum(order_qty*unit_price) as total_amount from o_order_detail group by order_id) z_bt1 on z_bt1.order_id = t1.id "
|
||||
@@ -98,7 +98,7 @@ public class TestQueryJoinOnFormula extends BaseTestCase {
|
||||
.where().isNotNull("order.totalAmount").query();
|
||||
|
||||
shipQuery.findList();
|
||||
assertThat(shipQuery.getGeneratedSql()).isEqualTo("select t0.id "
|
||||
assertSql(shipQuery.getGeneratedSql()).isEqualTo("select t0.id "
|
||||
+ "from or_order_ship t0 "
|
||||
+ "left join o_order t1 on t1.id = t0.order_id "
|
||||
+ "left join (select order_id, count(*) as total_items, sum(order_qty*unit_price) as total_amount from o_order_detail group by order_id) z_bt1 on z_bt1.order_id = t1.id "
|
||||
@@ -118,7 +118,7 @@ public class TestQueryJoinOnFormula extends BaseTestCase {
|
||||
if (isPostgres()) {
|
||||
assertThat(shipQuery.getGeneratedSql()).contains("select distinct on (t0.id) t0.id from or_order_ship t0");
|
||||
} else {
|
||||
assertThat(shipQuery.getGeneratedSql()).contains("select distinct t0.id from or_order_ship t0 ");
|
||||
assertSql(shipQuery.getGeneratedSql()).contains("select distinct t0.id from or_order_ship t0 ");
|
||||
}
|
||||
assertThat(shipQuery.getGeneratedSql()).contains(
|
||||
"from or_order_ship t0 " +
|
||||
@@ -139,7 +139,7 @@ public class TestQueryJoinOnFormula extends BaseTestCase {
|
||||
.order().asc("order.totalAmount");
|
||||
|
||||
shipQuery.findList();
|
||||
assertThat(shipQuery.getGeneratedSql()).isEqualTo("select t0.id, t1.id, z_bt1.total_amount "
|
||||
assertSql(shipQuery.getGeneratedSql()).isEqualTo("select t0.id, t1.id, z_bt1.total_amount "
|
||||
+ "from or_order_ship t0 "
|
||||
+ "left join o_order t1 on t1.id = t0.order_id "
|
||||
+ "left join (select order_id, count(*) as total_items, sum(order_qty*unit_price) as total_amount from o_order_detail group by order_id) z_bt1 on z_bt1.order_id = t1.id "
|
||||
@@ -156,7 +156,7 @@ public class TestQueryJoinOnFormula extends BaseTestCase {
|
||||
.where().isNotNull("order.totalAmount").query();
|
||||
|
||||
shipQuery.findList();
|
||||
assertThat(shipQuery.getGeneratedSql()).isEqualTo("select t0.id, t1.id, z_bt1.total_amount "
|
||||
assertSql(shipQuery.getGeneratedSql()).isEqualTo("select t0.id, t1.id, z_bt1.total_amount "
|
||||
+ "from or_order_ship t0 "
|
||||
+ "left join o_order t1 on t1.id = t0.order_id "
|
||||
+ "left join (select order_id, count(*) as total_items, sum(order_qty*unit_price) as total_amount from o_order_detail group by order_id) z_bt1 on z_bt1.order_id = t1.id "
|
||||
|
||||
@@ -708,7 +708,7 @@ public class TestQuerySingleAttribute extends BaseTestCase {
|
||||
.findSingleAttributeList();
|
||||
|
||||
if (isOracle()) {
|
||||
assertSql(query).contains("select r1.attribute_, count(*) from (select t2.line_1 as attribute_ from contact t0 join o_customer t1 on t1.id = t0.customer_id left join o_address t2 on t2.id = t1.billing_address_id where t2.line_1 is not null) r1 group by r1.attribute_ order by r1.attribute_ desc offset 1 rows fetch next 2 rows only");
|
||||
assertSql(query).contains("select r1.attribute_, count(*) from (select t2.line_1 as attribute_ from contact t0 join o_customer t1 on t1.id = t0.customer_id left join o_address t2 on t2.id = t1.billing_address_id where t2.line_1 is not null) r1 group by r1.attribute_ order by r1.attribute_ desc offset 1 rows fetch next 2 rows only");
|
||||
} else {
|
||||
assertSql(query).contains("select r1.attribute_, count(*) from ("
|
||||
+ "select t2.line_1 as attribute_ from contact t0 "
|
||||
|
||||
Reference in new issue
Block a user