DB2: FIX Db2SqlLimiter & tests

This commit is contained in:
Roland Praml committed 2022-01-28 10:23:22 +01:00
1 parent 1d11666945
commit 5ae5e408e3
6 files changed
+32 -23

No files matched your search

@@ -18,7 +18,7 @@ public class TestQueryOrderById extends BaseTestCase {
.setMaxRows(5);
query.findList();
if (isSqlServer()) {
if (isSqlServer() || isDb2()) {
assertSql(query).isEqualTo("select t0.id, t0.name from o_customer t0 order by t0.id offset 1 rows fetch next 5 rows only");
} else if (!isOracle()) {
assertSql(query).isEqualTo("select t0.id, t0.name from o_customer t0 order by t0.id limit 5 offset 1");
@@ -35,7 +35,7 @@ public class TestQueryOrderById extends BaseTestCase {
.orderById(true);
query.findList();
if (isSqlServer()) {
if (isSqlServer() || isDb2()) {
assertSql(query).isEqualTo("select t0.id, t0.name from o_customer t0 order by t0.id offset 1 rows fetch next 5 rows only");
} else if (!isOracle()) {
assertSql(query).isEqualTo("select t0.id, t0.name from o_customer t0 order by t0.id limit 5 offset 1");
@@ -314,7 +314,7 @@ public class TestQuerySingleAttribute extends BaseTestCase {
List<String> ids = query.findSingleAttributeList();
if (isSqlServer()) {
assertThat(sqlOf(query)).contains("select distinct top 100 t0.id from o_customer t0");
} else if (isOracle()) {
} else if (isOracle() || isDb2()) {
assertThat(sqlOf(query)).contains("select distinct t0.id from o_customer t0 fetch next 100 rows only");
} else {
assertThat(sqlOf(query)).contains("select distinct t0.id from o_customer t0 limit 100");
@@ -393,7 +393,7 @@ public class TestQuerySingleAttribute extends BaseTestCase {
List<String> ids = query.findSingleAttributeList();
if (isSqlServer()) {
assertThat(sqlOf(query)).contains("select top 100 t0.id from o_customer t0");
} else if (isOracle()) {
} else if (isOracle() || isDb2()) {
assertThat(sqlOf(query)).contains("fetch next 100 rows only");
} else {
assertThat(sqlOf(query)).contains("select t0.id from o_customer t0 limit 100");
@@ -727,9 +727,7 @@ public class TestQuerySingleAttribute extends BaseTestCase {
}
if (isSqlServer()) {
assertThat(sqlOf(query)).endsWith(" fetch next 2 rows only");
} else if (isDb2()) {
assertSql(query).endsWith("FETCH FIRST 2 ROWS ONLY");
} else if (isOracle()) {
} else if (isOracle() || isDb2()) {
assertSql(query).contains(" offset 1 rows fetch next 2 rows only");
} else {
assertThat(sqlOf(query)).endsWith(" limit 2 offset 1");