| 111 | } |
| 112 | |
| 113 | uint64_t StorageDriver::getNumNodes(const std::string& nodeName) const { |
| 114 | clientContext->query("BEGIN TRANSACTION READ ONLY;"); |
| 115 | auto transaction = Transaction::Get(*clientContext); |
| 116 | auto catalogEntry = getEntry(*clientContext, nodeName); |
| 117 | |
| 118 | if (catalogEntry->getType() != CatalogEntryType::NODE_TABLE_ENTRY) { |
| 119 | clientContext->query("COMMIT"); |
| 120 | throw RuntimeException(std::format("{} is not a node table", nodeName)); |
| 121 | } |
| 122 | |
| 123 | uint64_t result = StorageManager::Get(*clientContext) |
| 124 | ->getTable(catalogEntry->getTableID()) |
| 125 | ->getNumTotalRows(transaction); |
| 126 | clientContext->query("COMMIT"); |
| 127 | return result; |
| 128 | } |
| 129 | |
| 130 | uint64_t StorageDriver::getNumRels(const std::string& relName) const { |
| 131 | clientContext->query("BEGIN TRANSACTION READ ONLY;"); |