parsePLSQLStatements is the ParseStatementsFunc for Oracle (PL/SQL). Returns []ParsedStatement with both text and AST populated.
(statement string)
| 20 | // parsePLSQLStatements is the ParseStatementsFunc for Oracle (PL/SQL). |
| 21 | // Returns []ParsedStatement with both text and AST populated. |
| 22 | func parsePLSQLStatements(statement string) ([]base.ParsedStatement, error) { |
| 23 | stmts, err := SplitSQL(statement) |
| 24 | if err != nil { |
| 25 | return nil, err |
| 26 | } |
| 27 | |
| 28 | var result []base.ParsedStatement |
| 29 | for _, stmt := range stmts { |
| 30 | if stmt.Empty { |
| 31 | result = append(result, base.ParsedStatement{Statement: stmt}) |
| 32 | continue |
| 33 | } |
| 34 | |
| 35 | list, err := ParsePLSQLOmni(stmt.Text) |
| 36 | if err != nil { |
| 37 | return nil, convertOmniError(err, stmt) |
| 38 | } |
| 39 | if list == nil || len(list.Items) == 0 { |
| 40 | result = append(result, base.ParsedStatement{Statement: stmt}) |
| 41 | continue |
| 42 | } |
| 43 | for _, node := range list.Items { |
| 44 | raw, ok := node.(*ast.RawStmt) |
| 45 | if !ok { |
| 46 | continue |
| 47 | } |
| 48 | result = append(result, base.ParsedStatement{ |
| 49 | Statement: stmt, |
| 50 | AST: &OmniAST{ |
| 51 | Node: raw.Stmt, |
| 52 | Text: stmt.Text, |
| 53 | StartPosition: stmt.Start, |
| 54 | }, |
| 55 | }) |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | return result, nil |
| 60 | } |
| 61 | |
| 62 | type Version struct { |
| 63 | First int |
nothing calls this directly
no test coverage detected