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

Support MySQL update with statement parse #34126

Merged
merged 2 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
1. Metadata: Add load-table-metadata-batch-size props to concurrent load table metadata - [#34009](https://github.com/apache/shardingsphere/pull/34009)
1. SQL Binder: Add sql bind logic for create table statement - [#34074](https://github.com/apache/shardingsphere/pull/34074)
1. SQL Binder: Support create index statement sql bind - [#34112](https://github.com/apache/shardingsphere/pull/34112)
1. SQL Parser: Support MySQL update with statement parse - [#34126](https://github.com/apache/shardingsphere/pull/34126)

### Bug Fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1552,6 +1552,9 @@ public ASTNode visitUpdate(final UpdateContext ctx) {
if (null != ctx.limitClause()) {
result.setLimit((LimitSegment) visit(ctx.limitClause()));
}
if (null != ctx.withClause()) {
result.setWithSegment((WithSegment) visit(ctx.withClause()));
}
result.addParameterMarkerSegments(getParameterMarkerSegments());
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import lombok.Setter;
import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.order.OrderBySegment;
import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.pagination.limit.LimitSegment;
import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.WithSegment;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.UpdateStatement;
import org.apache.shardingsphere.sql.parser.statement.mysql.MySQLStatement;

Expand All @@ -31,10 +32,17 @@
@Setter
public final class MySQLUpdateStatement extends UpdateStatement implements MySQLStatement {

private WithSegment withSegment;

private OrderBySegment orderBy;

private LimitSegment limit;

@Override
public Optional<WithSegment> getWithSegment() {
return Optional.ofNullable(withSegment);
}

@Override
public Optional<OrderBySegment> getOrderBy() {
return Optional.ofNullable(orderBy);
Expand Down
Loading