mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-20 01:25:41 -05:00
Adding decoding of multipart identifiers, default schema workaround (#295)
This change adds a couple things _Multipart Identifier Decoding_ The ability to decode a multipart identifier (with or without escaping) has been added to the SqlScriptFormatter utility class. This code is utilized to split a table name provided to the edit/initialize request into schema and table name. _Default Schema Workaround_ The code that retrieves the SMO metadata objects originally used the `[]` operator to access the objects. Due to a bug(?) in SMO, this results in problems when loading tables without a default schema (in our case if you're logged in as SA). Using the metadata object constructors gets around this issue, we are explicitly using them. * Adding decoding of multipart identifiers Adding code fix for default schema issue * Adding some more localizable strings for errors when loading metadata * Adding localization files... again? * Changes as per pull request comments
This commit is contained in:
@@ -429,6 +429,22 @@ namespace Microsoft.SqlTools.ServiceLayer
|
||||
}
|
||||
}
|
||||
|
||||
public static string EditDataMetadataObjectNameRequired
|
||||
{
|
||||
get
|
||||
{
|
||||
return Keys.GetString(Keys.EditDataMetadataObjectNameRequired);
|
||||
}
|
||||
}
|
||||
|
||||
public static string EditDataMetadataTooManyIdentifiers
|
||||
{
|
||||
get
|
||||
{
|
||||
return Keys.GetString(Keys.EditDataMetadataTooManyIdentifiers);
|
||||
}
|
||||
}
|
||||
|
||||
public static string EditDataFilteringNegativeLimit
|
||||
{
|
||||
get
|
||||
@@ -861,6 +877,14 @@ namespace Microsoft.SqlTools.ServiceLayer
|
||||
}
|
||||
}
|
||||
|
||||
public static string SqlScriptFormatterMultipartDecodeFail
|
||||
{
|
||||
get
|
||||
{
|
||||
return Keys.GetString(Keys.SqlScriptFormatterMultipartDecodeFail);
|
||||
}
|
||||
}
|
||||
|
||||
public static string ConnectionServiceListDbErrorNotConnected(string uri)
|
||||
{
|
||||
return Keys.GetString(Keys.ConnectionServiceListDbErrorNotConnected, uri);
|
||||
@@ -1128,6 +1152,12 @@ namespace Microsoft.SqlTools.ServiceLayer
|
||||
public const string EditDataMetadataNotExtended = "EditDataMetadataNotExtended";
|
||||
|
||||
|
||||
public const string EditDataMetadataObjectNameRequired = "EditDataMetadataObjectNameRequired";
|
||||
|
||||
|
||||
public const string EditDataMetadataTooManyIdentifiers = "EditDataMetadataTooManyIdentifiers";
|
||||
|
||||
|
||||
public const string EditDataFilteringNegativeLimit = "EditDataFilteringNegativeLimit";
|
||||
|
||||
|
||||
@@ -1293,6 +1323,9 @@ namespace Microsoft.SqlTools.ServiceLayer
|
||||
public const string SqlScriptFormatterDecimalMissingPrecision = "SqlScriptFormatterDecimalMissingPrecision";
|
||||
|
||||
|
||||
public const string SqlScriptFormatterMultipartDecodeFail = "SqlScriptFormatterMultipartDecodeFail";
|
||||
|
||||
|
||||
private Keys()
|
||||
{ }
|
||||
|
||||
|
||||
@@ -382,6 +382,14 @@
|
||||
<value>Table metadata does not have extended properties</value>
|
||||
<comment></comment>
|
||||
</data>
|
||||
<data name="EditDataMetadataObjectNameRequired" xml:space="preserve">
|
||||
<value>A object name must be provided</value>
|
||||
<comment></comment>
|
||||
</data>
|
||||
<data name="EditDataMetadataTooManyIdentifiers" xml:space="preserve">
|
||||
<value>Explicitly specifying server or database is not supported</value>
|
||||
<comment></comment>
|
||||
</data>
|
||||
<data name="EditDataFilteringNegativeLimit" xml:space="preserve">
|
||||
<value>Result limit cannot be negative</value>
|
||||
<comment></comment>
|
||||
@@ -603,4 +611,8 @@
|
||||
<value>Decimal column is missing numeric precision or numeric scale</value>
|
||||
<comment></comment>
|
||||
</data>
|
||||
<data name="SqlScriptFormatterMultipartDecodeFail" xml:space="preserve">
|
||||
<value>Multipart identifier is incorrectly formatted</value>
|
||||
<comment></comment>
|
||||
</data>
|
||||
</root>
|
||||
|
||||
@@ -180,6 +180,10 @@ EditDataSessionAlreadyInitializing = Edit session has already been initialized o
|
||||
|
||||
EditDataMetadataNotExtended = Table metadata does not have extended properties
|
||||
|
||||
EditDataMetadataObjectNameRequired = A object name must be provided
|
||||
|
||||
EditDataMetadataTooManyIdentifiers = Explicitly specifying server or database is not supported
|
||||
|
||||
EditDataFilteringNegativeLimit = Result limit cannot be negative
|
||||
|
||||
EditDataUnsupportedObjectType(string typeName) = Database object {0} cannot be used for editing.
|
||||
@@ -298,3 +302,5 @@ TestLocalizationConstant = EN_LOCALIZATION
|
||||
# Utilities
|
||||
|
||||
SqlScriptFormatterDecimalMissingPrecision = Decimal column is missing numeric precision or numeric scale
|
||||
|
||||
SqlScriptFormatterMultipartDecodeFail = Multipart identifier is incorrectly formatted
|
||||
|
||||
@@ -601,6 +601,21 @@
|
||||
<target state="new">NULL</target>
|
||||
<note></note>
|
||||
</trans-unit>
|
||||
<trans-unit id="SqlScriptFormatterMultipartDecodeFail">
|
||||
<source>Multipart identifier is incorrectly formatted</source>
|
||||
<target state="new">Multipart identifier is incorrectly formatted</target>
|
||||
<note></note>
|
||||
</trans-unit>
|
||||
<trans-unit id="EditDataMetadataObjectNameRequired">
|
||||
<source>A object name must be provided</source>
|
||||
<target state="new">A object name must be provided</target>
|
||||
<note></note>
|
||||
</trans-unit>
|
||||
<trans-unit id="EditDataMetadataTooManyIdentifiers">
|
||||
<source>Explicitly specifying server or database is not supported</source>
|
||||
<target state="new">Explicitly specifying server or database is not supported</target>
|
||||
<note></note>
|
||||
</trans-unit>
|
||||
<trans-unit id="EditDataMetadataNotExtended">
|
||||
<source>Table metadata does not have extended properties</source>
|
||||
<target state="new">Table metadata does not have extended properties</target>
|
||||
|
||||
Reference in New Issue
Block a user