mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#3354 Use 4000 for DB Lob detection with distinct query
- Use 4000 to match the DB2 logic for considering a column a lob (for distinct etc) - Rename distinctNoLobs -> platformDistinctNoLobs - Rename isDbLob() -> isLobForPlatform() - Rename unselectLobs() -> unselectLobsForPlatform()
This commit is contained in:
@@ -1182,14 +1182,14 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
* Returns true if this <code>isLob()</code> or the type will effectively map to a lob.
|
||||
*/
|
||||
@Override
|
||||
public boolean isDbLob() {
|
||||
public boolean isLobForPlatform() {
|
||||
if (lob) {
|
||||
return true;
|
||||
}
|
||||
switch (dbType) {
|
||||
case DbPlatformType.JSON:
|
||||
case DbPlatformType.JSONB:
|
||||
return dbLength == 0 || dbLength > 255; // must be analog to DbPlatformTypeMapping.lookup
|
||||
return dbLength == 0 || dbLength > 4000; // must be analog to DbPlatformTypeMapping.lookup
|
||||
case DbPlatformType.JSONBlob:
|
||||
case DbPlatformType.JSONClob:
|
||||
return true;
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ class DynamicPropertyAggregationFormula extends DynamicPropertyBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDbLob() {
|
||||
public boolean isLobForPlatform() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public interface STreeProperty extends ScalarDataReader<Object> {
|
||||
/**
|
||||
* Returns true, if this is a lob property from db-perspective.
|
||||
*/
|
||||
boolean isDbLob();
|
||||
boolean isLobForPlatform();
|
||||
|
||||
/**
|
||||
* Return true if the property is an embedded type.
|
||||
|
||||
@@ -48,7 +48,7 @@ public final class SqlTreeBuilder {
|
||||
private final SpiQuery.TemporalMode temporalMode;
|
||||
private SqlTreeNode rootNode;
|
||||
private boolean sqlDistinct;
|
||||
private final boolean distinctNoLobs;
|
||||
private final boolean platformDistinctNoLobs;
|
||||
private final SqlTreeCommon common;
|
||||
|
||||
/**
|
||||
@@ -63,7 +63,7 @@ public final class SqlTreeBuilder {
|
||||
this.query = null;
|
||||
this.subQuery = false;
|
||||
this.distinctOnPlatform = false;
|
||||
this.distinctNoLobs = false;
|
||||
this.platformDistinctNoLobs = false;
|
||||
this.queryDetail = queryDetail;
|
||||
this.predicates = predicates;
|
||||
this.temporalMode = SpiQuery.TemporalMode.CURRENT;
|
||||
@@ -98,7 +98,7 @@ public final class SqlTreeBuilder {
|
||||
this.predicates = predicates;
|
||||
this.alias = new SqlTreeAlias(request.baseTableAlias(), temporalMode);
|
||||
this.distinctOnPlatform = builder.isPlatformDistinctOn();
|
||||
this.distinctNoLobs = builder.isPlatformDistinctNoLobs();
|
||||
this.platformDistinctNoLobs = builder.isPlatformDistinctNoLobs();
|
||||
String fromForUpdate = builder.fromForUpdate(query);
|
||||
CQueryHistorySupport historySupport = builder.historySupport(query);
|
||||
CQueryDraftSupport draftSupport = builder.draftSupport(query);
|
||||
@@ -269,8 +269,8 @@ public final class SqlTreeBuilder {
|
||||
if (joinList != null) {
|
||||
joinList.add(selectNode);
|
||||
}
|
||||
if (sqlDistinct && distinctNoLobs) {
|
||||
selectNode.unselectLobs();
|
||||
if (sqlDistinct && platformDistinctNoLobs) {
|
||||
selectNode.unselectLobsForPlatform();
|
||||
}
|
||||
return selectNode;
|
||||
}
|
||||
|
||||
@@ -82,6 +82,6 @@ interface SqlTreeNode {
|
||||
/**
|
||||
* Unselect lobs (for distinct queries on DB2 and Oracle).
|
||||
*/
|
||||
default void unselectLobs() {
|
||||
default void unselectLobsForPlatform() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,16 +379,16 @@ class SqlTreeNodeBean implements SqlTreeNode {
|
||||
|
||||
|
||||
@Override
|
||||
public void unselectLobs() {
|
||||
public void unselectLobsForPlatform() {
|
||||
if (children != null) {
|
||||
for (SqlTreeNode child : children) {
|
||||
child.unselectLobs();
|
||||
child.unselectLobsForPlatform();
|
||||
}
|
||||
}
|
||||
if (hasLob()) {
|
||||
List<STreeProperty> lst = new ArrayList<>();
|
||||
for (STreeProperty prop : properties) {
|
||||
if (!prop.isDbLob()) {
|
||||
if (!prop.isLobForPlatform()) {
|
||||
lst.add(prop);
|
||||
}
|
||||
}
|
||||
@@ -399,7 +399,7 @@ class SqlTreeNodeBean implements SqlTreeNode {
|
||||
|
||||
private boolean hasLob() {
|
||||
for (STreeProperty prop : properties) {
|
||||
if (prop.isDbLob()) {
|
||||
if (prop.isLobForPlatform()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user