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

Function collectCTENames

backend/plugin/parser/mysql/backup.go:280–286  ·  view source on GitHub ↗

collectCTENames extracts CTE names from the SQL text before the statement Loc. MySQL's UPDATE/DELETE CTEs are not in the omni AST, so we parse the prefix.

(fullSQL string, stmtLoc ast.Loc)

Source from the content-addressed store, hash-verified

278// collectCTENames extracts CTE names from the SQL text before the statement Loc.
279// MySQL's UPDATE/DELETE CTEs are not in the omni AST, so we parse the prefix.
280func collectCTENames(fullSQL string, stmtLoc ast.Loc) map[string]bool {
281 result := make(map[string]bool)
282 for _, cte := range parseCTEPrefix(fullSQL, stmtLoc) {
283 result[cte.Name] = true
284 }
285 return result
286}
287
288// extractCTE extracts the CTE (WITH clause) text from the SQL before the statement.
289func extractCTE(fullSQL string, stmtLoc ast.Loc) string {

Callers 2

extractTablesFromDeleteFunction · 0.70
extractTablesFromUpdateFunction · 0.70

Calls 1

parseCTEPrefixFunction · 0.70

Tested by

no test coverage detected