-
Notifications
You must be signed in to change notification settings - Fork 360
DATAJDBC-309 - Add infrastructure for semantic SQL generation #119
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c323e33
to
8493f98
Compare
We now provide a Statement Builder API along with a renderer to build statement object graphs and to render these to SQL. SelectBuilder builder = StatementBuilder.select(); Table employee = SQL.table("employee"); Table department = SQL.table("department"); Column name = employee.column("name").as("emp_name"); Column department_name = employee.column("name").as("department_name"); Select select = builder.select(name, department_name).from(employee).join(department) .on(SQL.column("department_id", employee)).equals(SQL.column("id", department)) .and(SQL.column("tenant", employee)).equals(SQL.column("tenant", department)) .orderBy(OrderByField.from(name).asc()).build(); String sql = SqlRenderer.render(select);
We now support LIKE and equal/not equal/less with equals to/greater with equals to conditions.
Column objects can now create conditions for a fluent DSL. .where(left.isGreater(right) as in StatementBuilder.select(left).from(table).where(left.isGreater(right)).build().
Introduce naming strategy to customize table and column naming.
Add since tags. Improve Javadoc.
Also added support for conditions.
Javadoc, static factory methods, typos. Refactor SQL rendering from a shared stack-based implementation to independent delegating visitors. Introduce DelegatingVisitor and TypedSubtreeVisitor base classes. Introduce SelectList container. Extract nested renderes to top-level types. Move SQL renderer to renderer package. Extend In to multi-expression argument. Introduce helper methods in Table to create multiple columns. Introduce factory method on StatementBuilder to create a new builder given a collection of expressions.
8493f98
to
036e046
Compare
done. |
mp911de
added a commit
that referenced
this pull request
Feb 26, 2019
We now provide a Statement Builder API along with a renderer to build statement object graphs and to render these to SQL. SelectBuilder builder = StatementBuilder.select(); Table employee = SQL.table("employee"); Table department = SQL.table("department"); Column name = employee.column("name").as("emp_name"); Column department_name = employee.column("name").as("department_name"); Select select = builder.select(name, department_name).from(employee).join(department) .on(SQL.column("department_id", employee)).equals(SQL.column("id", department)) .and(SQL.column("tenant", employee)).equals(SQL.column("tenant", department)) .orderBy(OrderByField.from(name).asc()).build(); String sql = SqlRenderer.render(select); Original pull request: #119.
mp911de
pushed a commit
that referenced
this pull request
Feb 26, 2019
Also added support for conditions. Original pull request: #119.
mp911de
added a commit
that referenced
this pull request
Feb 26, 2019
Javadoc, static factory methods, typos. Refactor SQL rendering from a shared stack-based implementation to independent delegating visitors. Introduce DelegatingVisitor and TypedSubtreeVisitor base classes. Introduce SelectList container. Extract nested renderes to top-level types. Move SQL renderer to renderer package. Extend In to multi-expression argument. Introduce helper methods in Table to create multiple columns. Introduce factory method on StatementBuilder to create a new builder given a collection of expressions. Add support for comparison conditions and LIKE and equal/not equal/less with equals to/greater with equals to conditions. Add condition creation methods to Column so Column objects can now create conditions for a fluent DSL as in (.where(left.isGreater(right)). StatementBuilder.select(left).from(table).where(left.isGreater(right)).build(). Introduce RenderContext and RenderNamingStrategy. Add since tags. Improve Javadoc. Original pull request: #119.
That's merged now. |
mp911de
pushed a commit
that referenced
this pull request
Feb 26, 2019
Also added support for conditions. Original pull request: #119.
mp911de
added a commit
that referenced
this pull request
Feb 26, 2019
Javadoc, static factory methods, typos. Refactor SQL rendering from a shared stack-based implementation to independent delegating visitors. Introduce DelegatingVisitor and TypedSubtreeVisitor base classes. Introduce SelectList container. Extract nested renderes to top-level types. Move SQL renderer to renderer package. Extend In to multi-expression argument. Introduce helper methods in Table to create multiple columns. Introduce factory method on StatementBuilder to create a new builder given a collection of expressions. Add support for comparison conditions and LIKE and equal/not equal/less with equals to/greater with equals to conditions. Add condition creation methods to Column so Column objects can now create conditions for a fluent DSL as in (.where(left.isGreater(right)). StatementBuilder.select(left).from(table).where(left.isGreater(right)).build(). Introduce RenderContext and RenderNamingStrategy. Add since tags. Improve Javadoc. Original pull request: #119.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We now provide a Statement Builder API to fluently build SQL statements and render these to a SQL string.
This change introduces support for
SELECT
.