Skip to content

Commit

Permalink
Merge pull request #34126 from strongduanmu/dev-12232
Browse files Browse the repository at this point in the history
Support MySQL update with statement parse
  • Loading branch information
iamhucong authored Dec 23, 2024
2 parents f246711 + fc25936 commit 80e148e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
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

0 comments on commit 80e148e

Please sign in to comment.