edit/revertCell (#268)

// edit/dispose -------------------------------------------------------------------------------
export interface EditDisposeParams extends IEditSessionOperationParams { }
export interface EditDisposeResult { }

* Initial plumbing for edit/revertCell

* Implementation of revert cell in the parents of the row edit base

* Adding unit tests
This commit is contained in:
Benjamin Russell
2017-03-08 14:49:13 -08:00
committed by GitHub
parent 666ee98582
commit c0468e763f
17 changed files with 469 additions and 39 deletions

View File

@@ -27,7 +27,7 @@ namespace Microsoft.SqlTools.ServiceLayer.EditData.UpdateManagement
private const string InsertCompleteScript = "{0} VALUES ({1})";
private const string InsertCompleteOutput = "{0} OUTPUT {1} VALUES ({2})";
private readonly CellUpdate[] newCells;
internal readonly CellUpdate[] newCells;
/// <summary>
/// Creates a new Row Creation edit to the result set
@@ -159,6 +159,21 @@ namespace Microsoft.SqlTools.ServiceLayer.EditData.UpdateManagement
return string.Format(InsertCompleteScript, start, joinedValues);
}
/// <summary>
/// Reverts a cell to an unset value.
/// </summary>
/// <param name="columnId">The ordinal ID of the cell to reset</param>
/// <returns>The default value for the column, or null if no default is defined</returns>
public override string RevertCell(int columnId)
{
// Validate that the column can be reverted
Validate.IsWithinRange(nameof(columnId), columnId, 0, newCells.Length - 1);
// Remove the cell update from list of set cells
newCells[columnId] = null;
return null; // @TODO: Return default value when we have support checked in
}
/// <summary>
/// Sets the value of a cell in the row to be added
/// </summary>