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

Function requireTargets

backend/plugin/parser/tidb/backup.go:178–186  ·  view source on GitHub ↗

requireTargets fails when a recognized DML statement yields no backup target. Returning an empty list with no error would let the task executor treat the backup as a successful no-op and run the mutation unprotected (e.g. when a table alias collides with a CTE name, so the only target gets filtered

(infos []statementInfo, err error, kind string)

Source from the content-addressed store, hash-verified

176// backup as a successful no-op and run the mutation unprotected (e.g. when a
177// table alias collides with a CTE name, so the only target gets filtered out).
178func requireTargets(infos []statementInfo, err error, kind string) ([]statementInfo, error) {
179 if err != nil {
180 return nil, err
181 }
182 if len(infos) == 0 {
183 return nil, errors.Errorf("prior backup could not determine a backup target for the %s statement", kind)
184 }
185 return infos, nil
186}
187
188func extractTablesFromDelete(databaseName string, n *ast.DeleteStmt, fullSQL string, isCaseSensitive bool) ([]statementInfo, error) {
189 cteNames := collectCTENames(fullSQL, n.Loc)

Callers 1

extractTablesFunction · 0.85

Calls 1

ErrorfMethod · 0.80

Tested by

no test coverage detected