Skip to content

DATAJDBC-490 - Support condition nesting #193

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

Closed
wants to merge 5 commits into from
Closed

Conversation

mp911de
Copy link
Member

@mp911de mp911de commented Feb 18, 2020

We now support condition groups (WHERE (a = b OR b = c) AND (e = f)) with the SQL AST via Condition.group().

We should make sure that Condition.group() is a sufficiently expressive method name. Maybe asGroup() or any other variant is more appropriate?


Related ticket: DATAJDBC-490.

Copy link
Contributor

@schauder schauder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not to fond of the group approach. asGroup would be slightly better.

But the real beef I have is that it reads like a mixture of normal and reverse Polish notation.

I'd rather have constructors or static method, so one may write

or(
    left.greaterThan(right).and(<....>),
    <some other expression>
)

and the same for AND.

I also added a commit adding a test that I think should succeed but doesn't.

@mp911de
Copy link
Member Author

mp911de commented Feb 24, 2020

Thanks for having a look. I also felt that .group/.asGroup isn't the right way to construct a group. Let me rewrite grouping to Conditions.group(Condition).

@mp911de mp911de changed the title DATAJDBC-490 - Support condition grouping DATAJDBC-490 - Support condition nesting Mar 9, 2020
mp911de and others added 5 commits March 9, 2020 17:28
We now support condition groups (WHERE (a = b OR b = c) AND (e = f)) with the SQL AST via Condition.group().
Rename ConditionGroup to GroupedCondition. Introduce Conditions.group(…) factory method instead of applying grouping via `condition.group()`. Introduce getter to introspect conditions.
@mp911de mp911de force-pushed the issue/DATAJDBC-490 branch from 905245e to 321699e Compare March 9, 2020 16:28
schauder pushed a commit that referenced this pull request Mar 10, 2020
We now support condition groups (WHERE (a = b OR b = c) AND (e = f)) with the SQL AST via Condition.group().

Original pull request: #193.
schauder added a commit that referenced this pull request Mar 10, 2020
schauder pushed a commit that referenced this pull request Mar 10, 2020
Rename ConditionGroup to GroupedCondition. Introduce Conditions.group(…) factory method instead of applying grouping via `condition.group()`. Introduce getter to introspect conditions.

Original pull request: #193.
schauder pushed a commit that referenced this pull request Mar 10, 2020
schauder added a commit that referenced this pull request Mar 10, 2020
Renamed GroupedConditionVisitor to NestedConditionVisitor to match the renamed NestedCondition.

Original pull request: #193.
@schauder
Copy link
Contributor

That's on master.

@schauder schauder closed this Mar 10, 2020
@schauder schauder deleted the issue/DATAJDBC-490 branch March 10, 2020 09:26
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

Successfully merging this pull request may close these issues.

2 participants