mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix for ALF-19901 Metadata query CMIS QL queries need to do outer joins for "is null" and "order by"
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@55121 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -16,23 +16,23 @@
|
|||||||
<foreach item="item" index="index" collection="joins">
|
<foreach item="item" index="index" collection="joins">
|
||||||
<choose>
|
<choose>
|
||||||
<when test="item.type == 'PARENT'">
|
<when test="item.type == 'PARENT'">
|
||||||
join alf_child_assoc ${item.alias} on (${item.alias}.child_node_id = node.id)
|
<if test="item.outer">left outer </if>join alf_child_assoc ${item.alias} on (${item.alias}.child_node_id = node.id)
|
||||||
</when>
|
</when>
|
||||||
<when test="item.type == 'PROPERTY'">
|
<when test="item.type == 'PROPERTY'">
|
||||||
join alf_node_properties ${item.alias} on ((${item.alias}.node_id = node.id) AND (#{item.qnameId} = ${item.alias}.qname_id))
|
<if test="item.outer">left outer </if>join alf_node_properties ${item.alias} on ((${item.alias}.node_id = node.id) AND (#{item.qnameId} = ${item.alias}.qname_id))
|
||||||
</when>
|
</when>
|
||||||
<when test="item.type == 'CONTENT_MIMETYPE'">
|
<when test="item.type == 'CONTENT_MIMETYPE'">
|
||||||
join alf_node_properties ${item.alias}_p on ((${item.alias}_p.node_id = node.id) AND (#{item.qnameId} = ${item.alias}_p.qname_id))
|
<if test="item.outer">left outer </if>join alf_node_properties ${item.alias}_p on ((${item.alias}_p.node_id = node.id) AND (#{item.qnameId} = ${item.alias}_p.qname_id))
|
||||||
join alf_content_data ${item.alias}_cd on (${item.alias}_cd.id = ${item.alias}_p.long_value)
|
<if test="item.outer">left outer </if>join alf_content_data ${item.alias}_cd on (${item.alias}_cd.id = ${item.alias}_p.long_value)
|
||||||
join alf_mimetype ${item.alias} on (${item.alias}_cd.content_mimetype_id = ${item.alias}.id)
|
<if test="item.outer">left outer </if>join alf_mimetype ${item.alias} on (${item.alias}_cd.content_mimetype_id = ${item.alias}.id)
|
||||||
</when>
|
</when>
|
||||||
<when test="item.type == 'CONTENT_URL'">
|
<when test="item.type == 'CONTENT_URL'">
|
||||||
join alf_node_properties ${item.alias}_p on ((${item.alias}_p.node_id = node.id) AND (#{item.qnameId} = ${item.alias}_p.qname_id))
|
<if test="item.outer">left outer </if>join alf_node_properties ${item.alias}_p on ((${item.alias}_p.node_id = node.id) AND (#{item.qnameId} = ${item.alias}_p.qname_id))
|
||||||
join alf_content_data ${item.alias}_cd on (${item.alias}_cd.id = ${item.alias}_p.long_value)
|
<if test="item.outer">left outer </if>join alf_content_data ${item.alias}_cd on (${item.alias}_cd.id = ${item.alias}_p.long_value)
|
||||||
join alf_content_url ${item.alias} on (${item.alias}.id = ${item.alias}_cd.content_url_id)
|
<if test="item.outer">left outer </if>join alf_content_url ${item.alias} on (${item.alias}.id = ${item.alias}_cd.content_url_id)
|
||||||
</when>
|
</when>
|
||||||
<when test="item.type == 'ASPECT'">
|
<when test="item.type == 'ASPECT'">
|
||||||
join alf_node_aspects ${item.alias} on (${item.alias}.node_id = node.id)
|
<if test="item.outer">left outer </if>join alf_node_aspects ${item.alias} on (${item.alias}.node_id = node.id)
|
||||||
</when>
|
</when>
|
||||||
</choose>
|
</choose>
|
||||||
</foreach>
|
</foreach>
|
||||||
|
@@ -114,6 +114,7 @@ public class DBOrdering extends BaseOrdering implements DBQueryBuilderComponent
|
|||||||
propertySupport.setJoinCommandType(DBQueryBuilderJoinCommandType.CONTENT_MIMETYPE);
|
propertySupport.setJoinCommandType(DBQueryBuilderJoinCommandType.CONTENT_MIMETYPE);
|
||||||
propertySupport.setFieldName("mimetype_str");
|
propertySupport.setFieldName("mimetype_str");
|
||||||
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.ORDER);
|
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.ORDER);
|
||||||
|
propertySupport.setLeftOuter(true);
|
||||||
builderSupport = propertySupport;
|
builderSupport = propertySupport;
|
||||||
}
|
}
|
||||||
else if (property.getPropertyName().equals(PropertyIds.CONTENT_STREAM_LENGTH))
|
else if (property.getPropertyName().equals(PropertyIds.CONTENT_STREAM_LENGTH))
|
||||||
@@ -134,6 +135,7 @@ public class DBOrdering extends BaseOrdering implements DBQueryBuilderComponent
|
|||||||
propertySupport.setJoinCommandType(DBQueryBuilderJoinCommandType.CONTENT_URL);
|
propertySupport.setJoinCommandType(DBQueryBuilderJoinCommandType.CONTENT_URL);
|
||||||
propertySupport.setFieldName("content_size");
|
propertySupport.setFieldName("content_size");
|
||||||
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.ORDER);
|
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.ORDER);
|
||||||
|
propertySupport.setLeftOuter(true);
|
||||||
builderSupport = propertySupport;
|
builderSupport = propertySupport;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -153,6 +155,7 @@ public class DBOrdering extends BaseOrdering implements DBQueryBuilderComponent
|
|||||||
propertySupport.setJoinCommandType(DBQuery.getJoinCommandType(propertyQName));
|
propertySupport.setJoinCommandType(DBQuery.getJoinCommandType(propertyQName));
|
||||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName));
|
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName));
|
||||||
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.ORDER);
|
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.ORDER);
|
||||||
|
propertySupport.setLeftOuter(true);
|
||||||
builderSupport = propertySupport;
|
builderSupport = propertySupport;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -40,6 +40,8 @@ public class ParentSupport implements DBQueryBuilderComponent
|
|||||||
|
|
||||||
DBQueryBuilderPredicatePartCommandType commandType;
|
DBQueryBuilderPredicatePartCommandType commandType;
|
||||||
|
|
||||||
|
private boolean leftOuter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param dbid
|
* @param dbid
|
||||||
* the dbid to set
|
* the dbid to set
|
||||||
@@ -103,7 +105,7 @@ public class ParentSupport implements DBQueryBuilderComponent
|
|||||||
DBQueryBuilderJoinCommand join = new DBQueryBuilderJoinCommand();
|
DBQueryBuilderJoinCommand join = new DBQueryBuilderJoinCommand();
|
||||||
alias = "PARENT_" + multiJoins.size();
|
alias = "PARENT_" + multiJoins.size();
|
||||||
join.setAlias(alias);
|
join.setAlias(alias);
|
||||||
join.setOuter(false);
|
join.setOuter(leftOuter);
|
||||||
join.setType(DBQueryBuilderJoinCommandType.PARENT);
|
join.setType(DBQueryBuilderJoinCommandType.PARENT);
|
||||||
multiJoins.add(join);
|
multiJoins.add(join);
|
||||||
|
|
||||||
@@ -128,4 +130,12 @@ public class ParentSupport implements DBQueryBuilderComponent
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param leftOuter
|
||||||
|
*/
|
||||||
|
public void setLeftOuter(boolean leftOuter)
|
||||||
|
{
|
||||||
|
this.leftOuter = leftOuter;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -59,6 +59,8 @@ public class PropertySupport implements DBQueryBuilderComponent
|
|||||||
|
|
||||||
LuceneFunction luceneFunction;
|
LuceneFunction luceneFunction;
|
||||||
|
|
||||||
|
private boolean leftOuter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param pair
|
* @param pair
|
||||||
* the pair to set
|
* the pair to set
|
||||||
@@ -171,7 +173,7 @@ public class PropertySupport implements DBQueryBuilderComponent
|
|||||||
join = new DBQueryBuilderJoinCommand();
|
join = new DBQueryBuilderJoinCommand();
|
||||||
alias = "PROP_" + singleJoins.size();
|
alias = "PROP_" + singleJoins.size();
|
||||||
join.setAlias(alias);
|
join.setAlias(alias);
|
||||||
join.setOuter(false);
|
join.setOuter(leftOuter);
|
||||||
join.setType(joinCommandType);
|
join.setType(joinCommandType);
|
||||||
join.setQnameId(pair.getFirst());
|
join.setQnameId(pair.getFirst());
|
||||||
singleJoins.put(propertyQName, join);
|
singleJoins.put(propertyQName, join);
|
||||||
@@ -185,6 +187,10 @@ public class PropertySupport implements DBQueryBuilderComponent
|
|||||||
if(join != null)
|
if(join != null)
|
||||||
{
|
{
|
||||||
alias = join.getAlias();
|
alias = join.getAlias();
|
||||||
|
if(leftOuter)
|
||||||
|
{
|
||||||
|
join.setOuter(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,14 +307,25 @@ public class PropertySupport implements DBQueryBuilderComponent
|
|||||||
case CONTENT_MIMETYPE:
|
case CONTENT_MIMETYPE:
|
||||||
command.setAlias(alias);
|
command.setAlias(alias);
|
||||||
command.setType(commandType);
|
command.setType(commandType);
|
||||||
|
|
||||||
|
// Good for order and predicates
|
||||||
command.setValue(value);
|
command.setValue(value);
|
||||||
command.setValues(values);
|
command.setValues(values);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case CONTENT_URL:
|
case CONTENT_URL:
|
||||||
command.setAlias(alias);
|
command.setAlias(alias);
|
||||||
command.setType(commandType);
|
command.setType(commandType);
|
||||||
command.setValue(DefaultTypeConverter.INSTANCE.convert(Integer.class, value));
|
if(commandType == DBQueryBuilderPredicatePartCommandType.ORDER)
|
||||||
command.setValues(values == null ? null : DefaultTypeConverter.INSTANCE.convert(Integer.class, Arrays.asList(values)).toArray(new Integer[]{}));
|
{
|
||||||
|
command.setValue(value);
|
||||||
|
command.setValues(values);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
command.setValue(DefaultTypeConverter.INSTANCE.convert(Long.class, value));
|
||||||
|
command.setValues(values == null ? null : DefaultTypeConverter.INSTANCE.convert(Integer.class, Arrays.asList(values)).toArray(new Integer[]{}));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
command.setType(commandType.propertyNotFound());
|
command.setType(commandType.propertyNotFound());
|
||||||
@@ -333,4 +350,12 @@ public class PropertySupport implements DBQueryBuilderComponent
|
|||||||
this.luceneFunction = luceneFunction;
|
this.luceneFunction = luceneFunction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param leftOuter
|
||||||
|
*/
|
||||||
|
public void setLeftOuter(boolean leftOuter)
|
||||||
|
{
|
||||||
|
this.leftOuter = leftOuter;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -37,6 +37,8 @@ public class TypeSupport implements DBQueryBuilderComponent
|
|||||||
|
|
||||||
DBQueryBuilderPredicatePartCommandType commandType;
|
DBQueryBuilderPredicatePartCommandType commandType;
|
||||||
|
|
||||||
|
private boolean leftOuter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param qnameIds
|
* @param qnameIds
|
||||||
* the qnameIds to set
|
* the qnameIds to set
|
||||||
@@ -117,4 +119,12 @@ public class TypeSupport implements DBQueryBuilderComponent
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param leftOuter
|
||||||
|
*/
|
||||||
|
public void setLeftOuter(boolean leftOuter)
|
||||||
|
{
|
||||||
|
this.leftOuter = leftOuter;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -43,6 +43,8 @@ public class UUIDSupport implements DBQueryBuilderComponent
|
|||||||
|
|
||||||
DBQueryBuilderPredicatePartCommandType commandType;
|
DBQueryBuilderPredicatePartCommandType commandType;
|
||||||
|
|
||||||
|
private boolean leftOuter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param uud the uud to set
|
* @param uud the uud to set
|
||||||
*/
|
*/
|
||||||
@@ -130,4 +132,12 @@ public class UUIDSupport implements DBQueryBuilderComponent
|
|||||||
predicatePartCommands.add(command);
|
predicatePartCommands.add(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param leftOuter
|
||||||
|
*/
|
||||||
|
public void setLeftOuter(boolean leftOuter)
|
||||||
|
{
|
||||||
|
this.leftOuter = leftOuter;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -84,6 +84,7 @@ public class DBExists extends Exists implements DBQueryBuilderComponent
|
|||||||
if ((not != null) && (not.equals(Boolean.TRUE)))
|
if ((not != null) && (not.equals(Boolean.TRUE)))
|
||||||
{
|
{
|
||||||
parentSupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTEXISTS);
|
parentSupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTEXISTS);
|
||||||
|
parentSupport.setLeftOuter(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -97,6 +98,7 @@ public class DBExists extends Exists implements DBQueryBuilderComponent
|
|||||||
if ((not != null) && (not.equals(Boolean.TRUE)))
|
if ((not != null) && (not.equals(Boolean.TRUE)))
|
||||||
{
|
{
|
||||||
uuidSupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTEXISTS);
|
uuidSupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTEXISTS);
|
||||||
|
uuidSupport.setLeftOuter(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -110,6 +112,7 @@ public class DBExists extends Exists implements DBQueryBuilderComponent
|
|||||||
if ((not != null) && (not.equals(Boolean.TRUE)))
|
if ((not != null) && (not.equals(Boolean.TRUE)))
|
||||||
{
|
{
|
||||||
typeSupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTEXISTS);
|
typeSupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTEXISTS);
|
||||||
|
typeSupport.setLeftOuter(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -123,6 +126,7 @@ public class DBExists extends Exists implements DBQueryBuilderComponent
|
|||||||
if ((not != null) && (not.equals(Boolean.TRUE)))
|
if ((not != null) && (not.equals(Boolean.TRUE)))
|
||||||
{
|
{
|
||||||
typeSupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTEXISTS);
|
typeSupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTEXISTS);
|
||||||
|
typeSupport.setLeftOuter(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -143,6 +147,7 @@ public class DBExists extends Exists implements DBQueryBuilderComponent
|
|||||||
if ((not != null) && (not.equals(Boolean.TRUE)))
|
if ((not != null) && (not.equals(Boolean.TRUE)))
|
||||||
{
|
{
|
||||||
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTEXISTS);
|
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTEXISTS);
|
||||||
|
propertySupport.setLeftOuter(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -163,6 +168,7 @@ public class DBExists extends Exists implements DBQueryBuilderComponent
|
|||||||
if ((not != null) && (not.equals(Boolean.TRUE)))
|
if ((not != null) && (not.equals(Boolean.TRUE)))
|
||||||
{
|
{
|
||||||
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTEXISTS);
|
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTEXISTS);
|
||||||
|
propertySupport.setLeftOuter(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -183,6 +189,7 @@ public class DBExists extends Exists implements DBQueryBuilderComponent
|
|||||||
if ((not != null) && (not.equals(Boolean.TRUE)))
|
if ((not != null) && (not.equals(Boolean.TRUE)))
|
||||||
{
|
{
|
||||||
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTEXISTS);
|
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTEXISTS);
|
||||||
|
propertySupport.setLeftOuter(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -51,6 +51,8 @@ import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
|||||||
import org.alfresco.service.ServiceRegistry;
|
import org.alfresco.service.ServiceRegistry;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
import org.alfresco.service.cmr.repository.ContentData;
|
import org.alfresco.service.cmr.repository.ContentData;
|
||||||
|
import org.alfresco.service.cmr.repository.ContentService;
|
||||||
|
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||||
import org.alfresco.service.cmr.repository.MLText;
|
import org.alfresco.service.cmr.repository.MLText;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
@@ -182,6 +184,8 @@ public class DBQueryTest implements DictionaryListener
|
|||||||
|
|
||||||
private String midOrderDate;
|
private String midOrderDate;
|
||||||
|
|
||||||
|
private ContentService contentService;
|
||||||
|
|
||||||
protected static void startContext()
|
protected static void startContext()
|
||||||
{
|
{
|
||||||
ctx = ApplicationContextHelper.getApplicationContext();
|
ctx = ApplicationContextHelper.getApplicationContext();
|
||||||
@@ -234,6 +238,7 @@ public class DBQueryTest implements DictionaryListener
|
|||||||
serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
|
serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
|
||||||
namespaceDao = (NamespaceDAOImpl) ctx.getBean("namespaceDAO");
|
namespaceDao = (NamespaceDAOImpl) ctx.getBean("namespaceDAO");
|
||||||
authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");
|
authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");
|
||||||
|
contentService = (ContentService) ctx.getBean("contentService");
|
||||||
|
|
||||||
loadTestModel();
|
loadTestModel();
|
||||||
createTestData();
|
createTestData();
|
||||||
@@ -401,6 +406,9 @@ public class DBQueryTest implements DictionaryListener
|
|||||||
properties.put(ContentModel.PROP_CREATED, explicitCreatedDate);
|
properties.put(ContentModel.PROP_CREATED, explicitCreatedDate);
|
||||||
n14 = nodeService.createNode(n13, ASSOC_TYPE_QNAME, QName.createQName("{namespace}fourteen"), ContentModel.TYPE_CONTENT, properties).getChildRef();
|
n14 = nodeService.createNode(n13, ASSOC_TYPE_QNAME, QName.createQName("{namespace}fourteen"), ContentModel.TYPE_CONTENT, properties).getChildRef();
|
||||||
nodeService.setProperty(n14, ContentModel.PROP_NAME, "Content 14");
|
nodeService.setProperty(n14, ContentModel.PROP_NAME, "Content 14");
|
||||||
|
ContentWriter writer = contentService.getWriter(n14, ContentModel.PROP_CONTENT, true);
|
||||||
|
writer.setEncoding("UTF-8");
|
||||||
|
writer.putContent("12345678");
|
||||||
|
|
||||||
n15 = nodeService.createNode(n13, ASSOC_TYPE_QNAME, QName.createQName("{namespace}fifteen"), ContentModel.TYPE_THUMBNAIL, getOrderProperties()).getChildRef();
|
n15 = nodeService.createNode(n13, ASSOC_TYPE_QNAME, QName.createQName("{namespace}fifteen"), ContentModel.TYPE_THUMBNAIL, getOrderProperties()).getChildRef();
|
||||||
nodeService.setProperty(n15, ContentModel.PROP_NAME, "Content 15");
|
nodeService.setProperty(n15, ContentModel.PROP_NAME, "Content 15");
|
||||||
@@ -580,7 +588,7 @@ public class DBQueryTest implements DictionaryListener
|
|||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderLong >= "+longValue, 7);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderLong >= "+longValue, 7);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderLong IN ( "+longValue+")", 1);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderLong IN ( "+longValue+")", 1);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderLong NOT IN ("+longValue+")", 12);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderLong NOT IN ("+longValue+")", 12);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderLong is null", 0);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderLong is null", 1);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderLong is not null", 13);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderLong is not null", 13);
|
||||||
|
|
||||||
long intValue = -45764576 + (8576457 * 6);
|
long intValue = -45764576 + (8576457 * 6);
|
||||||
@@ -594,7 +602,7 @@ public class DBQueryTest implements DictionaryListener
|
|||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderInt >= "+intValue, 7);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderInt >= "+intValue, 7);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderInt IN ( "+intValue+")", 1);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderInt IN ( "+intValue+")", 1);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderInt NOT IN ("+intValue+")", 12);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderInt NOT IN ("+intValue+")", 12);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderInt is null", 0);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderInt is null", 1);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderInt is not null", 13);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderInt is not null", 13);
|
||||||
|
|
||||||
String stringValue = new String(new char[] { (char) ('a' + 6) }) + " cabbage";
|
String stringValue = new String(new char[] { (char) ('a' + 6) }) + " cabbage";
|
||||||
@@ -608,7 +616,7 @@ public class DBQueryTest implements DictionaryListener
|
|||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderText >= '"+stringValue+"'", 7);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderText >= '"+stringValue+"'", 7);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderText IN ( '"+stringValue+"')", 1);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderText IN ( '"+stringValue+"')", 1);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderText NOT IN ('"+stringValue+"')", 12);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderText NOT IN ('"+stringValue+"')", 12);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderText is null", 0);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderText is null", 1);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderText is not null", 13);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderText is not null", 13);
|
||||||
|
|
||||||
// ML text is essentially multi-valued and gives unuusla results as ther is no locale constraint
|
// ML text is essentially multi-valued and gives unuusla results as ther is no locale constraint
|
||||||
@@ -624,7 +632,7 @@ public class DBQueryTest implements DictionaryListener
|
|||||||
// sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText >= '"+stringValue+"'", 7);
|
// sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText >= '"+stringValue+"'", 7);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText IN ( '"+stringValue+"')", 1);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText IN ( '"+stringValue+"')", 1);
|
||||||
// sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText NOT IN ('"+stringValue+"')", 12);
|
// sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText NOT IN ('"+stringValue+"')", 12);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText is null", 0);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText is null", 1);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText is not null", 13);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText is not null", 13);
|
||||||
|
|
||||||
stringValue = new String(new char[] { (char) ('Z' - 6) }) + " banane";
|
stringValue = new String(new char[] { (char) ('Z' - 6) }) + " banane";
|
||||||
@@ -638,7 +646,7 @@ public class DBQueryTest implements DictionaryListener
|
|||||||
// sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText >= '"+stringValue+"'", 7);
|
// sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText >= '"+stringValue+"'", 7);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText IN ( '"+stringValue+"')", 1);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText IN ( '"+stringValue+"')", 1);
|
||||||
// sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText NOT IN ('"+stringValue+"')", 12);
|
// sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText NOT IN ('"+stringValue+"')", 12);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText is null", 0);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText is null", 1);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText is not null", 13);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText is not null", 13);
|
||||||
|
|
||||||
stringValue = new String(new char[] { (char) ('香' + 6) }) + " 香蕉";
|
stringValue = new String(new char[] { (char) ('香' + 6) }) + " 香蕉";
|
||||||
@@ -652,7 +660,7 @@ public class DBQueryTest implements DictionaryListener
|
|||||||
// sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText >= '"+stringValue+"'", 7);
|
// sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText >= '"+stringValue+"'", 7);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText IN ( '"+stringValue+"')", 1);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText IN ( '"+stringValue+"')", 1);
|
||||||
// sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText NOT IN ('"+stringValue+"')", 12);
|
// sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText NOT IN ('"+stringValue+"')", 12);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText is null", 0);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText is null", 1);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText is not null", 13);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a where a.test:orderMLText is not null", 13);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -685,24 +693,23 @@ public class DBQueryTest implements DictionaryListener
|
|||||||
sqlQueryWithCount("SELECT * FROM cmis:document order by cmis:lastModifiedBy desc", 8, ContentModel.PROP_MODIFIER, false);
|
sqlQueryWithCount("SELECT * FROM cmis:document order by cmis:lastModifiedBy desc", 8, ContentModel.PROP_MODIFIER, false);
|
||||||
sqlQueryWithCount("SELECT * FROM cmis:folder order by cmis:lastModifiedBy desc", 6, ContentModel.PROP_MODIFIER, false);
|
sqlQueryWithCount("SELECT * FROM cmis:folder order by cmis:lastModifiedBy desc", 6, ContentModel.PROP_MODIFIER, false);
|
||||||
|
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a order by a.test:createdDate asc", 13, CREATED_DATE, true);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a order by a.test:createdDate asc", 14, CREATED_DATE, true);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a order by a.test:createdDate desc", 13, CREATED_DATE, false);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a order by a.test:createdDate desc", 14, CREATED_DATE, false);
|
||||||
|
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a order by a.test:orderLong asc", 13, ORDER_LONG, true);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a order by a.test:orderLong asc", 14, ORDER_LONG, true);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a order by a.test:orderLong desc", 13, ORDER_LONG, false);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a order by a.test:orderLong desc", 14, ORDER_LONG, false);
|
||||||
|
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a order by a.test:orderInt asc", 13, ORDER_INT, true);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a order by a.test:orderInt asc", 14, ORDER_INT, true);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a order by a.test:orderInt desc", 13, ORDER_INT, false);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a order by a.test:orderInt desc", 14, ORDER_INT, false);
|
||||||
|
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a order by a.test:orderText asc", 13, ORDER_TEXT, true);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a order by a.test:orderText asc", 14, ORDER_TEXT, true);
|
||||||
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a order by a.test:orderText desc", 13, ORDER_TEXT, false);
|
sqlQueryWithCount("SELECT * FROM test:testSuperAspect a order by a.test:orderText desc", 14, ORDER_TEXT, false);
|
||||||
|
|
||||||
// Note nulls not found as we use inner join
|
sqlQueryWithCount("SELECT * FROM cmis:document order by cmis:contentStreamMimeType asc", 8);
|
||||||
sqlQueryWithCount("SELECT * FROM cmis:document order by cmis:contentStreamMimeType asc", 1);
|
sqlQueryWithCount("SELECT * FROM cmis:document order by cmis:contentStreamMimeType desc", 8);
|
||||||
sqlQueryWithCount("SELECT * FROM cmis:document order by cmis:contentStreamMimeType desc", 1);
|
|
||||||
|
|
||||||
//sqlQueryWithCount("SELECT * FROM cmis:document order by cmis:contentStreamLength asc", 1);
|
sqlQueryWithCount("SELECT * FROM cmis:document order by cmis:contentStreamLength asc", 8);
|
||||||
//sqlQueryWithCount("SELECT * FROM cmis:document order by cmis:contentStreamLength desc", 1);
|
sqlQueryWithCount("SELECT * FROM cmis:document order by cmis:contentStreamLength desc", 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -713,10 +720,9 @@ public class DBQueryTest implements DictionaryListener
|
|||||||
sqlQueryWithCount("SELECT * FROM cmis:folder where cmis:parentId IN ('"+ n2 + "')", 1);
|
sqlQueryWithCount("SELECT * FROM cmis:folder where cmis:parentId IN ('"+ n2 + "')", 1);
|
||||||
sqlQueryWithCount("SELECT * FROM cmis:folder where cmis:parentId <> '"+ n2 + "'", 6);
|
sqlQueryWithCount("SELECT * FROM cmis:folder where cmis:parentId <> '"+ n2 + "'", 6);
|
||||||
sqlQueryWithCount("SELECT * FROM cmis:folder where cmis:parentId NOT IN ('"+ n2 + "')", 6);
|
sqlQueryWithCount("SELECT * FROM cmis:folder where cmis:parentId NOT IN ('"+ n2 + "')", 6);
|
||||||
// IS not null is OK but null requires an outer join
|
sqlQueryWithCount("SELECT * FROM cmis:folder where cmis:parentId IS NULL", 0);
|
||||||
//sqlQueryWithCount("SELECT * FROM cmis:folder where cmis:parentId IS NULL", 0);
|
sqlQueryWithCount("SELECT * FROM cmis:folder where cmis:parentId IS NOT NULL", 6);
|
||||||
//sqlQueryWithCount("SELECT * FROM cmis:folder where cmis:parentId IS NOT NULL", 7);
|
sqlQueryWithCount("SELECT * FROM cmis:document where cmis:contentStreamLength = 8", 1);
|
||||||
//sqlQueryWithCount("SELECT * FROM cmis:document where cmis:contentStreamLength = 0", 1);
|
|
||||||
sqlQueryWithCount("SELECT * FROM cmis:document where cmis:contentStreamFileName = 'Content 3'", 1);
|
sqlQueryWithCount("SELECT * FROM cmis:document where cmis:contentStreamFileName = 'Content 3'", 1);
|
||||||
sqlQueryWithCount("SELECT * FROM cmis:document where cmis:contentStreamFileName < 'Content 3'", 3);
|
sqlQueryWithCount("SELECT * FROM cmis:document where cmis:contentStreamFileName < 'Content 3'", 3);
|
||||||
sqlQueryWithCount("SELECT * FROM cmis:document where cmis:contentStreamFileName <= 'Content 3'", 4);
|
sqlQueryWithCount("SELECT * FROM cmis:document where cmis:contentStreamFileName <= 'Content 3'", 4);
|
||||||
@@ -735,9 +741,8 @@ public class DBQueryTest implements DictionaryListener
|
|||||||
sqlQueryWithCount("SELECT * FROM cmis:document where cmis:contentStreamMimeType <> 'text/plain'", 0);
|
sqlQueryWithCount("SELECT * FROM cmis:document where cmis:contentStreamMimeType <> 'text/plain'", 0);
|
||||||
sqlQueryWithCount("SELECT * FROM cmis:document where cmis:contentStreamMimeType IN ('text/plain')", 1);
|
sqlQueryWithCount("SELECT * FROM cmis:document where cmis:contentStreamMimeType IN ('text/plain')", 1);
|
||||||
sqlQueryWithCount("SELECT * FROM cmis:document where cmis:contentStreamMimeType NOT IN ('text/plain')", 0);
|
sqlQueryWithCount("SELECT * FROM cmis:document where cmis:contentStreamMimeType NOT IN ('text/plain')", 0);
|
||||||
//Would need LOJ for exists - should porbably exclude from DB support for now
|
sqlQueryWithCount("SELECT * FROM cmis:document where cmis:contentStreamMimeType IS NULL", 7);
|
||||||
//sqlQueryWithCount("SELECT * FROM cmis:document where cmis:contentStreamMimeType IS NULL", 0);
|
sqlQueryWithCount("SELECT * FROM cmis:document where cmis:contentStreamMimeType IS NOT NULL", 1);
|
||||||
//sqlQueryWithCount("SELECT * FROM cmis:document where cmis:contentStreamMimeType IS NOT NULL", 1);
|
|
||||||
sqlQueryWithCount("SELECT * FROM cmis:document where cmis:contentStreamMimeType like 'text%'", 1);
|
sqlQueryWithCount("SELECT * FROM cmis:document where cmis:contentStreamMimeType like 'text%'", 1);
|
||||||
sqlQueryWithCount("SELECT * FROM cmis:folder where cmis:objectId = '"+ n2 + "'", 1);
|
sqlQueryWithCount("SELECT * FROM cmis:folder where cmis:objectId = '"+ n2 + "'", 1);
|
||||||
sqlQueryWithCount("SELECT * FROM cmis:folder where cmis:objectId IN ('"+ n2 + "')", 1);
|
sqlQueryWithCount("SELECT * FROM cmis:folder where cmis:objectId IN ('"+ n2 + "')", 1);
|
||||||
|
Reference in New Issue
Block a user