apex-query-builder icon indicating copy to clipboard operation
apex-query-builder copied to clipboard

Implicit AND clause on addConditions() with multiple conditions

Open aranwe opened this issue 5 years ago • 5 comments

Current behaviour:

new QueryBuilder(Account.class)
        .addConditions()
        .add(new QueryBuilder.SimpleCondition('Name = \'Test\'')
        .add(new QueryBuilder.SimpleCondition('Field2 = \'Test\'')
        .endConditions()
        .toString();

// returns SELECT Id FROM Account WHERE Name = 'Test'

Expected behaviour:

 SELECT Id FROM Account WHERE Name = 'Test' AND Field2 = 'Test'

If there is no explicit ordering set I think it should implicitly join all Conditions with an AND clause

I have it implemented -> should I send PR?

aranwe avatar Feb 03 '20 13:02 aranwe

I think it makes sense to implicitly join Conditions with AND. Please, send a PR.

4an70m avatar Feb 03 '20 13:02 4an70m

Hello. Have you implemented this solution ? Because I need really need it

AlexBogomaz avatar Jul 20 '20 13:07 AlexBogomaz

Hi, this would be nice to have.

kratoon avatar Nov 25 '20 14:11 kratoon

Hi,

I have forgotten to send the PR and in the meantime I have deleted that branch as we have moved & refactored to use: https://github.com/PropicSignifi/Query.apex

It solves this issue & the API is better suited for algorithmic query building.

:) Sorry.

aranwe avatar Nov 26 '20 17:11 aranwe

Great!

Looks much better :+1:

thanks

kratoon avatar Nov 26 '20 18:11 kratoon