ifcparse: build the RocksDB inverse prefix in all_referencing_instances with rocksdb_key

Since #9508 the numeric key segments are fixed-width hex; the one
hand-built "v|" + std::to_string(id) prefix wouldn't have matched.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HNrXDmR88wKPCYwGE21SyH
This commit is contained in:
Dion Moult
2026-09-17 20:48:13 +10:00
parent f2230ed975
commit cd2e208b6a
+1 -1
View File
@@ -3173,7 +3173,7 @@ bool file::all_referencing_instances(int instance_id, const std::function<bool(u
#ifdef IFOPSH_WITH_ROCKSDB #ifdef IFOPSH_WITH_ROCKSDB
else if constexpr (std::is_same_v<std::decay_t<decltype(x)>, impl::rocks_db_file_storage>) { else if constexpr (std::is_same_v<std::decay_t<decltype(x)>, impl::rocks_db_file_storage>) {
// @todo no lower/upper_bounds() implemented yet // @todo no lower/upper_bounds() implemented yet
auto prefix = "v|" + std::to_string(instance_id) + "|"; auto prefix = rocksdb_key::inverse_prefix(instance_id);
auto it = std::unique_ptr<rocksdb::Iterator>(x.db->NewIterator(rocksdb::ReadOptions())); auto it = std::unique_ptr<rocksdb::Iterator>(x.db->NewIterator(rocksdb::ReadOptions()));
it->Seek(prefix); it->Seek(prefix);
while (it->Valid() && it->key().starts_with(prefix)) { while (it->Valid() && it->key().starts_with(prefix)) {