| 656 | } |
| 657 | |
| 658 | std::pair<std::vector<TableCatalogEntry*>, std::unordered_map<TableCatalogEntry*, std::string>> |
| 659 | Binder::bindNodeTableEntries(const std::vector<std::string>& tableNames) const { |
| 660 | auto transaction = transaction::Transaction::Get(*clientContext); |
| 661 | auto catalog = Catalog::Get(*clientContext); |
| 662 | auto useInternal = clientContext->useInternalCatalogEntry(); |
| 663 | table_catalog_entry_set_t entrySet; |
| 664 | std::unordered_map<TableCatalogEntry*, std::string> dbNames; |
| 665 | if (tableNames.empty()) { // Rewrite as all node tables in database. |
| 666 | for (auto entry : catalog->getNodeTableEntries(transaction, useInternal)) { |
| 667 | entrySet.insert(entry); |
| 668 | } |
| 669 | auto dbManager = main::DatabaseManager::Get(*clientContext); |
| 670 | for (auto attachedDB : dbManager->getAttachedDatabases()) { |
| 671 | auto attachedCatalog = attachedDB->getCatalog(); |
| 672 | for (auto entry : attachedCatalog->getTableEntries(transaction, useInternal)) { |
| 673 | if (entry->getType() == CatalogEntryType::FOREIGN_TABLE_ENTRY) { |
| 674 | entrySet.insert(entry); |
| 675 | dbNames[entry] = attachedDB->getDBName(); |
| 676 | } |
| 677 | } |
| 678 | } |
| 679 | } else { |
| 680 | for (auto& name : tableNames) { |
| 681 | auto [entry, dbName] = bindNodeTableEntry(name); |
| 682 | if (entry->getType() != CatalogEntryType::NODE_TABLE_ENTRY && |
| 683 | entry->getType() != CatalogEntryType::FOREIGN_TABLE_ENTRY) { |
| 684 | throw BinderException( |
| 685 | std::format("Cannot bind {} as a node pattern label.", entry->getName())); |
| 686 | } |
| 687 | entrySet.insert(entry); |
| 688 | if (!dbName.empty()) { |
| 689 | dbNames[entry] = dbName; |
| 690 | } |
| 691 | } |
| 692 | } |
| 693 | return {sortEntries(entrySet), std::move(dbNames)}; |
| 694 | } |
| 695 | |
| 696 | std::pair<TableCatalogEntry*, std::string> Binder::bindNodeTableEntry( |
| 697 | const std::string& name) const { |
nothing calls this directly
no test coverage detected