Interface RowCountingDelete

All Known Implementing Classes:
AbstractRelationalDataOperator, MysqlDataOperator, SimpleJsonDataOperator, SQLiteDataOperator

@Internal public interface RowCountingDelete
A data operator that can report how many rows a delete by id actually removed (#521).

DataOperator#delById returns void, and its signature is part of the published API, so the affected-row count travels through this internal side interface instead. QueryImpl.delete() uses it to return the number of rows the backend removed rather than the number the query matched. The framework's own operators implement it; a third-party DataOperator that does not is counted by checking that the row existed immediately before its delById and is gone after it.

Since:
6.3.0
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Deletes the row with this id, exactly as DataOperator#delById does, and returns the number of rows the backend removed.
  • Method Details

    • deleteByIdCounted

      int deleteByIdCounted(Object id)
      Deletes the row with this id, exactly as DataOperator#delById does, and returns the number of rows the backend removed.
      Parameters:
      id - the row id, not null
      Returns:
      the number of rows removed: 0 when no row had this id (for example because another writer removed it first), otherwise 1