Skip to content

Optimize MySQL INSERT INTO VALUES AS row_alias parse SQLStatement #36583

@strongduanmu

Description

@strongduanmu

Feature Request

Is your feature request related to a problem?

No

Describe the feature you would like.

Currently, ShardingSphere MySQL parsing engine does not fully support MySQL INSERT INTO VALUES AS row_alias parsing. The AS row_alias part is not correctly parsed into the SQLStatement object. In addition, the expression in ON DUPLCIATE KEY UPDATE is not processed correctly and only CommonExpressionSegment is used to represent it.

INSERT INTO t_order VALUES (?, ?, ?, ?, 'test', '2017-08-08'), (?, ?, ?, ?, 'test', '2017-08-08') AS new_order ON DUPLICATE KEY UPDATE status = new_order.status

INSERT INTO t_order VALUES (?, ?, ?, ?, 'test', '2017-08-08'), (?, ?, ?, ?, 'test', '2017-08-08') AS new_order(order_id, user_id, status, merchant_id, remark, creation_date) ON DUPLICATE KEY UPDATE status = new_order.status

INSERT INTO t_order SET order_id = ?, user_id = ?, status = ?, merchant_id = ?, remark = 'test', creation_date = '2017-08-08' AS new_order ON DUPLICATE KEY UPDATE status = new_order.status

INSERT INTO t_order SET order_id = ?, user_id = ?, status = ?, merchant_id = ?, remark = 'test', creation_date = '2017-08-08' AS new_order(order_id, user_id, status, merchant_id, remark, creation_date) ON DUPLICATE KEY UPDATE status = new_order.status
Image

Goal: Fully support the two SQL statements in the example and extract them into SQLStatement through visit.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions