From c96357377b43c5a5081eafe290b5b40416041e79 Mon Sep 17 00:00:00 2001
From: Marcus Dunn <51931484+MarcusDunn@users.noreply.github.com>
Date: Fri, 4 Nov 2022 11:56:48 -0700
Subject: [PATCH 1/5] Added platforms to BOM
fixes #2884
I'm a complete maven (especially bom) novice - but thought I could take a stab at making the change.
I also see you auto generate these with an action, is there anything needed there?
Feel free to completely disregard if this or the issue itself is way off the mark.
---
ebean-bom/pom.xml | 86 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 86 insertions(+)
diff --git a/ebean-bom/pom.xml b/ebean-bom/pom.xml
index a17609672..43bb2f5f0 100644
--- a/ebean-bom/pom.xml
+++ b/ebean-bom/pom.xml
@@ -190,6 +190,92 @@
ebean-redis
13.10.2-SNAPSHOT
+
+
+
+
+ io.ebean
+ ebean-all
+ 13.10.2-SNAPSHOT
+
+
+
+ io.ebean
+ ebean-clickhouse
+ 13.10.2-SNAPSHOT
+
+
+
+ io.ebean
+ ebean-db2
+ 13.10.2-SNAPSHOT
+
+
+
+ io.ebean
+ ebean-h2
+ 13.10.2-SNAPSHOT
+
+
+
+ io.ebean
+ ebean-hana
+ 13.10.2-SNAPSHOT
+
+
+
+ io.ebean
+ ebean-hsqldb
+ 13.10.2-SNAPSHOT
+
+
+
+ io.ebean
+ ebean-mariadb
+ 13.10.2-SNAPSHOT
+
+
+
+ io.ebean
+ ebean-mysql
+ 13.10.2-SNAPSHOT
+
+
+
+ io.ebean
+ ebean-nuodb
+ 13.10.2-SNAPSHOT
+
+
+
+ io.ebean
+ ebean-oracle
+ 13.10.2-SNAPSHOT
+
+
+
+ io.ebean
+ ebean-postgres
+ 13.10.2-SNAPSHOT
+
+
+
+ io.ebean
+ ebean-sqlanywhere
+ 13.10.2-SNAPSHOT
+
+
+
+ io.ebean
+ ebean-sqlite
+ 13.10.2-SNAPSHOT
+
+
+
+ io.ebean
+ ebean-sqlserver
+ 13.10.2-SNAPSHOT
+
From 14dddb486648303bbe76de47684680646778a1eb Mon Sep 17 00:00:00 2001
From: Rob Bygrave
Date: Mon, 7 Nov 2022 22:25:32 +1300
Subject: [PATCH 2/5] #2774 - Postgres ANY / MultiValueSupport with
byte[]/binary data
Add Postgres specific support for binding an array of byte[] with ANY(?)
which is used as with client side encryption where the bind values are
implicitly converted to byte[].
Fixes Postgres specific failure running TestEncryptClientSide.java
---
.../server/expression/InExpression.java | 8 ++-----
.../platform/AbstractMultiValueBind.java | 22 +++----------------
.../persist/platform/MultiValueBind.java | 8 +++++++
3 files changed, 13 insertions(+), 25 deletions(-)
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/expression/InExpression.java b/ebean-core/src/main/java/io/ebeaninternal/server/expression/InExpression.java
index 7ec81687b..d0d89b9ff 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/expression/InExpression.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/expression/InExpression.java
@@ -95,7 +95,7 @@ public final class InExpression extends AbstractExpression implements IdInCommon
public void prepareExpression(BeanQueryRequest> request) {
initBindValues();
if (bindValues.size() > 0) {
- multiValueSupported = request.isMultiValueSupported((bindValues.get(0)).getClass());
+ multiValueSupported = request.isMultiValueSupported(bindValues.get(0).getClass());
}
}
@@ -149,7 +149,6 @@ public final class InExpression extends AbstractExpression implements IdInCommon
// if we have no property, we wrap them in a multi value wrapper.
// later the binder will decide, which bind strategy to use.
request.addBindValue(new MultiValueWrapper(values));
-
}
@Override
@@ -164,7 +163,6 @@ public final class InExpression extends AbstractExpression implements IdInCommon
}
ElPropertyValue prop = getElProp(request);
-
if (prop != null) {
if (prop.isAssocId()) {
request.append(prop.assocIdInExpr(propName));
@@ -172,15 +170,13 @@ public final class InExpression extends AbstractExpression implements IdInCommon
return;
}
if (prop.isDbEncrypted()) {
- String dsql = prop.beanProperty().decryptProperty(propName);
- request.append(dsql);
+ request.append(prop.beanProperty().decryptProperty(propName));
request.appendInExpression(not, bindValues);
return;
}
}
request.append(propName);
request.appendInExpression(not, bindValues);
-
}
/**
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/persist/platform/AbstractMultiValueBind.java b/ebean-core/src/main/java/io/ebeaninternal/server/persist/platform/AbstractMultiValueBind.java
index 18d41b757..5dd334ac5 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/persist/platform/AbstractMultiValueBind.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/persist/platform/AbstractMultiValueBind.java
@@ -7,25 +7,7 @@ import io.ebeaninternal.server.bind.DataBind;
import java.sql.SQLException;
import java.util.Collection;
-import static java.sql.Types.BIGINT;
-import static java.sql.Types.BIT;
-import static java.sql.Types.BOOLEAN;
-import static java.sql.Types.CHAR;
-import static java.sql.Types.DATE;
-import static java.sql.Types.DECIMAL;
-import static java.sql.Types.DOUBLE;
-import static java.sql.Types.FLOAT;
-import static java.sql.Types.INTEGER;
-import static java.sql.Types.NCHAR;
-import static java.sql.Types.NUMERIC;
-import static java.sql.Types.NVARCHAR;
-import static java.sql.Types.REAL;
-import static java.sql.Types.SMALLINT;
-import static java.sql.Types.TIMESTAMP;
-import static java.sql.Types.TIMESTAMP_WITH_TIMEZONE;
-import static java.sql.Types.TIME_WITH_TIMEZONE;
-import static java.sql.Types.TINYINT;
-import static java.sql.Types.VARCHAR;
+import static java.sql.Types.*;
/**
* Base MultiValueBind for platform specific support.
@@ -86,6 +68,8 @@ abstract class AbstractMultiValueBind extends MultiValueBind {
case ExtraDbTypes.UUID: // Postgres cast to uuid[]
case ExtraDbTypes.INET: // Postgres cast to inet[]
return "varchar";
+ case VARBINARY:
+ return "bytea";
default:
return null;
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/persist/platform/MultiValueBind.java b/ebean-core/src/main/java/io/ebeaninternal/server/persist/platform/MultiValueBind.java
index db47defcf..aca6ea2b1 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/persist/platform/MultiValueBind.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/persist/platform/MultiValueBind.java
@@ -17,6 +17,14 @@ public class MultiValueBind {
}
Object[] toArray(Collection> values, ScalarType> type) {
+ if (type.binary()) {
+ byte[][] array = new byte[values.size()][];
+ int i = 0;
+ for (Object value : values) {
+ array[i++] = (byte[])type.toJdbcType(value);
+ }
+ return array;
+ }
Object[] array = new Object[values.size()];
int i = 0;
for (Object value : values) {
From 8966faeb7e5f0c1329a1719fca3c90c9c06fc3d1 Mon Sep 17 00:00:00 2001
From: Rob Bygrave
Date: Tue, 8 Nov 2022 09:33:09 +1300
Subject: [PATCH 3/5] #2774 - Postgres ANY / MultiValueSupport with
byte[]/binary data
Tidy up MultiValueBind.toArray() only
---
.../server/persist/platform/MultiValueBind.java | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/persist/platform/MultiValueBind.java b/ebean-core/src/main/java/io/ebeaninternal/server/persist/platform/MultiValueBind.java
index aca6ea2b1..941614ec1 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/persist/platform/MultiValueBind.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/persist/platform/MultiValueBind.java
@@ -17,15 +17,7 @@ public class MultiValueBind {
}
Object[] toArray(Collection> values, ScalarType> type) {
- if (type.binary()) {
- byte[][] array = new byte[values.size()][];
- int i = 0;
- for (Object value : values) {
- array[i++] = (byte[])type.toJdbcType(value);
- }
- return array;
- }
- Object[] array = new Object[values.size()];
+ Object[] array = type.binary() ? new byte[values.size()][] : new Object[values.size()];
int i = 0;
for (Object value : values) {
array[i++] = type.toJdbcType(value);
From b1bba9da5d1f98e33ca2a962132237fe233fda4f Mon Sep 17 00:00:00 2001
From: Rob Bygrave
Date: Tue, 8 Nov 2022 11:12:46 +1300
Subject: [PATCH 4/5] #2774 - Tidy InExpression adding check and block for prop
!= null wrt prop.isDbEncrypted() and prop.isLocalEncrypted()
---
.../server/expression/InExpression.java | 37 ++++++++-----------
1 file changed, 16 insertions(+), 21 deletions(-)
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/expression/InExpression.java b/ebean-core/src/main/java/io/ebeaninternal/server/expression/InExpression.java
index d0d89b9ff..127f849e9 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/expression/InExpression.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/expression/InExpression.java
@@ -14,17 +14,13 @@ import java.util.*;
public final class InExpression extends AbstractExpression implements IdInCommon {
- private final boolean not;
-
/**
* Set to true when adding "1=1" predicate (due to null or empty sourceValues).
*/
private final boolean empty;
-
+ private final boolean not;
private final Collection> sourceValues;
-
private List