mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-04 01:25:43 -05:00
feature/edit/subset (#283)
* Changing query/subset API to only use Result on success, Error on error * Creating an interservice API for getting query result subsets * Updates to subset API * RowStartIndex is now long * Output of query/subset is a 2D array of DbCellValue * Adding LongSkip method to LongList to allow skipping ahead by longs * Moving LongList back to ServiceLayer utilities. Move refactoring * Stubbing out request for edit/subset * Initial implementation of getting edit rows * Unit tests for RowEdit and RowDelete .GetEditRow * Fixing major bugs in LongList implementation, adding much more thorough tests * Adding some more unit tests and fixes to make unit tests pass * Fixing comment
This commit is contained in:
@@ -113,6 +113,30 @@ namespace Microsoft.SqlTools.ServiceLayer.EditData.UpdateManagement
|
||||
return command;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a edit row that represents a row with pending update. The cells pending
|
||||
/// updates are merged into the unchanged cells.
|
||||
/// </summary>
|
||||
/// <param name="cachedRow">Original, cached cell contents</param>
|
||||
/// <returns>EditRow with pending updates</returns>
|
||||
public override EditRow GetEditRow(DbCellValue[] cachedRow)
|
||||
{
|
||||
Validate.IsNotNull(nameof(cachedRow), cachedRow);
|
||||
|
||||
// For each cell that is pending update, replace the db cell value with a new one
|
||||
foreach (var cellUpdate in cellUpdates)
|
||||
{
|
||||
cachedRow[cellUpdate.Key] = cellUpdate.Value.AsDbCellValue;
|
||||
}
|
||||
|
||||
return new EditRow
|
||||
{
|
||||
Id = RowId,
|
||||
Cells = cachedRow,
|
||||
State = EditRow.EditRowState.DirtyUpdate
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs an update statement to change the associated row.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user