apply method

int apply(
  1. Transaction transaction, {
  2. bool savepoint = false,
})

Implementation

int apply(Transaction transaction, {bool savepoint = false}) {
  checkActive();
  beginSavepoint();
  try {
    int count = 0;
    for (var entry in transaction._updates.toIterable())
      count += update(entry.key, entry.value) ? 1 : 0;
    for (var key in transaction._deletes.toIterable()) ////
      count += delete(key) ? 1 : 0;
    for (var entry in transaction._inserts.toIterable())
      count += insert(entry.key, entry.value) ? 1 : 0;
    if (savepoint)
      commitSavepoint();
    else {
      commit();
      begin();
    }
    return count;
  } on Exception {
    rollbackSavepoint();
    rethrow;
  }
}