mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-17 02:51:45 -05:00
edit/commit Command (#262)
The main goal of this feature is to enable a command that will 1) Generate a parameterized command for each edit that is in the session 2) Execute that command against the server 3) Update the cached results of the table/view that's being edited with the committed changes (including computed/identity columns) There's some secret sauce in here where I cheated around worrying about gaps in the updated results. This was accomplished by implementing an IComparable for row edit objects that ensures deletes are the *last* actions to occur and that they occur from the bottom of the list up (highest row ID to lowest). Thus, all other actions that are dependent on the row ID are performed first, then the largest row ID is deleted, then next largest, etc. Nevertheless, by the end of a commit the associated ResultSet is still the source of truth. It is expected that the results grid will need updating once changes are committed. Also worth noting, although this pull request supports a "many edits, one commit" approach, it will work just fine for a "one edit, one commit" approach. * WIP * Adding basic commit support. Deletions work! * Nailing down the commit logic, insert commits work! * Updates work! * Fixing bug in DbColumnWrapper IsReadOnly setting * Comments * ResultSet unit tests, fixing issue with seeking in mock writers * Unit tests for RowCreate commands * Unit tests for RowDelete * RowUpdate unit tests * Session and edit base tests * Fixing broken unit tests * Moving constants to constants file * Addressing code review feedback * Fixes from merge issues, string consts * Removing ad-hoc code * fixing as per @abist requests * Fixing a couple more issues
This commit is contained in:
@@ -27,7 +27,7 @@ namespace Microsoft.SqlTools.Hosting
|
||||
Keys.Culture = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static string CredentialsServiceInvalidCriticalHandle
|
||||
{
|
||||
@@ -35,7 +35,7 @@ namespace Microsoft.SqlTools.Hosting
|
||||
{
|
||||
return Keys.GetString(Keys.CredentialsServiceInvalidCriticalHandle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string CredentialsServicePasswordLengthExceeded
|
||||
{
|
||||
@@ -43,7 +43,7 @@ namespace Microsoft.SqlTools.Hosting
|
||||
{
|
||||
return Keys.GetString(Keys.CredentialsServicePasswordLengthExceeded);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string CredentialsServiceTargetForDelete
|
||||
{
|
||||
@@ -51,7 +51,7 @@ namespace Microsoft.SqlTools.Hosting
|
||||
{
|
||||
return Keys.GetString(Keys.CredentialsServiceTargetForDelete);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string CredentialsServiceTargetForLookup
|
||||
{
|
||||
@@ -59,7 +59,7 @@ namespace Microsoft.SqlTools.Hosting
|
||||
{
|
||||
return Keys.GetString(Keys.CredentialsServiceTargetForLookup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string CredentialServiceWin32CredentialDisposed
|
||||
{
|
||||
@@ -67,7 +67,7 @@ namespace Microsoft.SqlTools.Hosting
|
||||
{
|
||||
return Keys.GetString(Keys.CredentialServiceWin32CredentialDisposed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string ServiceAlreadyRegistered
|
||||
{
|
||||
@@ -75,7 +75,7 @@ namespace Microsoft.SqlTools.Hosting
|
||||
{
|
||||
return Keys.GetString(Keys.ServiceAlreadyRegistered);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string MultipleServicesFound
|
||||
{
|
||||
@@ -83,7 +83,7 @@ namespace Microsoft.SqlTools.Hosting
|
||||
{
|
||||
return Keys.GetString(Keys.MultipleServicesFound);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string IncompatibleServiceForExtensionLoader
|
||||
{
|
||||
@@ -91,7 +91,7 @@ namespace Microsoft.SqlTools.Hosting
|
||||
{
|
||||
return Keys.GetString(Keys.IncompatibleServiceForExtensionLoader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string ServiceProviderNotSet
|
||||
{
|
||||
@@ -99,7 +99,7 @@ namespace Microsoft.SqlTools.Hosting
|
||||
{
|
||||
return Keys.GetString(Keys.ServiceProviderNotSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string ServiceNotFound
|
||||
{
|
||||
@@ -107,7 +107,7 @@ namespace Microsoft.SqlTools.Hosting
|
||||
{
|
||||
return Keys.GetString(Keys.ServiceNotFound);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string ServiceNotOfExpectedType
|
||||
{
|
||||
@@ -115,7 +115,7 @@ namespace Microsoft.SqlTools.Hosting
|
||||
{
|
||||
return Keys.GetString(Keys.ServiceNotOfExpectedType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string HostingUnexpectedEndOfStream
|
||||
{
|
||||
@@ -123,7 +123,7 @@ namespace Microsoft.SqlTools.Hosting
|
||||
{
|
||||
return Keys.GetString(Keys.HostingUnexpectedEndOfStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string HostingHeaderMissingColon
|
||||
{
|
||||
@@ -131,7 +131,7 @@ namespace Microsoft.SqlTools.Hosting
|
||||
{
|
||||
return Keys.GetString(Keys.HostingHeaderMissingColon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string HostingHeaderMissingContentLengthHeader
|
||||
{
|
||||
@@ -139,7 +139,7 @@ namespace Microsoft.SqlTools.Hosting
|
||||
{
|
||||
return Keys.GetString(Keys.HostingHeaderMissingContentLengthHeader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string HostingHeaderMissingContentLengthValue
|
||||
{
|
||||
@@ -147,7 +147,7 @@ namespace Microsoft.SqlTools.Hosting
|
||||
{
|
||||
return Keys.GetString(Keys.HostingHeaderMissingContentLengthValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
public class Keys
|
||||
@@ -155,52 +155,52 @@ namespace Microsoft.SqlTools.Hosting
|
||||
static ResourceManager resourceManager = new ResourceManager("Microsoft.SqlTools.Hosting.Localization.SR", typeof(SR).GetTypeInfo().Assembly);
|
||||
|
||||
static CultureInfo _culture = null;
|
||||
|
||||
|
||||
public const string CredentialsServiceInvalidCriticalHandle = "CredentialsServiceInvalidCriticalHandle";
|
||||
|
||||
|
||||
public const string CredentialsServicePasswordLengthExceeded = "CredentialsServicePasswordLengthExceeded";
|
||||
|
||||
|
||||
public const string CredentialsServiceTargetForDelete = "CredentialsServiceTargetForDelete";
|
||||
|
||||
|
||||
public const string CredentialsServiceTargetForLookup = "CredentialsServiceTargetForLookup";
|
||||
|
||||
|
||||
public const string CredentialServiceWin32CredentialDisposed = "CredentialServiceWin32CredentialDisposed";
|
||||
|
||||
|
||||
public const string ServiceAlreadyRegistered = "ServiceAlreadyRegistered";
|
||||
|
||||
|
||||
public const string MultipleServicesFound = "MultipleServicesFound";
|
||||
|
||||
|
||||
public const string IncompatibleServiceForExtensionLoader = "IncompatibleServiceForExtensionLoader";
|
||||
|
||||
|
||||
public const string ServiceProviderNotSet = "ServiceProviderNotSet";
|
||||
|
||||
|
||||
public const string ServiceNotFound = "ServiceNotFound";
|
||||
|
||||
|
||||
public const string ServiceNotOfExpectedType = "ServiceNotOfExpectedType";
|
||||
|
||||
|
||||
public const string HostingUnexpectedEndOfStream = "HostingUnexpectedEndOfStream";
|
||||
|
||||
|
||||
public const string HostingHeaderMissingColon = "HostingHeaderMissingColon";
|
||||
|
||||
|
||||
public const string HostingHeaderMissingContentLengthHeader = "HostingHeaderMissingContentLengthHeader";
|
||||
|
||||
|
||||
public const string HostingHeaderMissingContentLengthValue = "HostingHeaderMissingContentLengthValue";
|
||||
|
||||
|
||||
|
||||
public const string CredentialsServiceInvalidCriticalHandle = "CredentialsServiceInvalidCriticalHandle";
|
||||
|
||||
|
||||
public const string CredentialsServicePasswordLengthExceeded = "CredentialsServicePasswordLengthExceeded";
|
||||
|
||||
|
||||
public const string CredentialsServiceTargetForDelete = "CredentialsServiceTargetForDelete";
|
||||
|
||||
|
||||
public const string CredentialsServiceTargetForLookup = "CredentialsServiceTargetForLookup";
|
||||
|
||||
|
||||
public const string CredentialServiceWin32CredentialDisposed = "CredentialServiceWin32CredentialDisposed";
|
||||
|
||||
|
||||
public const string ServiceAlreadyRegistered = "ServiceAlreadyRegistered";
|
||||
|
||||
|
||||
public const string MultipleServicesFound = "MultipleServicesFound";
|
||||
|
||||
|
||||
public const string IncompatibleServiceForExtensionLoader = "IncompatibleServiceForExtensionLoader";
|
||||
|
||||
|
||||
public const string ServiceProviderNotSet = "ServiceProviderNotSet";
|
||||
|
||||
|
||||
public const string ServiceNotFound = "ServiceNotFound";
|
||||
|
||||
|
||||
public const string ServiceNotOfExpectedType = "ServiceNotOfExpectedType";
|
||||
|
||||
|
||||
public const string HostingUnexpectedEndOfStream = "HostingUnexpectedEndOfStream";
|
||||
|
||||
|
||||
public const string HostingHeaderMissingColon = "HostingHeaderMissingColon";
|
||||
|
||||
|
||||
public const string HostingHeaderMissingContentLengthHeader = "HostingHeaderMissingContentLengthHeader";
|
||||
|
||||
|
||||
public const string HostingHeaderMissingContentLengthValue = "HostingHeaderMissingContentLengthValue";
|
||||
|
||||
|
||||
private Keys()
|
||||
{ }
|
||||
@@ -221,7 +221,7 @@ namespace Microsoft.SqlTools.Hosting
|
||||
{
|
||||
return resourceManager.GetString(key, _culture);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user