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

Function tableExprReferences

backend/plugin/parser/tidb/restore.go:630–647  ·  view source on GitHub ↗
(expr ast.TableExpr, database, table string)

Source from the content-addressed store, hash-verified

628}
629
630func tableExprReferences(expr ast.TableExpr, database, table string) bool {
631 switch n := expr.(type) {
632 case *ast.TableRef:
633 db := n.Schema
634 if db == "" {
635 db = database
636 }
637 // Both comparisons are case-insensitive — TiDB/MySQL identifier
638 // comparisons are typically case-insensitive in practice, and the
639 // table-name comparison below already uses EqualFold; using == on
640 // the database side would inconsistently miss schema-qualified
641 // references like `DB.test` when backupItem stores `db`.
642 return strings.EqualFold(db, database) && strings.EqualFold(n.Name, table)
643 case *ast.JoinClause:
644 return tableExprReferences(n.Left, database, table) || tableExprReferences(n.Right, database, table)
645 }
646 return false
647}
648
649func equalOrLess(a, b *storepb.Position) bool {
650 if a.Line < b.Line {

Callers 2

deleteMutatesTableFunction · 0.70
updateMutatesTableFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected