| 807 | } |
| 808 | |
| 809 | PrimaryKeyIndex* NodeTable::tryGetPKIndex() const { |
| 810 | const auto index = getIndex(PrimaryKeyIndex::DEFAULT_NAME); |
| 811 | if (!index.has_value()) { |
| 812 | for (auto& indexHolder : indexes) { |
| 813 | if (!indexHolder.isLoaded()) { |
| 814 | continue; |
| 815 | } |
| 816 | auto* loadedIndex = indexHolder.getIndex(); |
| 817 | if (loadedIndex->isPrimary() && |
| 818 | loadedIndex->getIndexInfo().indexType == PrimaryKeyIndex::getIndexType().typeName) { |
| 819 | return &loadedIndex->cast<PrimaryKeyIndex>(); |
| 820 | } |
| 821 | } |
| 822 | return nullptr; |
| 823 | } |
| 824 | if (index.value()->getIndexInfo().indexType != PrimaryKeyIndex::getIndexType().typeName) { |
| 825 | return nullptr; |
| 826 | } |
| 827 | return &index.value()->cast<PrimaryKeyIndex>(); |
| 828 | } |
| 829 | |
| 830 | Index* NodeTable::tryGetPrimaryKeyIndex() const { |
| 831 | if (auto* pkIndex = tryGetPKIndex()) { |