mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-21 01:25:42 -05:00
Edit data schema and SQLAuth support (#362)
- Fix non-dbo schema support, adding in specific parameter for schema. If this isn't specified, the code will still fall back to splitting up the objectName if it's a multi-part identifier. This ensures that input from action bar or CLI scenarios can still work since we'll accept multi-part names there - Fix failure to edit data on Azure. This was failing as the SMO query to get the table info failed when cloning SqlConnection. In .Net Core it currently loses the passwor unless PersistSecurity = true. - Fix bug in error reporting where ID and Method were switched. This caused bad breaks and was caught during integration testing
This commit is contained in:
@@ -277,6 +277,33 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.EditData
|
||||
Assert.Empty(eds.ActiveSessions);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("table", "myschema", new [] { "myschema", "table" })] // Use schema
|
||||
[InlineData("table", null, new [] { "table" })] // skip schema
|
||||
[InlineData("schema.table", "myschema", new [] { "myschema", "schema.table"})] // Use schema
|
||||
[InlineData("schema.table", null, new [] { "schema", "table"})] // Split object name into schema
|
||||
public void ShouldUseSchemaNameIfDefined(string objName, string schemaName, string[] expectedNameParts)
|
||||
{
|
||||
// Setup: Create an edit data service without a session
|
||||
var eds = new EditDataService(null, null, null);
|
||||
|
||||
// If:
|
||||
// ... I have init params with an object and schema parameter
|
||||
var initParams = new EditInitializeParams
|
||||
{
|
||||
ObjectName = objName,
|
||||
SchemaName = schemaName,
|
||||
OwnerUri = Common.OwnerUri,
|
||||
ObjectType = "table"
|
||||
};
|
||||
|
||||
// ... And I get named parts for that
|
||||
string[] nameParts = EditSession.GetEditTargetName(initParams);
|
||||
|
||||
// Then:
|
||||
Assert.Equal(expectedNameParts, nameParts);
|
||||
}
|
||||
|
||||
private static async Task<EditSession> GetDefaultSession()
|
||||
{
|
||||
// ... Create a session with a proper query and metadata
|
||||
|
||||
Reference in New Issue
Block a user