-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
- Loading branch information
Showing
26 changed files
with
1,163 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/Microsoft.SqlTools.ServiceLayer/EditData/Contracts/EditRow.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
// | ||
|
||
using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts; | ||
|
||
namespace Microsoft.SqlTools.ServiceLayer.EditData.Contracts | ||
{ | ||
/// <summary> | ||
/// A way to return a row in a result set that is being edited. It contains state about whether | ||
/// or not the row is dirty | ||
/// </summary> | ||
public class EditRow | ||
{ | ||
public enum EditRowState | ||
{ | ||
Clean = 0, | ||
DirtyInsert = 1, | ||
DirtyDelete = 2, | ||
DirtyUpdate = 3 | ||
} | ||
|
||
/// <summary> | ||
/// The cells in the row. If the row has pending changes, they will be represented in | ||
/// this list | ||
/// </summary> | ||
public DbCellValue[] Cells { get; set; } | ||
|
||
/// <summary> | ||
/// Internal ID of the row. This should be used whenever referencing a row in row edit operations. | ||
/// </summary> | ||
public long Id { get; set; } | ||
|
||
/// <summary> | ||
/// Whether or not the row has changes pending | ||
/// </summary> | ||
public bool IsDirty => State != EditRowState.Clean; | ||
|
||
/// <summary> | ||
/// What type of dirty state (or lack thereof) the row is | ||
/// </summary> | ||
public EditRowState State { get; set; } | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
src/Microsoft.SqlTools.ServiceLayer/EditData/Contracts/EditSubsetRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
// | ||
|
||
using Microsoft.SqlTools.Hosting.Protocol.Contracts; | ||
|
||
namespace Microsoft.SqlTools.ServiceLayer.EditData.Contracts | ||
{ | ||
/// <summary> | ||
/// Parameters for a subset retrieval request | ||
/// </summary> | ||
public class EditSubsetParams : SessionOperationParams | ||
{ | ||
/// <summary> | ||
/// Beginning index of the rows to return from the selected resultset. This index will be | ||
/// included in the results. | ||
/// </summary> | ||
public long RowStartIndex { get; set; } | ||
|
||
/// <summary> | ||
/// Number of rows to include in the result of this request. If the number of the rows | ||
/// exceeds the number of rows available after the start index, all available rows after | ||
/// the start index will be returned. | ||
/// </summary> | ||
public int RowCount { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// Parameters for the result of a subset retrieval request | ||
/// </summary> | ||
public class EditSubsetResult | ||
{ | ||
/// <summary> | ||
/// The number of rows returned from result set, useful for determining if less rows were | ||
/// returned than requested. | ||
/// </summary> | ||
public int RowCount { get; set; } | ||
|
||
/// <summary> | ||
/// The requested subset of rows, with information about whether or not the rows are dirty | ||
/// </summary> | ||
public EditRow[] Subset { get; set; } | ||
} | ||
|
||
public class EditSubsetRequest | ||
{ | ||
public static readonly | ||
RequestType<EditSubsetParams, EditSubsetResult> Type = | ||
RequestType<EditSubsetParams, EditSubsetResult>.Create("edit/subset"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.