MCPcopy Create free account
hub / github.com/bytebase/bytebase / GetStatementTypes

Function GetStatementTypes

backend/plugin/parser/plsql/statement_type.go:14–30  ·  view source on GitHub ↗
(asts []base.AST)

Source from the content-addressed store, hash-verified

12)
13
14func GetStatementTypes(asts []base.AST) ([]storepb.StatementType, error) {
15 sqlTypeSet := make(map[storepb.StatementType]bool)
16 for _, ast := range asts {
17 node, ok := GetOmniNode(ast)
18 if ok {
19 sqlTypeSet[classifyOmniStatementType(node)] = true
20 continue
21 }
22
23 return nil, errors.New("expected Oracle omni AST")
24 }
25 var sqlTypes []storepb.StatementType
26 for sqlType := range sqlTypeSet {
27 sqlTypes = append(sqlTypes, sqlType)
28 }
29 return sqlTypes, nil
30}
31
32func classifyOmniStatementType(node oracleast.Node) storepb.StatementType {
33 switch n := node.(type) {

Callers 3

GetSQLSummaryReportFunction · 0.92
TestGetStatementTypeFunction · 0.70

Calls 2

GetOmniNodeFunction · 0.70

Tested by 2

TestGetStatementTypeFunction · 0.56