#1205 - ENH: Add support for raw expression array binding with Postgres - e.g. raw(" foo = any(?) ", collection)

This commit is contained in:
Rob Bygrave
2017-11-08 00:56:13 +13:00
parent e68dae0baa
commit 9b2b2f7787
2 changed files with 32 additions and 1 deletions
@@ -4,12 +4,17 @@ import io.ebean.BaseTestCase;
import io.ebean.Ebean;
import io.ebean.Expr;
import io.ebean.Query;
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.OrderDetail;
import org.tests.model.basic.ResetBasicData;
import org.junit.Test;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
@@ -45,6 +50,25 @@ public class TestWhereRawClause extends BaseTestCase {
}
@Test
@ForPlatform(Platform.POSTGRES)
public void testRawPostgresArray() {
ResetBasicData.reset();
List<String> names = new ArrayList<>();
names.add("Rob");
names.add("Fiona");
List<Customer> list = Ebean.find(Customer.class)
.where()
.raw("name = any(?)", names)
.findList();
assertThat(list).isNotEmpty();
}
@Test
public void testRawWithBindParams() {