DB2:Unselect LOBs when making a distinct select

This commit is contained in:
Noemi Szemenyei authored and Roland Praml committed 2022-01-27 08:34:51 +01:00
1 parent b9ba6b2db5
commit 69a753fc4f
6 files changed
+85 -12

No files matched your search

@@ -1160,7 +1160,26 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
public boolean isLob() {
return lob;
}
/**
* Returns true if this <code>isLob()</code> or the type will effectively map to a lob.
*/
public boolean isDbLob() {
if (lob) {
return true;
}
switch (dbType) {
case DbPlatformType.JSON:
case DbPlatformType.JSONB:
return dbLength == 0; // must be analog to DbPlatformTypeMapping.lookup
case DbPlatformType.JSONBlob:
case DbPlatformType.JSONClob:
return true;
default:
return false;
}
}
public static boolean isLobType(int type) {
switch (type) {
case Types.CLOB:
@@ -62,4 +62,9 @@ class DynamicPropertyAggregationFormula extends DynamicPropertyBase {
ctx.appendParseSelect(parsedFormula, alias);
}
@Override
public boolean isDbLob() {
return false;
}
}
@@ -760,6 +760,10 @@ final class CQueryBuilder {
return dbPlatform.isPlatform(Platform.POSTGRES);
}
boolean isPlatformDistinctNoLobs() {
return dbPlatform.isPlatform(Platform.DB2); // CHECKME: Also oracle?
}
/**
* Return the 'for update' FROM hint (sql server).
*/
@@ -28,6 +28,11 @@ public interface STreeProperty extends ScalarDataReader<Object> {
* Return true if the property is the Id.
*/
boolean isId();
/**
* Returns true, if this is a lob property from db-perspective.
*/
boolean isDbLob();
/**
* Return true if the property is an embedded type.
@@ -78,6 +78,10 @@ interface SqlTreeNode {
* Create the loader for this node.
*/
SqlTreeLoad createLoad();
default void unselectLobs() {};
/**
* Unselect lobs (for distinct queries on DB2 and Oracle).
*/
default void unselectLobs() {
};
}