delete method

  1. @protected
bool delete(
  1. SqlId id
)

Implementation

@protected
bool delete(SqlId id) {
  Kind? kind;
  int rowid;
  if (id.hasRowId) {
    var rows = _deleteByRowId!.select([id.rowid]);
    if (!updated() || rows.length != 1) ////
      return false;
    kind = rows.first.columnAt(0) as Kind?;
    rowid = id.rowid;
  } else {
    var rows = _deleteByKeyId!.select(<Object>[id.keyid!]);
    if (!updated() || rows.length != 1) ////
      return false;
    kind = rows.first.columnAt(0) as Kind?;
    rowid = rows.first.columnAt(1) as int;
  }
  if (scheme.getSearchIndexesUpdater(kind) case var updaters?)
    for (var entry in updaters.toIterable()) {
      entry.indexUpdater.delete.executeWith(
        StatementParameters.named({":$columnRowId": rowid}),
      );
      if (!updated())
        log.severe(
          "SQLite.delete: failed for rowid $rowid, kind \"$kind\","
          " search index \"${entry.indexUpdater.index.name}\"",
        );
    }
  return true;
}