(expr ast.TableExpr, database, table string)
| 628 | } |
| 629 | |
| 630 | func 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 | |
| 649 | func equalOrLess(a, b *storepb.Position) bool { |
| 650 | if a.Line < b.Line { |
no outgoing calls
no test coverage detected