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:
Kevin Cunnane
2017-05-26 14:19:18 -07:00
committed by GitHub
parent a4c630d5d3
commit 29c9b5fa51
8 changed files with 109 additions and 27 deletions

View File

@@ -23,10 +23,11 @@ namespace Microsoft.SqlTools.ServiceLayer.Workspace
{
#region Private Fields
private const string UntitledScheme = "untitled";
private static readonly HashSet<string> fileUriSchemes = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"file",
"untitled",
UntitledScheme,
"tsqloutput"
};
@@ -101,6 +102,11 @@ namespace Microsoft.SqlTools.ServiceLayer.Workspace
ScriptFile scriptFile = null;
if (!this.workspaceFiles.TryGetValue(keyName, out scriptFile))
{
if (IsUntitled(resolvedFilePath))
{
// It's not a registered untitled file, so any attempt to read from disk will fail as it's in memory
return null;
}
// This method allows FileNotFoundException to bubble up
// if the file isn't found.
using (FileStream fileStream = new FileStream(resolvedFilePath, FileMode.Open, FileAccess.Read))
@@ -259,16 +265,16 @@ namespace Microsoft.SqlTools.ServiceLayer.Workspace
relativePath));
return combinedPath;
}
internal static bool IsPathInMemoryOrNonFileUri(string path)
{
string scheme = GetScheme(path);
if (!string.IsNullOrEmpty(scheme))
{
return !scheme.Equals("file");
}
return false;
}
}
internal static bool IsPathInMemoryOrNonFileUri(string path)
{
string scheme = GetScheme(path);
if (!string.IsNullOrEmpty(scheme))
{
return !scheme.Equals("file");
}
return false;
}
public static string GetScheme(string uri)
{
@@ -287,17 +293,27 @@ namespace Microsoft.SqlTools.ServiceLayer.Workspace
return match.Groups[1].Value;
}
return null;
}
private bool IsNonFileUri(string path)
{
string scheme = GetScheme(path);
if (!string.IsNullOrEmpty(scheme))
{
return !fileUriSchemes.Contains(scheme); ;
}
return false;
}
}
private bool IsNonFileUri(string path)
{
string scheme = GetScheme(path);
if (!string.IsNullOrEmpty(scheme))
{
return !fileUriSchemes.Contains(scheme); ;
}
return false;
}
private bool IsUntitled(string path)
{
string scheme = GetScheme(path);
if (scheme != null && scheme.Length > 0)
{
return string.Compare(UntitledScheme, scheme, StringComparison.OrdinalIgnoreCase) == 0;
}
return false;
}
#endregion