| 148 | /// Check if this key is referenced by any other key. |
| 149 | template <typename IsDeletedParentKeyPredicate> |
| 150 | bool isKeyReferenced(DBStorage &storage, const DBKey &key, IsDeletedParentKeyPredicate pred) |
| 151 | { |
| 152 | bool result = false; |
| 153 | |
| 154 | iterateParentKeys(storage, |
| 155 | key, |
| 156 | [&](const DBKey &parentKey, const StonePos &, TransformType) -> bool { |
| 157 | if (pred(parentKey)) |
| 158 | return false; |
| 159 | |
| 160 | DBRecord record; |
| 161 | if (storage.get(parentKey, record, RECORD_MASK_NONE)) { |
| 162 | result = true; |
| 163 | return true; // terminate iteration now |
| 164 | } |
| 165 | |
| 166 | return false; |
| 167 | }); |
| 168 | |
| 169 | return result; |
| 170 | } |
| 171 | |
| 172 | /// Delete all children of a board position from the database storage. |
| 173 | /// @return The number of records deleted. |
no test coverage detected