Skip to content

Commit

Permalink
Fixed query preview format and USING Scope positioning
Browse files Browse the repository at this point in the history
  • Loading branch information
4an70m committed Jul 8, 2019
1 parent f2d5df9 commit 366dc10
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/classes/QueryBuilder.cls
Original file line number Diff line number Diff line change
Expand Up @@ -1482,22 +1482,23 @@ public virtual inherited sharing class QueryBuilder {
if (this.fieldTokens.isEmpty()) {
fields = 'Id';
} else {
fields = String.join(new List<String>(this.fieldTokens), ', ');
fields = String.join(new List<String>(this.fieldTokens), '\n\t, ');
}
result += fields + ' \n';
result += 'FROM ' + this.fromSobject + ' \n';
if (this.scope != FilterScope.Everything) {
result += 'USING SCOPE ' + this.scope.name() + ' \n';
}
result += fields + '\n ';
result += 'FROM ' + this.fromSobject + '\n ';
if (this.conditionsManager.hasConditions()) {
result += 'WHERE ' + this.conditionsManager.builtCondition + '\n ';
result += 'WHERE ' + this.conditionsManager.builtCondition + ' \n';
}
if (this.scope != FilterScope.Everything) {
result += 'USING SCOPE ' + this.scope.name() + '\n ';
if (this.withSecurityEnforced) {
result += 'WITH SECURITY_ENFORCED \n';
}

if (!this.groupByFields.isEmpty()) {
result += 'GROUP BY ';
result += String.join(new List<String>(this.groupByFields), ', ') + '\n ';
result += String.join(new List<String>(this.groupByFields), ', ') + ' \n';
}
if (!this.sortingOrder.isEmpty()) {
result += 'ORDER BY ';
Expand Down

0 comments on commit 366dc10

Please sign in to comment.