SplitSQL splits the given SQL statement into multiple SQL statements.
(statement string)
| 13 | |
| 14 | // SplitSQL splits the given SQL statement into multiple SQL statements. |
| 15 | func 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 | } |
no test coverage detected