delete method
Delete the row with primary key pkVal. Returns true if it existed.
Implementation
Future<bool> delete(Object pkVal) async {
final pkBytes = _encodePrimaryKey(pkVal);
final rowId = await _index.get(pkBytes);
if (rowId == null) return false;
if (_secondary.isNotEmpty) {
final oldBytes = await _heap.get(rowId);
if (oldBytes != null) {
final oldRow = _decodeRow(oldBytes);
for (final si in _secondary.values) {
final key = _encodeSecondaryKey(si, oldRow, pkBytes);
if (key == null) continue;
await si.btree.remove(key);
}
}
}
await _heap.delete(rowId);
await _index.remove(pkBytes);
return true;
}