mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1631 - Change logging for SqlUpdate ... such that it is more consistent with other SQL logging wrt JDBC batch
This commit is contained in:
@@ -30,11 +30,11 @@ public class TestElementCollectionBasic extends BaseTestCase {
|
||||
|
||||
List<String> sql = LoggedSqlCollector.current();
|
||||
if (isPersistBatchOnCascade()) {
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql).hasSize(4);
|
||||
assertThat(sql.get(0)).contains("insert into ec_person");
|
||||
assertThat(sql.get(1)).contains("insert into ec_person_phone");
|
||||
}
|
||||
else {
|
||||
assertSqlBind(sql, 2, 3);
|
||||
} else {
|
||||
assertThat(sql).hasSize(3);
|
||||
assertThat(sql.get(0)).contains("insert into ec_person");
|
||||
assertThat(sql.get(1)).contains("insert into ec_person_phone");
|
||||
@@ -130,12 +130,13 @@ public class TestElementCollectionBasic extends BaseTestCase {
|
||||
|
||||
List<String> sql = LoggedSqlCollector.current();
|
||||
if (isPersistBatchOnCascade()) {
|
||||
assertThat(sql).hasSize(3);
|
||||
assertThat(sql).hasSize(6);
|
||||
assertThat(sql.get(0)).contains("update ec_person set name=?, version=? where id=? and version=?");
|
||||
assertThat(sql.get(1)).contains("delete from ec_person_phone where owner_id=?");
|
||||
assertThat(sql.get(2)).contains("insert into ec_person_phone (owner_id,phone) values (?,?)");
|
||||
}
|
||||
else {
|
||||
assertSqlBind(sql, 3, 5);
|
||||
|
||||
} else {
|
||||
assertThat(sql).hasSize(5);
|
||||
assertThat(sql.get(0)).contains("update ec_person set name=?, version=? where id=? and version=?");
|
||||
assertThat(sql.get(1)).contains("delete from ec_person_phone where owner_id=?");
|
||||
@@ -160,10 +161,12 @@ public class TestElementCollectionBasic extends BaseTestCase {
|
||||
}
|
||||
|
||||
List<String> sql = LoggedSqlCollector.current();
|
||||
assertThat(sql).hasSize(4);
|
||||
assertThat(sql).hasSize(9);
|
||||
assertThat(sql.get(0)).contains("update ec_person set name=?, version=? where id=? and version=?");
|
||||
assertThat(sql.get(2)).contains("delete from ec_person_phone where owner_id=?");
|
||||
assertThat(sql.get(3)).contains("insert into ec_person_phone (owner_id,phone) values (?,?)");
|
||||
assertSqlBind(sql, 3);
|
||||
assertThat(sql.get(4)).contains("insert into ec_person_phone (owner_id,phone) values (?,?)");
|
||||
assertSqlBind(sql, 5, 8);
|
||||
|
||||
assertThat(eventLog()).containsExactly("preUpdate", "postUpdate");
|
||||
|
||||
@@ -192,9 +195,11 @@ public class TestElementCollectionBasic extends BaseTestCase {
|
||||
}
|
||||
|
||||
List<String> sql = LoggedSqlCollector.current();
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql).hasSize(8);
|
||||
assertThat(sql.get(0)).contains("delete from ec_person_phone where owner_id=?");
|
||||
assertThat(sql.get(1)).contains("insert into ec_person_phone (owner_id,phone) values (?,?)");
|
||||
assertSqlBind(sql, 1);
|
||||
assertThat(sql.get(2)).contains("insert into ec_person_phone (owner_id,phone) values (?,?)");
|
||||
assertSqlBind(sql, 3, 7);
|
||||
|
||||
assertThat(eventLog()).containsExactly("preUpdate", "postUpdate");
|
||||
|
||||
@@ -208,11 +213,12 @@ public class TestElementCollectionBasic extends BaseTestCase {
|
||||
|
||||
List<String> sql = LoggedSqlCollector.current();
|
||||
if (isPersistBatchOnCascade()) {
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql).hasSize(8);
|
||||
assertThat(sql.get(0)).contains("delete from ec_person_phone where owner_id=?");
|
||||
assertThat(sql.get(1)).contains("insert into ec_person_phone (owner_id,phone) values (?,?)");
|
||||
}
|
||||
else {
|
||||
assertSqlBind(sql, 2, 7);
|
||||
|
||||
} else {
|
||||
assertThat(sql).hasSize(7);
|
||||
assertThat(sql.get(0)).contains("delete from ec_person_phone where owner_id=?");
|
||||
assertThat(sql.get(1)).contains("insert into ec_person_phone (owner_id,phone) values (?,?)");
|
||||
|
||||
Reference in New Issue
Block a user