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

Function SplitSQL

backend/plugin/parser/redshift/split.go:15–32  ·  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 := omniredshift.Split(statement)
17 list := make([]base.Statement, 0, len(segments))
18 positionMapper := base.NewByteOffsetPositionMapper(statement)
19 for _, segment := range segments {
20 list = append(list, base.Statement{
21 Text: segment.Text,
22 Empty: segment.Empty(),
23 Start: positionMapper.Position(segment.ByteStart),
24 End: positionMapper.Position(segment.ByteEnd),
25 Range: &storepb.Range{
26 Start: int32(segment.ByteStart),
27 End: int32(segment.ByteEnd),
28 },
29 })
30 }
31 return list, nil
32}

Callers 3

parseRedshiftStatementsFunction · 0.70

Calls 2

PositionMethod · 0.95

Tested by

no test coverage detected