ParseTiDBForSyntaxCheck parses TiDB SQL for syntax checking purposes. Returns []base.AST with *AST instances. Per-statement parse + line-tracking is delegated to parsePingCapSingleStatement (in dispatcher.go) so the dispatcher's pingcap-fallback path and this canonical pre-flip path produce structu
(statement string)
| 38 | // signals "non-1 node count, skip" — same semantic as the pre- |
| 39 | // refactor inline `if len(nodes) != 1 { continue }`. |
| 40 | func ParseTiDBForSyntaxCheck(statement string) ([]base.AST, error) { |
| 41 | singleSQLs, err := base.SplitMultiSQL(storepb.Engine_TIDB, statement) |
| 42 | if err != nil { |
| 43 | return nil, err |
| 44 | } |
| 45 | |
| 46 | var results []base.AST |
| 47 | for _, singleSQL := range singleSQLs { |
| 48 | ast, err := parsePingCapSingleStatement(singleSQL) |
| 49 | if err != nil { |
| 50 | return nil, err |
| 51 | } |
| 52 | if ast == nil { |
| 53 | continue |
| 54 | } |
| 55 | results = append(results, ast) |
| 56 | } |
| 57 | |
| 58 | return results, nil |
| 59 | } |
| 60 | |
| 61 | // applyTiDBLineTracking sets OriginTextPosition on a freshly-parsed pingcap |
| 62 | // node and walks CREATE TABLE columns to set their per-column line numbers |