Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order logic does not work with multi-digit conditions #16

Open
TrangOul opened this issue Aug 12, 2024 · 0 comments
Open

Order logic does not work with multi-digit conditions #16

TrangOul opened this issue Aug 12, 2024 · 0 comments

Comments

@TrangOul
Copy link

TrangOul commented Aug 12, 2024

The following query works as expected:

new QueryBuilder(Account.class)
	.addField(Account.Name)
	
	.addConditions()
	.add(new QueryBuilder.SimpleCondition('Name = \'acc1\''))
	.add(new QueryBuilder.SimpleCondition('Name = \'acc2\''))
	.add(new QueryBuilder.SimpleCondition('Name = \'acc3\''))
	.add(new QueryBuilder.SimpleCondition('Name = \'acc4\''))
	(...)
	.add(new QueryBuilder.SimpleCondition('Name = \'acc12\''))
	.setConditionOrder('1 OR 2 OR 12')
	.preview();
Name = 'acc1' OR Name = 'acc2' OR Name = 'acc12'

, but if we change the order:

	.setConditionOrder('12 OR 1 OR 2')

, the query gets malformed:

Name = 'acc1'Name = 'acc2' OR 1 OR 2

, since 12 is replaced by {1}{2} in bracketConditions (and the subsequent 1 and 2 are left unbracketed ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant