Skip to content

Support for inline queries #1018

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 3 commits into from
Closed

Support for inline queries #1018

wants to merge 3 commits into from

Conversation

schauder
Copy link
Contributor

InlineQuery can be used wherever a Table was used up to now.

Table one = ...;
Select select = Select.builder()
		.select(one.column("id"), employee.column("name"))
		.from(one)
		.build();

InlineQuery inline = InlineQuery.create(select, "inline");
Select select = Select.builder()
		.select(inline.column("id"), inline.column("name"))
		.from(inline)
		.build();

Join and From renderer now use the same FromTableVisitor.
Also the SelectListVisitor reuses now the ExpressionVisitor.

Fixes #1003

schauder added 2 commits July 22, 2021 14:11
`InlineQuery` can be used whereever a `Table` was used up to now.

```
Table one = ...;
Select select = Select.builder()
		.select(one.column("id"), employee.column("name"))
		.from(one)
		.build();

InlineQuery inline = InlineQuery.create(select, "inline");
Select select = Select.builder()
		.select(inline.column("id"), inline.column("name"))
		.from(inline)
		.build();
```

Join and From renderer now use the same FromTableVisitor.
Also the SelectListVisitor reuses now the ExpressionVisitor.

Fixes #1003
@schauder schauder requested a review from gregturn July 29, 2021 14:48
schauder added a commit that referenced this pull request Jul 30, 2021
This commit contains just a test to verify this.
The actual fix happened as part of #1018.

Closes #1009.
Original pull request #1015
See #1018
* prefix a {@link Column}.
* <p/>
* Renders to: {@code <name>} or {@code <name> AS <name>}.
*
* @author Mark Paluch
* @since 1.1
*/
public class Table extends AbstractSegment {
public class Table extends AbstractSegment implements TableLike {
Copy link
Contributor

Choose a reason for hiding this comment

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

Extraneous space before Table.

* @author Jens Schauder
* @Since 2.3
*/
public interface TableLike extends Segment {
Copy link
Contributor

Choose a reason for hiding this comment

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

The whole name TableLike sounds weird to me. It's as if this is a "like" a Table but not quite. And your almost defining an interface in light of a concrete impl below it.

Feels as if this interface should be the core type Table and the concrete instance below it needs a qualifier embedded into its name. Perhaps class SegmentedTable extends AbstractSegment implements Table

I realize we are trying to come up with a class hierarchy that aligns our types against definitions pursuant to a relational database. Just a thought.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's as if this is a "like" a Table but not quite.

But that is exactly what it is: It is used just like a table, but it might not be one.

SegmentedTable to me sounds like "partitioned table" or something :-/

*
* @author Jens Schauder
*/
public class TestFrom extends From{
Copy link
Contributor

Choose a reason for hiding this comment

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

Insert space before {

See #1003
Original pull request #1018
@schauder
Copy link
Contributor Author

Fixed the spaces issue.
I'd like to discuss the naming question in person, if possible.

@mp911de mp911de self-assigned this Sep 28, 2021
@mp911de mp911de added the type: enhancement A general enhancement label Sep 28, 2021
@mp911de mp911de added this to the 2.3 RC1 (2021.1.0) milestone Sep 28, 2021
mp911de pushed a commit that referenced this pull request Sep 28, 2021
`InlineQuery` can be used wherever a `Table` was used up to now.

```
Table one = ...;
Select select = Select.builder()
		.select(one.column("id"), employee.column("name"))
		.from(one)
		.build();

InlineQuery inline = InlineQuery.create(select, "inline");
Select select = Select.builder()
		.select(inline.column("id"), inline.column("name"))
		.from(inline)
		.build();
```

Join and From renderer now use the same FromTableVisitor.
Also the SelectListVisitor reuses now the ExpressionVisitor.

Fixes #1003
Original pull request: #1018.
mp911de added a commit that referenced this pull request Sep 28, 2021
Reformat code. Remove duplicate, lingering Javadoc. Add override annotations. Use entities instead of < and >. Reduce method/class visibility in tests.

See #1003
Original pull request: #1018.
@mp911de
Copy link
Member

mp911de commented Sep 28, 2021

That's merged and polished now.

@mp911de mp911de closed this Sep 28, 2021
@mp911de mp911de deleted the issue/1003-join-subselect branch September 28, 2021 08:51
@mp911de mp911de changed the title Support for in line queries for tables. Support for inline queries Sep 28, 2021
mp911de pushed a commit that referenced this pull request Sep 28, 2021
This commit contains just a test to verify this.
The actual fix happened as part of #1018.

Closes #1009.
Original pull request #1015
See #1018
mp911de pushed a commit that referenced this pull request Sep 28, 2021
This commit contains just a test to verify this.
The actual fix happened as part of #1018.

Closes #1009.
Original pull request #1015
See #1018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for join with subselect
3 participants