mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Merge pull request #1697 from ebean-orm/feature/1695-binary
#1695 - For MySql like remove the binary keyword + Add caseSensitiveCollation configuration option
This commit is contained in:
@@ -126,6 +126,10 @@ public abstract class BaseTestCase {
|
||||
return sql;
|
||||
}
|
||||
|
||||
public boolean isPlatformCaseSensitive() {
|
||||
return spiEbeanServer().getDatabasePlatform().isCaseSensitiveCollation();
|
||||
}
|
||||
|
||||
/**
|
||||
* MS SQL Server does not allow setting explicit values on identity columns
|
||||
* so tests that do this need to be skipped for SQL Server.
|
||||
|
||||
@@ -132,10 +132,13 @@ public class EbeanServer_eqlTest extends BaseTestCase {
|
||||
Query<Customer> query = Ebean.createQuery(Customer.class);
|
||||
query.setMaxRows(10);
|
||||
query.setFirstRow(3);
|
||||
if (isSqlServer()) {
|
||||
query.orderBy("id");
|
||||
}
|
||||
query.findList();
|
||||
|
||||
if (isSqlServer()) {
|
||||
assertThat(query.getGeneratedSql()).endsWith("from o_customer t0 offset 3 rows fetch next 10 rows only");
|
||||
assertThat(query.getGeneratedSql()).endsWith("from o_customer t0 order by t0.id offset 3 rows fetch next 10 rows only");
|
||||
} else if (isOracle()) {
|
||||
assertThat(query.getGeneratedSql()).contains("where rownum <= 13");
|
||||
assertThat(query.getGeneratedSql()).contains("where rn_ > 3");
|
||||
|
||||
@@ -70,6 +70,7 @@ public class ServerConfigTest {
|
||||
props.setProperty("namingConvention", "io.ebean.config.MatchingNamingConvention");
|
||||
props.setProperty("idGeneratorAutomatic", "true");
|
||||
props.setProperty("enabledL2Regions", "r0,users,orgs");
|
||||
props.setProperty("caseSensitiveCollation", "false");
|
||||
|
||||
|
||||
serverConfig.loadFromProperties(props);
|
||||
@@ -79,6 +80,7 @@ public class ServerConfigTest {
|
||||
assertTrue(serverConfig.isDbOffline());
|
||||
assertTrue(serverConfig.isAutoReadOnlyDataSource());
|
||||
assertTrue(serverConfig.isIdGeneratorAutomatic());
|
||||
assertFalse(serverConfig.getPlatformConfig().isCaseSensitiveCollation());
|
||||
|
||||
assertThat(serverConfig.getNamingConvention()).isInstanceOf(MatchingNamingConvention.class);
|
||||
|
||||
@@ -131,6 +133,7 @@ public class ServerConfigTest {
|
||||
assertFalse(serverConfig.isIdGeneratorAutomatic());
|
||||
assertEquals(JsonConfig.DateTime.ISO8601, serverConfig.getJsonDateTime());
|
||||
assertEquals(JsonConfig.Date.ISO8601, serverConfig.getJsonDate());
|
||||
assertTrue(serverConfig.getPlatformConfig().isCaseSensitiveCollation());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -596,7 +596,7 @@ public class EqlParserTest extends BaseTestCase {
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
Query<Customer> query = parse("limit 10 offset 5");
|
||||
Query<Customer> query = parse("order by name limit 10 offset 5");
|
||||
query.findList();
|
||||
if (isH2()) {
|
||||
assertThat(query.getGeneratedSql()).contains(" limit 10 offset 5");
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package main;
|
||||
|
||||
import io.ebean.docker.commands.MySqlConfig;
|
||||
import io.ebean.docker.commands.MySqlContainer;
|
||||
|
||||
public class StartMyServer {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
MySqlConfig config = new MySqlConfig("5.7");
|
||||
config.setDbName("unit");
|
||||
config.setUser("unit");
|
||||
config.setPassword("unit");
|
||||
|
||||
// by default this mysql docker collation is case sensitive
|
||||
// using utf8mb4_bin
|
||||
//
|
||||
// when changing to a CI collation (e.g. utf8mb4_unicode_ci) we also set
|
||||
// ebean.<db>.caseSensitiveCollation=false
|
||||
// ... such that tests now take that into account
|
||||
// config.setCollation("default");
|
||||
// config.setCollation("utf8mb4_unicode_ci");
|
||||
// config.setCharacterSet("utf8mb4");
|
||||
|
||||
MySqlContainer container = new MySqlContainer(config);
|
||||
container.start();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package main;
|
||||
|
||||
import io.ebean.docker.commands.SqlServerConfig;
|
||||
import io.ebean.docker.commands.SqlServerContainer;
|
||||
|
||||
public class StartSqlServer {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
SqlServerConfig config = new SqlServerConfig("2017-CU4");
|
||||
config.setDbName("test_ebean");
|
||||
config.setUser("test_ebean");
|
||||
|
||||
// by default this sqlserver docker collation is case sensitive
|
||||
// using MSSQL_COLLATION=Latin1_General_100_BIN2
|
||||
//
|
||||
// when changing to a CI collation also use
|
||||
// ebean.sqlserver.caseSensitiveCollation=false
|
||||
// ... such that tests now take that into account
|
||||
|
||||
//config.setCollation("default");
|
||||
//config.setCollation("Latin1_General_100_CI");
|
||||
|
||||
SqlServerContainer container = new SqlServerContainer(config);
|
||||
container.start();
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package org.tests.basic;
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.annotation.IgnorePlatform;
|
||||
import io.ebean.annotation.Platform;
|
||||
import org.junit.Test;
|
||||
import org.tests.model.basic.Country;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
@@ -32,6 +34,7 @@ public class TestQueryUsingConnection extends BaseTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
@IgnorePlatform(Platform.SQLSERVER)
|
||||
@Test
|
||||
public void usingTransaction() {
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public class TestSecondaryQueries extends TransactionalTestCase {
|
||||
|
||||
assertThat(sql).hasSize(1);
|
||||
if (isSqlServer()) {
|
||||
assertThat(trimSql(sql.get(0), 2)).contains("select top 10 t0.id, t0.status, t0.kcustomer_id from o_order t0 order by t0.id");
|
||||
assertThat(trimSql(sql.get(0), 2)).contains("select top 10 t0.id, t0.status, t0.kcustomer_id from o_order t0");
|
||||
} else {
|
||||
assertThat(trimSql(sql.get(0), 2)).contains("select t0.id, t0.status, t0.kcustomer_id from o_order t0");
|
||||
}
|
||||
@@ -91,7 +91,7 @@ public class TestSecondaryQueries extends TransactionalTestCase {
|
||||
|
||||
assertThat(sql).hasSize(1);
|
||||
if (isSqlServer()) {
|
||||
assertThat(trimSql(sql.get(0), 2)).contains("select top 10 t0.id, t0.status from o_order t0 order by t0.id");
|
||||
assertThat(trimSql(sql.get(0), 2)).contains("select top 10 t0.id, t0.status from o_order t0");
|
||||
} else {
|
||||
assertThat(trimSql(sql.get(0), 2)).contains("select t0.id, t0.status from o_order t0");
|
||||
}
|
||||
|
||||
@@ -34,15 +34,20 @@ public class TestOneToManyJoinTableInheritance extends BaseTestCase {
|
||||
|
||||
List<String> sql = LoggedSqlCollector.current();
|
||||
|
||||
boolean hasSequence = isSqlServer(); // uses sequence
|
||||
assertThat(sql).hasSize(11);
|
||||
assertThat(sql.get(0)).contains("insert into class_super ");
|
||||
assertThat(sql.get(1)).contains("-- bind(ClassA)");
|
||||
assertThat(sql.get(2)).contains("-- bind(ClassB)");
|
||||
if (!hasSequence) {
|
||||
assertThat(sql.get(1)).contains("-- bind(ClassA)");
|
||||
assertThat(sql.get(2)).contains("-- bind(ClassB)");
|
||||
}
|
||||
assertThat(sql.get(3)).contains("insert into monkey ");
|
||||
assertThat(sql.get(4)).contains("-- bind(Sim");
|
||||
assertThat(sql.get(5)).contains("-- bind(Tim");
|
||||
assertThat(sql.get(6)).contains("-- bind(Uim");
|
||||
assertThat(sql.get(7)).contains("insert into class_super_monkey (class_super_sid, monkey_mid) values (?, ?)");
|
||||
if (!hasSequence) {
|
||||
assertThat(sql.get(4)).contains("-- bind(Sim");
|
||||
assertThat(sql.get(5)).contains("-- bind(Tim");
|
||||
assertThat(sql.get(6)).contains("-- bind(Uim");
|
||||
assertThat(sql.get(7)).contains("insert into class_super_monkey (class_super_sid, monkey_mid) values (?, ?)");
|
||||
}
|
||||
assertSqlBind(sql, 8, 10);
|
||||
|
||||
ClassA dbA = Ebean.find(ClassA.class, 1);
|
||||
|
||||
@@ -126,6 +126,7 @@ public class TestAddOrderByWithFirstRowsMaxRows extends BaseTestCase {
|
||||
Ebean.find(Order.class)
|
||||
.setFirstRow(10)
|
||||
.setMaxRows(10)
|
||||
.orderBy("id")
|
||||
.findPagedList()
|
||||
.getList();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.tests.query;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.DB;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.tests.model.basic.Customer;
|
||||
@@ -23,13 +23,17 @@ public class TestQueryFilterCaseInsensitive extends BaseTestCase {
|
||||
|
||||
// Note: this test uses only customer#1..#4
|
||||
|
||||
List<Customer> customers = Ebean.find(Customer.class).where()
|
||||
List<Customer> customers = DB.find(Customer.class).where()
|
||||
.eq("name", "ROB") // case match
|
||||
.le("id", 4).findList();
|
||||
|
||||
assertThat(customers).isEmpty();
|
||||
if (isPlatformCaseSensitive()) {
|
||||
assertThat(customers).isEmpty();
|
||||
} else {
|
||||
assertThat(customers).isNotEmpty();
|
||||
}
|
||||
|
||||
customers = Ebean.find(Customer.class).where()
|
||||
customers = DB.find(Customer.class).where()
|
||||
.ieq("name", "ROB") // case insensitive match
|
||||
.le("id", 4).findList();
|
||||
|
||||
@@ -38,13 +42,17 @@ public class TestQueryFilterCaseInsensitive extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void testNe() {
|
||||
List<Customer> customers = Ebean.find(Customer.class).where()
|
||||
List<Customer> customers = DB.find(Customer.class).where()
|
||||
.ne("name", "ROB") // case match
|
||||
.le("id", 4).findList();
|
||||
|
||||
assertThat(customers).hasSize(4);
|
||||
if (isPlatformCaseSensitive()) {
|
||||
assertThat(customers).hasSize(4);
|
||||
} else {
|
||||
assertThat(customers).isNotEmpty();
|
||||
}
|
||||
|
||||
customers = Ebean.find(Customer.class).where()
|
||||
customers = DB.find(Customer.class).where()
|
||||
.ine("name", "ROB") // case insensitive match
|
||||
.le("id", 4).findList();
|
||||
|
||||
@@ -54,13 +62,17 @@ public class TestQueryFilterCaseInsensitive extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void testLike() {
|
||||
List<Customer> customers = Ebean.find(Customer.class).where()
|
||||
List<Customer> customers = DB.find(Customer.class).where()
|
||||
.like("name", "%O%") // case match
|
||||
.le("id", 4).findList();
|
||||
|
||||
assertThat(customers).isEmpty();
|
||||
if (isPlatformCaseSensitive()) {
|
||||
assertThat(customers).isEmpty();
|
||||
} else {
|
||||
assertThat(customers).isNotEmpty();
|
||||
}
|
||||
|
||||
customers = Ebean.find(Customer.class).where()
|
||||
customers = DB.find(Customer.class).where()
|
||||
.ilike("name", "%O%") // case insensitive match
|
||||
.le("id", 4).findList();
|
||||
|
||||
@@ -69,29 +81,36 @@ public class TestQueryFilterCaseInsensitive extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void testContains() {
|
||||
List<Customer> customers = Ebean.find(Customer.class).where()
|
||||
List<Customer> customers = DB.find(Customer.class).where()
|
||||
.contains("name", "O") // case match
|
||||
.le("id", 4).findList();
|
||||
|
||||
assertThat(customers).isEmpty();
|
||||
if (isPlatformCaseSensitive()) {
|
||||
assertThat(customers).isEmpty();
|
||||
} else {
|
||||
assertThat(customers).isNotEmpty();
|
||||
}
|
||||
|
||||
customers = Ebean.find(Customer.class).where()
|
||||
customers = DB.find(Customer.class).where()
|
||||
.icontains("name", "O") // case insensitive match
|
||||
.le("id", 4).findList();
|
||||
|
||||
assertThat(customers).hasSize(4); // Rob / Fiona / Cust No address / NocCust
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStartsWith() {
|
||||
List<Customer> customers = Ebean.find(Customer.class).where()
|
||||
List<Customer> customers = DB.find(Customer.class).where()
|
||||
.startsWith("name", "RO") // case match
|
||||
.le("id", 4).findList();
|
||||
|
||||
assertThat(customers).isEmpty();
|
||||
if (isPlatformCaseSensitive()) {
|
||||
assertThat(customers).isEmpty();
|
||||
} else {
|
||||
assertThat(customers).isNotEmpty();
|
||||
}
|
||||
|
||||
customers = Ebean.find(Customer.class).where()
|
||||
customers = DB.find(Customer.class).where()
|
||||
.istartsWith("name", "RO") // case insensitive match
|
||||
.le("id", 4).findList();
|
||||
|
||||
@@ -100,13 +119,17 @@ public class TestQueryFilterCaseInsensitive extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void testEndsWith() {
|
||||
List<Customer> customers = Ebean.find(Customer.class).where()
|
||||
List<Customer> customers = DB.find(Customer.class).where()
|
||||
.endsWith("name", "OB") // case match
|
||||
.le("id", 4).findList();
|
||||
|
||||
assertThat(customers).isEmpty();
|
||||
if (isPlatformCaseSensitive()) {
|
||||
assertThat(customers).isEmpty();
|
||||
} else {
|
||||
assertThat(customers).isNotEmpty();
|
||||
}
|
||||
|
||||
customers = Ebean.find(Customer.class).where()
|
||||
customers = DB.find(Customer.class).where()
|
||||
.iendsWith("name", "OB") // case insensitive match
|
||||
.le("id", 4).findList();
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ public class TestQueryFindPagedList extends BaseTestCase {
|
||||
PagedList<Order> pagedList2 = Ebean.find(Order.class)
|
||||
.setFirstRow(1)
|
||||
.setMaxRows(3)
|
||||
.orderBy("id")
|
||||
.findPagedList();
|
||||
|
||||
pagedList2.loadCount();
|
||||
@@ -109,6 +110,7 @@ public class TestQueryFindPagedList extends BaseTestCase {
|
||||
PagedList<Order> pagedList3 = Ebean.find(Order.class)
|
||||
.setFirstRow(2)
|
||||
.setMaxRows(150)
|
||||
.orderBy("id")
|
||||
.findPagedList();
|
||||
|
||||
assertFalse(pagedList3.hasNext());
|
||||
|
||||
@@ -15,11 +15,16 @@ public class TestQueryOrderById extends BaseTestCase {
|
||||
|
||||
Query<Customer> query = DB.find(Customer.class)
|
||||
.select("id,name")
|
||||
.orderBy("id")
|
||||
.setFirstRow(1)
|
||||
.setMaxRows(5);
|
||||
|
||||
query.findList();
|
||||
assertThat(sqlOf(query)).isEqualTo("select t0.id, t0.name from o_customer t0 limit 5 offset 1");
|
||||
if (isSqlServer()) {
|
||||
assertThat(sqlOf(query)).isEqualTo("select t0.id, t0.name from o_customer t0 order by t0.id offset 1 rows fetch next 5 rows only");
|
||||
} else {
|
||||
assertThat(sqlOf(query)).isEqualTo("select t0.id, t0.name from o_customer t0 order by t0.id limit 5 offset 1");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -32,6 +37,10 @@ public class TestQueryOrderById extends BaseTestCase {
|
||||
.orderById(true);
|
||||
|
||||
query.findList();
|
||||
assertThat(sqlOf(query)).isEqualTo("select t0.id, t0.name from o_customer t0 order by t0.id limit 5 offset 1");
|
||||
if (isSqlServer()) {
|
||||
assertThat(sqlOf(query)).isEqualTo("select t0.id, t0.name from o_customer t0 order by t0.id offset 1 rows fetch next 5 rows only");
|
||||
} else {
|
||||
assertThat(sqlOf(query)).isEqualTo("select t0.id, t0.name from o_customer t0 order by t0.id limit 5 offset 1");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.tests.query.other;
|
||||
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.TransactionalTestCase;
|
||||
|
||||
import org.tests.model.basic.Customer;
|
||||
@@ -16,76 +16,80 @@ public class TestLikeEscaping extends TransactionalTestCase {
|
||||
public void testLikeEscaping() {
|
||||
// Mysql, PgSql, H2 special chars: "_" "%"
|
||||
// MsSql special chars: "_" "%" "[" AND different Quoting!
|
||||
Ebean.save(ResetBasicData.createCustomer("Paul % Percentage", "*Star", "[none]", 0, null));
|
||||
Ebean.save(ResetBasicData.createCustomer("(none)", "More * Star", "[none]", 0, null));
|
||||
DB.save(ResetBasicData.createCustomer("Paul % Percentage", "*Star", "[none]", 0, null));
|
||||
DB.save(ResetBasicData.createCustomer("(none)", "More * Star", "[none]", 0, null));
|
||||
|
||||
Ebean.save(ResetBasicData.createCustomer("Paul %% Doublepercentage", "|Pipeway", "[other]", 1, null));
|
||||
Ebean.save(ResetBasicData.createCustomer("_Udo Underscore", "|Pipeway", "[other]", 1, null));
|
||||
DB.save(ResetBasicData.createCustomer("Paul %% Doublepercentage", "|Pipeway", "[other]", 1, null));
|
||||
DB.save(ResetBasicData.createCustomer("_Udo Underscore", "|Pipeway", "[other]", 1, null));
|
||||
|
||||
Ebean.save(ResetBasicData.createCustomer("Bodo \\ backslash", "\\BS", "[other]", 1, null));
|
||||
DB.save(ResetBasicData.createCustomer("Bodo \\ backslash", "\\BS", "[other]", 1, null));
|
||||
|
||||
assertThat(Ebean.find(Customer.class)
|
||||
assertThat(DB.find(Customer.class)
|
||||
.where().contains("name", "Paul %%").findCount()
|
||||
).isEqualTo(1);
|
||||
|
||||
assertThat(Ebean.find(Customer.class)
|
||||
assertThat(DB.find(Customer.class)
|
||||
.where().contains("name", "o \\ b").findCount()
|
||||
).isEqualTo(1);
|
||||
|
||||
assertThat(Ebean.find(Customer.class)
|
||||
assertThat(DB.find(Customer.class)
|
||||
.where().contains("name", "o \\\\ b").findCount()
|
||||
).isEqualTo(0);
|
||||
|
||||
assertThat(Ebean.find(Customer.class)
|
||||
assertThat(DB.find(Customer.class)
|
||||
.where().startsWith("name", "_").findCount()
|
||||
).isEqualTo(1);
|
||||
|
||||
assertThat(Ebean.find(Customer.class)
|
||||
if (isPlatformCaseSensitive()) {
|
||||
assertThat(DB.find(Customer.class)
|
||||
.where().startsWith("name", "_u").findCount()
|
||||
).isEqualTo(0);
|
||||
).isEqualTo(0);
|
||||
}
|
||||
|
||||
assertThat(Ebean.find(Customer.class)
|
||||
assertThat(DB.find(Customer.class)
|
||||
.where().istartsWith("name", "_U").findCount()
|
||||
).isEqualTo(1);
|
||||
|
||||
assertThat(Ebean.find(Customer.class)
|
||||
if (isPlatformCaseSensitive()) {
|
||||
assertThat(DB.find(Customer.class)
|
||||
.where().startsWith("shippingAddress.line1", "|p").findCount()
|
||||
).isEqualTo(0);
|
||||
).isEqualTo(0);
|
||||
}
|
||||
|
||||
assertThat(Ebean.find(Customer.class)
|
||||
assertThat(DB.find(Customer.class)
|
||||
.where().startsWith("shippingAddress.line1", "|P").findCount()
|
||||
).isEqualTo(2);
|
||||
|
||||
assertThat(Ebean.find(Customer.class)
|
||||
assertThat(DB.find(Customer.class)
|
||||
.where().startsWith("shippingAddress.line1", "\\B").findCount()
|
||||
).isEqualTo(1);
|
||||
|
||||
assertThat(Ebean.find(Customer.class)
|
||||
assertThat(DB.find(Customer.class)
|
||||
.where().endsWith("billingAddress.line1", "]").findCount()
|
||||
).isEqualTo(5);
|
||||
|
||||
assertThat(Ebean.find(Customer.class)
|
||||
assertThat(DB.find(Customer.class)
|
||||
.where().endsWith("billingAddress.line1", "[none]").findCount()
|
||||
).isEqualTo(2);
|
||||
|
||||
assertThat(Ebean.find(Customer.class)
|
||||
assertThat(DB.find(Customer.class)
|
||||
.where().startsWith("billingAddress.line1", "[none]").findCount()
|
||||
).isEqualTo(2);
|
||||
|
||||
assertThat(Ebean.find(Customer.class)
|
||||
assertThat(DB.find(Customer.class)
|
||||
.where().contains("billingAddress.line1", "[none]").findCount()
|
||||
).isEqualTo(2);
|
||||
|
||||
|
||||
assertThat(Ebean.find(Customer.class)
|
||||
assertThat(DB.find(Customer.class)
|
||||
.where().contains("shippingAddress.line1", "*").findCount()
|
||||
).isEqualTo(2);
|
||||
|
||||
assertThat(Ebean.find(Customer.class)
|
||||
assertThat(DB.find(Customer.class)
|
||||
.where().startsWith("shippingAddress.line1", "*").findCount()
|
||||
).isEqualTo(1);
|
||||
|
||||
assertThat(Ebean.find(Customer.class)
|
||||
assertThat(DB.find(Customer.class)
|
||||
.where().endsWith("shippingAddress.line1", "*").findCount()
|
||||
).isEqualTo(0);
|
||||
}
|
||||
|
||||
@@ -26,10 +26,11 @@ public class TestWhereLikeWithSlash extends BaseTestCase {
|
||||
Query<EBasic> query1 = Ebean.find(EBasic.class).where().like("name", "slash\\mon%").query();
|
||||
List<EBasic> list1 = query1.findList();
|
||||
|
||||
// This doesn't work in the latest version of H2 so disable for now.
|
||||
// Still good on Postgres which was the original issue
|
||||
assertEquals(1, list1.size());
|
||||
|
||||
if (!isMySql()) {
|
||||
// For mysql this assert depends on no_backslash_escapes setting so we won't assert here
|
||||
// Still good on Postgres which was the original issue
|
||||
assertEquals(1, list1.size());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -151,6 +151,7 @@ public class TestRawSqlOrmQuery extends BaseTestCase {
|
||||
|
||||
query.setFirstRow(1);
|
||||
query.setMaxRows(2);
|
||||
query.orderBy("id");
|
||||
|
||||
List<Customer> list = query.findList();
|
||||
|
||||
|
||||
@@ -75,17 +75,22 @@ public class TestBatchModelFlush extends BaseTestCase {
|
||||
assertThat(sql).hasSize(9);
|
||||
|
||||
// first saved to batch - (depth 100)
|
||||
boolean hasSequence = isSqlServer();
|
||||
assertThat(sql.get(0)).contains("insert into mny_b");
|
||||
assertThat(sql.get(1)).contains(" -- bind(BatchMultipleTop_0");
|
||||
assertThat(sql.get(2)).contains(" -- bind(BatchMultipleTop_1");
|
||||
if (!hasSequence) {
|
||||
assertThat(sql.get(1)).contains(" -- bind(BatchMultipleTop_0");
|
||||
assertThat(sql.get(2)).contains(" -- bind(BatchMultipleTop_1");
|
||||
}
|
||||
// second saved to batch - (depth 101)
|
||||
assertThat(sql.get(3)).contains("insert into mt_role");
|
||||
assertThat(sql.get(4)).contains(" -- bind(");
|
||||
assertThat(sql.get(5)).contains(" -- bind(");
|
||||
// third saved to batch - (depth 102)
|
||||
assertThat(sql.get(6)).contains("insert into mny_topic");
|
||||
assertThat(sql.get(7)).contains(" -- bind(MnyTopic_0");
|
||||
assertThat(sql.get(8)).contains(" -- bind(MnyTopic_1");
|
||||
if (!hasSequence) {
|
||||
assertThat(sql.get(7)).contains(" -- bind(MnyTopic_0");
|
||||
assertThat(sql.get(8)).contains(" -- bind(MnyTopic_1");
|
||||
}
|
||||
|
||||
DB.delete(t0);
|
||||
DB.delete(t1);
|
||||
|
||||
Reference in New Issue
Block a user