removed the concat-operator "||" and replaced with "concat()" (#1489)

* removed the concat-operator "||" and replaced with "concat()"

* using || in postgres

* FIX: Assert-statement
This commit is contained in:
Roland Praml
2018-09-26 21:19:28 +12:00
committed by Rob Bygrave
parent efa86043bf
commit a020bb15a1
12 changed files with 49 additions and 71 deletions
@@ -4,8 +4,6 @@ import io.ebean.BaseTestCase;
import io.ebean.CacheMode;
import io.ebean.Ebean;
import io.ebean.Pairs;
import io.ebean.annotation.IgnorePlatform;
import io.ebean.annotation.Platform;
import io.ebean.cache.ServerCache;
import io.ebean.cache.ServerCacheManager;
import io.ebean.cache.ServerCacheStatistics;
@@ -251,7 +249,6 @@ public class TestCacheViaComplexNaturalKey3 extends BaseTestCase {
assertBeanCacheHitMiss(0, 0);
}
@IgnorePlatform({Platform.MYSQL, Platform.SQLSERVER})
@Test
public void findList_inPairs_standardConcat() {
@@ -280,14 +277,15 @@ public class TestCacheViaComplexNaturalKey3 extends BaseTestCase {
assertBeanCacheHitMiss(1, 0);
if (isH2()) {
assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and (t0.sku||'-'||t0.code) in (?, ? ) order by t0.sku desc; --bind(def,Array[2]={2-1000,3-1000})");
} else {
assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and CONCAT(t0.sku,'-',t0.code) in (?, ? ) order by t0.sku desc; --bind(def,Array[2]={2-1000,3-1000})");
} else if (isPostgres()) {
assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and (t0.sku||'-'||t0.code)");
} else {
assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and CONCAT(t0.sku,'-',t0.code)");
}
}
@IgnorePlatform({Platform.MYSQL, Platform.SQLSERVER})
@Test
public void findList_inPairs_userConcat() {
@@ -318,9 +316,11 @@ public class TestCacheViaComplexNaturalKey3 extends BaseTestCase {
assertBeanCacheHitMiss(1, 0);
if (isH2()) {
assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and (t0.sku||':'||t0.code||'-foo') in (?, ? ) order by t0.sku desc; --bind(def,Array[2]={2:1000-foo,3:1000-foo})");
} else {
assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and CONCAT(t0.sku,':',t0.code,'-foo') in (?, ? ) order by t0.sku desc; --bind(def,Array[2]={2:1000-foo,3:1000-foo})");
} else if (isPostgres()){
assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and (t0.sku||':'||t0.code||'-foo')");
} else {
assertThat(sql.get(0)).contains("from o_cached_natkey3 t0 where t0.store = ? and CONCAT(t0.sku,':',t0.code,'-foo')");
}
}