MCPcopy Index your code
hub / github.com/bytebase/bytebase / SplitSQL

Function SplitSQL

backend/plugin/parser/tidb/split.go:15–24  ·  view source on GitHub ↗

SplitSQL splits the given SQL statement into multiple SQL statements.

(statement string)

Source from the content-addressed store, hash-verified

13
14// SplitSQL splits the given SQL statement into multiple SQL statements.
15func SplitSQL(statement string) ([]base.Statement, error) {
16 segments := tidbparser.Split(statement)
17
18 result := make([]base.Statement, 0, len(segments))
19 positionMapper := base.NewByteOffsetPositionMapper(statement)
20 for _, seg := range segments {
21 result = append(result, base.NewStatementFromRange(statement, positionMapper, seg.ByteStart, seg.ByteEnd, seg.Empty()))
22 }
23 return result, nil
24}

Calls 2

NewStatementFromRangeFunction · 0.92