/// <summary> /// Executes a request to delete rows in a table, with constraints. /// This is the synchronous implementation. /// </summary> /// <parameters> /// <param name="context">Description of the request.</param> /// </parameters> /// <returns> /// The request result. /// </returns> protected virtual IDeleteResult Execute(IDeleteContext context) { if (!IsOperationThreadStarted) { return(new DeleteResult(false, ResultError.ErrorFatalNoOperationThread)); } IActiveOperation <IDeleteResultInternal> ActiveOperation = Connector.Delete(context); IDeleteResultInternal Result = ActiveOperation.Result; FinalizeOrQueue(ActiveOperation); return(Result); }
public virtual string FinalizeOperation(MySqlCommand command, IDeleteResultInternal result) { try { int DeletedRowCount = command.EndExecuteNonQuery(result.AsyncResult); if (DeletedRowCount >= Context.ExpectedDeletedCount) { result.SetCompletedWithCount(DeletedRowCount); return($"succeeded, {DeletedRowCount} row(s) deleted"); } else { result.SetCompleted(false, ResultError.ErrorMissingDeletedRows); return("failed"); } } catch { result.SetCompleted(false, ResultError.ErrorExceptionCompletingDelete); throw; } }