Add SAP HANA support (#1511)

This commit is contained in:
Jonathan Bregler
2018-10-24 21:38:17 +13:00
committed by Rob Bygrave
parent b1410cc660
commit 158ee9a081
79 changed files with 2596 additions and 215 deletions
@@ -3,6 +3,9 @@ package io.ebeaninternal.server.grammer;
import io.ebean.BaseTestCase;
import io.ebean.Ebean;
import io.ebean.Query;
import io.ebean.annotation.ForPlatform;
import io.ebean.annotation.IgnorePlatform;
import io.ebean.annotation.Platform;
import io.ebeaninternal.api.SpiQuery;
import org.junit.Test;
import org.tests.model.basic.Customer;
@@ -11,6 +14,8 @@ import org.tests.model.basic.ResetBasicData;
import java.util.Arrays;
import java.util.List;
import javax.xml.ws.RequestWrapper;
import static org.assertj.core.api.Assertions.assertThat;
public class EqlParserTest extends BaseTestCase {
@@ -127,6 +132,7 @@ public class EqlParserTest extends BaseTestCase {
}
@Test
@IgnorePlatform(Platform.HANA) // The HANA JDBC driver checks the field length on binding and rejects 'NEW'
public void where_or1() {
Query<Customer> query = parse("where name = 'Rob' or (status = 'NEW' and smallnote is null)");
@@ -134,8 +140,19 @@ public class EqlParserTest extends BaseTestCase {
assertThat(query.getGeneratedSql()).contains("where (t0.name = ? or (t0.status = ? and t0.smallnote is null ) )");
}
@Test
@ForPlatform(Platform.HANA)
public void where_or1_hana() {
Query<Customer> query = parse("where name = 'Rob' or (status = 'N' and smallnote is null)");
query.findList();
assertThat(query.getGeneratedSql()).contains("where (t0.name = ? or (t0.status = ? and t0.smallnote is null ) )");
}
@Test
@IgnorePlatform(Platform.HANA) // The HANA JDBC driver checks the field length on binding and rejects 'NEW'
public void where_or2() {
Query<Customer> query = parse("where (name = 'Rob' or status = 'NEW') and smallnote is null");
@@ -143,8 +160,19 @@ public class EqlParserTest extends BaseTestCase {
assertThat(query.getGeneratedSql()).contains("where ((t0.name = ? or t0.status = ? ) and t0.smallnote is null )");
}
@Test
@ForPlatform(Platform.HANA)
public void where_or2_hana() {
Query<Customer> query = parse("where (name = 'Rob' or status = 'N') and smallnote is null");
query.findList();
assertThat(query.getGeneratedSql()).contains("where ((t0.name = ? or t0.status = ? ) and t0.smallnote is null )");
}
@Test
@IgnorePlatform(Platform.HANA) // The HANA JDBC driver checks the field length on binding and rejects 'NEW'
public void test_simplifyExpressions() {
Query<Customer> query = parse("where not (name = 'Rob' and status = 'NEW')");
@@ -159,6 +187,23 @@ public class EqlParserTest extends BaseTestCase {
query.findList();
assertThat(query.getGeneratedSql()).contains("where not (t0.name = ? and t0.status = ? )");
}
@Test
@ForPlatform(Platform.HANA)
public void test_simplifyExpressions_hana() {
Query<Customer> query = parse("where not (name = 'Rob' and status = 'N')");
query.findList();
assertThat(query.getGeneratedSql()).contains("where not (t0.name = ? and t0.status = ? )");
query = parse("where not ((name = 'Rob' and status = 'N'))");
query.findList();
assertThat(query.getGeneratedSql()).contains("where not (t0.name = ? and t0.status = ? )");
query = parse("where not (((name = 'Rob') and (status = 'N')))");
query.findList();
assertThat(query.getGeneratedSql()).contains("where not (t0.name = ? and t0.status = ? )");
}
@Test