mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Misc fixes (#1290)
This commit is contained in:
committed by
Rob Bygrave
parent
ac9f3408b2
commit
bb418456e3
@@ -66,6 +66,12 @@ public class DbMigrationTest extends BaseTestCase {
|
||||
"migtest_e_ref",
|
||||
"migtest_e_softdelete",
|
||||
"migtest_e_user",
|
||||
"migtest_fk_cascade",
|
||||
"migtest_fk_cascade_one",
|
||||
"migtest_fk_none",
|
||||
"migtest_fk_none_via_join",
|
||||
"migtest_fk_one",
|
||||
"migtest_fk_set_null",
|
||||
"migtest_mtm_c",
|
||||
"migtest_mtm_m",
|
||||
"migtest_mtm_c_migtest_mtm_m",
|
||||
|
||||
@@ -4,6 +4,9 @@ import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.EbeanServer;
|
||||
import io.ebean.Query;
|
||||
import io.ebean.annotation.IgnorePlatform;
|
||||
import io.ebean.annotation.Platform;
|
||||
|
||||
import org.tests.model.basic.Contact;
|
||||
import org.tests.model.basic.Customer;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
@@ -17,13 +20,11 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
public class TestDeleteByQuery extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
@IgnorePlatform(Platform.MYSQL)
|
||||
// FIXME: MySql does not the sub query selecting from the delete table
|
||||
public void test() {
|
||||
|
||||
EbeanServer server = Ebean.getDefaultServer();
|
||||
if (server.getName().equals("mysql")) {
|
||||
// MySql does not the sub query selecting from the delete table
|
||||
return;
|
||||
}
|
||||
|
||||
Query<Contact> query = server.find(Contact.class).where().eq("group.name", "NahYeahMaybe").query();
|
||||
|
||||
|
||||
@@ -5,6 +5,9 @@ import io.ebean.Ebean;
|
||||
import io.ebean.SqlQuery;
|
||||
import io.ebean.SqlRow;
|
||||
import io.ebean.Version;
|
||||
import io.ebean.annotation.ForPlatform;
|
||||
import io.ebean.annotation.Platform;
|
||||
|
||||
import org.tests.model.converstation.User;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
@@ -20,12 +23,9 @@ public class TestHistoryInsert extends BaseTestCase {
|
||||
private final Logger logger = LoggerFactory.getLogger(TestHistoryInsert.class);
|
||||
|
||||
@Test
|
||||
@ForPlatform({Platform.H2, Platform.POSTGRES})
|
||||
public void test() throws InterruptedException {
|
||||
|
||||
if (!isH2() && !isPostgres()) {
|
||||
return;
|
||||
}
|
||||
|
||||
User user = new User();
|
||||
user.setName("Jim");
|
||||
user.setEmail("one@email.com");
|
||||
|
||||
@@ -7,7 +7,6 @@ import org.junit.Test;
|
||||
import org.tests.model.basic.Country;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class TestWhereIn extends BaseTestCase {
|
||||
|
||||
@@ -21,10 +20,7 @@ public class TestWhereIn extends BaseTestCase {
|
||||
.query();
|
||||
|
||||
query.findList();
|
||||
if (isPostgres()) {
|
||||
assertThat(sqlOf(query)).contains(" = any(");
|
||||
}
|
||||
|
||||
platformAssertIn(sqlOf(query), "");
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +34,6 @@ public class TestWhereIn extends BaseTestCase {
|
||||
.query();
|
||||
|
||||
query.findList();
|
||||
if (isPostgres()) {
|
||||
assertThat(sqlOf(query)).contains(" != all(");
|
||||
}
|
||||
platformAssertNotIn(sqlOf(query), "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,12 +7,16 @@ import io.ebean.Query;
|
||||
import io.ebean.RawSql;
|
||||
import io.ebean.RawSqlBuilder;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.annotation.ForPlatform;
|
||||
import io.ebean.annotation.Platform;
|
||||
|
||||
import org.tests.model.basic.Customer;
|
||||
import org.tests.model.basic.Order;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -40,16 +44,17 @@ public class TestRawSqlNamedParams extends BaseTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMySqlColonEquals() {
|
||||
|
||||
if (!isMySql()) {
|
||||
return;
|
||||
}
|
||||
@ForPlatform(Platform.MYSQL)
|
||||
public void testMySqlColonEquals() throws SQLException {
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
Transaction transaction = Ebean.beginTransaction();
|
||||
|
||||
try {
|
||||
if ("MariaDB connector/J".equals(transaction.getConnection().getMetaData().getDriverName())) {
|
||||
return; // MariaDb only supports callable statements in the form "? = call function x(?)"
|
||||
}
|
||||
CallableSql callableSql = Ebean.createCallableSql("set @total = 0");
|
||||
Ebean.execute(callableSql);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user