Merged
Conversation
- Operator: add EXISTS_SUBQUERY and NOT_EXISTS_SUBQUERY enum values
- Condition: guard matches() against Query-valued values; extract matchesEq()
helper to keep cyclomatic complexity within the 10-method limit
- Query: add fromSubquery, fromAlias, joins (List<JoinClause>), and
selectSubqueries (List<ScalarSelectItem>) fields with accessors
- JoinClause: new immutable holder for plain-table and derived-table JOINs;
inner enum Type {INNER, LEFT, RIGHT, CROSS}
- ScalarSelectItem: new immutable holder for (SELECT ...) AS alias items in
the SELECT clause
- AbstractSqlDialect: rewrite render() and renderDelete() to support all new
query fields; add appendFromClause, appendJoinClauses, appendSelectColumns
(with scalar-subquery param collection), appendSubqueryCondition and five
private helpers; deterministic param ordering: scalar SELECT -> FROM ->
JOIN -> WHERE
QueryBuilder (SELECT): - whereInSubquery(col, Query): WHERE col IN (SELECT ...) - whereEqualsSubquery(col, Query): WHERE col = (SELECT ...) - whereExistsSubquery(Query): WHERE EXISTS (SELECT ...) - whereNotExistsSubquery(Query): WHERE NOT EXISTS (SELECT ...) - fromSubquery(Query, alias): FROM (SELECT ...) AS alias - joinSubquery(Query, alias, on): INNER JOIN (SELECT ...) AS alias ON ... - selectSubquery(Query, alias): (SELECT ...) AS alias in SELECT clause - build() propagates all four new Query fields (fromSubquery, fromAlias, joins, selectSubqueries) DeleteBuilder: - Remove duplicate rendering logic (SIMPLE_OPS map, handle*Operator methods) and delegate to AbstractSqlDialect.renderDelete() via new toQuery() helper - toQuery() sets limit = -1 to suppress spurious LIMIT 0 on MySQL / SQLite - whereInSubquery(col, Query): WHERE col IN (SELECT ...) - whereExistsSubquery(Query): WHERE EXISTS (SELECT ...)
Unit tests (54 new assertions across 7 files): - SubqueryConditionTest: WHERE IN subquery across STANDARD/MYSQL/SQLITE, WHERE NOT IN subquery, WHERE col = (SELECT ...) - ExistsSubqueryTest: EXISTS, NOT EXISTS, MySQL quoting, multi-condition params - FromSubqueryTest: FROM (SELECT ...) AS alias across all three dialects, outer WHERE combined with FROM subquery - JoinSubqueryTest: INNER JOIN subquery STANDARD/MYSQL, param ordering - ScalarSelectSubqueryTest: scalar SELECT STANDARD/MYSQL, subquery-only SELECT - NestedSubqueryParamOrderTest: deterministic param order (scalar->FROM->JOIN->WHERE), 3-level nesting - DeleteSubqueryIntegrationTest: DELETE + IN subquery STANDARD/MYSQL/SQLITE, multi-condition param ordering, DELETE + EXISTS subquery Execution matrix (SqlExecutionMatrixTest — 54 parameterized tests): - Spins up an in-memory SQLite database via sqlite-jdbc - Executes every SELECT operator (all 14 + subquery variants), INSERT, UPDATE, DELETE, and CREATE TABLE combination against a live JDBC connection - DML cases run inside savepoints that are always rolled back - pom.xml: add sqlite-jdbc:3.46.1.3 and junit-jupiter-params:6.0.3 as test-scoped dependencies
- Features: add subquery bullet - Quick Start: new Subqueries section with six annotated examples (WHERE IN, EXISTS/NOT EXISTS, scalar EQ, FROM derived-table, JOIN subquery, scalar SELECT subquery) - All Operators table: add whereInSubquery, whereEqualsSubquery, whereExistsSubquery, whereNotExistsSubquery rows; fix whereNotEquals and whereLessThan to correctly show DeleteBuilder-only availability - QueryBuilder Builder Reference: remove non-existent whereLessThan / whereNotEquals, add all seven new subquery helpers with comments - DeleteBuilder reference: add whereInSubquery and whereExistsSubquery
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
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
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.
Added subqueries
helper to keep cyclomatic complexity within the 10-method limit
selectSubqueries (List) fields with accessors
inner enum Type {INNER, LEFT, RIGHT, CROSS}
the SELECT clause
query fields; add appendFromClause, appendJoinClauses, appendSelectColumns
(with scalar-subquery param collection), appendSubqueryCondition and five
private helpers; deterministic param ordering: scalar SELECT -> FROM ->
JOIN -> WHERE
QueryBuilder (
SELECT):joins, selectSubqueries)
DeleteBuilder (
DELETE):and delegate to AbstractSqlDialect.renderDelete() via new toQuery() helper
Unit tests (54 new assertions across 7 files):
WHERE NOT IN subquery, WHERE col = (SELECT ...)
outer WHERE combined with FROM subquery
3-level nesting
multi-condition param ordering, DELETE + EXISTS subquery
Execution matrix (SqlExecutionMatrixTest — 54 parameterized tests):
UPDATE, DELETE, and CREATE TABLE combination against a live JDBC connection
as test-scoped dependencies
Updated README
(WHERE IN, EXISTS/NOT EXISTS, scalar EQ, FROM derived-table,
JOIN subquery, scalar SELECT subquery)
whereExistsSubquery, whereNotExistsSubquery rows; fix whereNotEquals
and whereLessThan to correctly show DeleteBuilder-only availability
whereNotEquals, add all seven new subquery helpers with comments