mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-26 09:35:38 -05:00
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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user