Skip to content
Snippets Groups Projects
Commit 544790d7 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

FIX: correct sql statements

parent c514ee23
No related branches found
No related tags found
1 merge request!65F permission checks
Pipeline #26324 failed
...@@ -639,19 +639,20 @@ public class Query implements QueryInterface, ToElementable, TransactionInterfac ...@@ -639,19 +639,20 @@ public class Query implements QueryInterface, ToElementable, TransactionInterfac
+ baseStatement + baseStatement
+ "( AS tmp JOIN entity_version ON entity_version.entity_id=tmp.id;"); + "( AS tmp JOIN entity_version ON entity_version.entity_id=tmp.id;");
} else { } else {
final String baseStatement =
(" SELECT tmp.id, entity_acl.acl, _iversion FROM "
+ " (SELECT results.id AS id, entities.acl AS acl_id, _iversion FROM `"
+ resultSetTableName
+ "` AS results JOIN entities ON results.id=entities.id) AS tmp"
+ " JOIN entity_acl ON entity_acl.id=tmp.acl_id");
if (!versioned) { if (!versioned) {
return baseStatement + ";"; return (" SELECT tmp.id, entity_acl.acl FROM "
+ " (SELECT results.id AS id, entities.acl AS acl_id FROM `"
+ resultSetTableName
+ "` AS results JOIN entities ON results.id=entities.id) AS tmp"
+ " JOIN entity_acl ON entity_acl.id=tmp.acl_id")
+ ";";
} }
// if versioned, the statement is surrounded with another SELECT and JOIN // if versioned, the statement is surrounded with another SELECT and JOIN
return ("SELECT tmp2.id, acl, version FROM(" return ("SELECT tmp2.id, acl, version FROM( SELECT tmp.id, entity_acl.acl, tmp._iversion AS _iversion FROM "
+ baseStatement + " (SELECT results.id AS id, entities.acl AS acl_id, results._iversion AS _iversion FROM `"
+ ") as tmp2 " + resultSetTableName
+ "` AS results JOIN entities ON results.id=entities.id) AS tmp"
+ " JOIN entity_acl ON entity_acl.id=tmp.acl_id) as tmp2 "
+ "join entity_version on (entity_version.entity_id=tmp2.id AND tmp2._iversion = entity_version._iversion);"); + "join entity_version on (entity_version.entity_id=tmp2.id AND tmp2._iversion = entity_version._iversion);");
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment