extractNameListParts extracts db, schema, name from a list of String nodes.
(nameList *ast.List, defaultDB string)
| 280 | |
| 281 | // extractNameListParts extracts db, schema, name from a list of String nodes. |
| 282 | func extractNameListParts(nameList *ast.List, defaultDB string) (string, string, string) { |
| 283 | var parts []string |
| 284 | for _, item := range nameList.Items { |
| 285 | if s, ok := item.(*ast.String); ok { |
| 286 | parts = append(parts, s.Str) |
| 287 | } |
| 288 | } |
| 289 | switch len(parts) { |
| 290 | case 1: |
| 291 | return defaultDB, "", parts[0] |
| 292 | case 2: |
| 293 | return defaultDB, parts[0], parts[1] |
| 294 | case 3: |
| 295 | return parts[0], parts[1], parts[2] |
| 296 | default: |
| 297 | return defaultDB, "", "" |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | // getOmniStatementText returns the text of a statement from OmniAST, including semicolon. |
| 302 | func getOmniStatementText(omniAST *OmniAST) string { |
no outgoing calls
no test coverage detected