mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-12 22:41:35 +00:00
#2436 - SQL Update doesn't handle named parameters for array types in Postgres
This commit is contained in:
1 parent
9af64f61f7
commit
07f9bf98c3
10 files changed
+80
-5
No files matched your search
@@ -208,19 +208,33 @@ public class DtoQueryTest extends BaseTestCase {
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
LoggedSql.start();
|
||||
List<Integer> ids = Arrays.asList(1, 2);
|
||||
|
||||
List<DCust> list = server().findDto(DCust.class, "select id, name from o_customer where id = any(?)")
|
||||
List<DCust> list = DB.findDto(DCust.class, "select id, name from o_customer where id = any(?)")
|
||||
.setParameter(ids)
|
||||
.findList();
|
||||
|
||||
assertThat(list).isNotEmpty();
|
||||
|
||||
list = server().findDto(DCust.class, "select id, name from o_customer where id in (:idList)")
|
||||
List<DCust> list1 = DB.findDto(DCust.class, "select id, name from o_customer where id in (:idList)")
|
||||
.setParameter("idList", ids)
|
||||
.findList();
|
||||
|
||||
assertThat(list).isNotEmpty();
|
||||
assertThat(list1).isNotEmpty();
|
||||
|
||||
|
||||
List<DCust> list2 = DB.findDto(DCust.class, "select id, name from o_customer where id = any(:idList)")
|
||||
.setArrayParameter("idList", ids)
|
||||
.findList();
|
||||
|
||||
assertThat(list2).isNotEmpty();
|
||||
|
||||
List<String> sql = LoggedSql.stop();
|
||||
assertThat(sql).hasSize(3);
|
||||
assertThat(sql.get(0)).contains(" id = any(?)");
|
||||
assertThat(sql.get(1)).contains(" id in (?,?)");
|
||||
assertThat(sql.get(2)).contains(" id = any(?)");
|
||||
}
|
||||
|
||||
@ForPlatform(Platform.POSTGRES)
|
||||
|
||||
@@ -335,7 +335,7 @@ public class TestDbArray_basic extends BaseTestCase {
|
||||
// javax.persistence.PersistenceException:
|
||||
// ERROR: syntax error at or near "$2"
|
||||
SqlUpdate update2 = DB.sqlUpdate("UPDATE earray_bean SET phone_numbers = :pns")
|
||||
.setParameter("pns", phNumbers);
|
||||
.setArrayParameter("pns", phNumbers);
|
||||
update2.execute();
|
||||
|
||||
found = DB.find(EArrayBean.class, bean.getId());
|
||||
|
||||
Reference in new issue
Block a user