Add Always Encrypted Parameterization Functionality (#953)

This commit is contained in:
Jeff Trimmer
2020-05-05 12:01:24 -07:00
committed by GitHub
parent e3f1789f18
commit 82eed06847
16 changed files with 1618 additions and 9 deletions

View File

@@ -3068,6 +3068,41 @@ namespace Microsoft.SqlTools.ServiceLayer
return Keys.GetString(Keys.QueryServiceSaveAsFail, fileName, message);
}
public static string ParameterizationDetails(string variableName, string sqlDbType, int size, int precision, int scale, string sqlValue)
{
return Keys.GetString(Keys.ParameterizationDetails, variableName, sqlDbType, size, precision, scale, sqlValue);
}
public static string ErrorMessageHeader(int lineNumber)
{
return Keys.GetString(Keys.ErrorMessageHeader, lineNumber);
}
public static string ErrorMessage(string variableName, string sqlDataType, string literalValue)
{
return Keys.GetString(Keys.ErrorMessage, variableName, sqlDataType, literalValue);
}
public static string DateTimeErrorMessage(string variableName, string sqlDataType, string literalValue)
{
return Keys.GetString(Keys.DateTimeErrorMessage, variableName, sqlDataType, literalValue);
}
public static string BinaryLiteralPrefixMissingError(string variableName, string sqlDataType, string literalValue)
{
return Keys.GetString(Keys.BinaryLiteralPrefixMissingError, variableName, sqlDataType, literalValue);
}
public static string ParsingErrorHeader(int lineNumber, int columnNumber)
{
return Keys.GetString(Keys.ParsingErrorHeader, lineNumber, columnNumber);
}
public static string ScriptTooLarge(int maxChars, int currentChars)
{
return Keys.GetString(Keys.ScriptTooLarge, maxChars, currentChars);
}
public static string SerializationServiceUnsupportedFormat(string formatName)
{
return Keys.GetString(Keys.SerializationServiceUnsupportedFormat, formatName);
@@ -3366,6 +3401,27 @@ namespace Microsoft.SqlTools.ServiceLayer
public const string SqlCmdUnsupportedToken = "SqlCmdUnsupportedToken";
public const string ParameterizationDetails = "ParameterizationDetails";
public const string ErrorMessageHeader = "ErrorMessageHeader";
public const string ErrorMessage = "ErrorMessage";
public const string DateTimeErrorMessage = "DateTimeErrorMessage";
public const string BinaryLiteralPrefixMissingError = "BinaryLiteralPrefixMissingError";
public const string ParsingErrorHeader = "ParsingErrorHeader";
public const string ScriptTooLarge = "ScriptTooLarge";
public const string SerializationServiceUnsupportedFormat = "SerializationServiceUnsupportedFormat";
@@ -4461,6 +4517,12 @@ namespace Microsoft.SqlTools.ServiceLayer
}
public static string GetString(string key, object arg0, object arg1, object arg2)
{
return string.Format(global::System.Globalization.CultureInfo.CurrentCulture, resourceManager.GetString(key, _culture), arg0, arg1, arg2);
}
public static string GetString(string key, object arg0, object arg1, object arg2, object arg3)
{
return string.Format(global::System.Globalization.CultureInfo.CurrentCulture, resourceManager.GetString(key, _culture), arg0, arg1, arg2, arg3);

View File

@@ -348,6 +348,41 @@
<value>Encountered unsupported token {0}</value>
<comment></comment>
</data>
<data name="ParameterizationDetails" xml:space="preserve">
<value>{0} will be converted to a Microsoft.Data.SqlClient.SqlParameter object with the following properties: SqlDbType = {1}, Size = {2}, Precision = {3}, Scale = {4}, SqlValue = {5}</value>
<comment>.
Parameters: 0 - variableName (string), 1 - sqlDbType (string), 2 - size (int), 3 - precision (int), 4 - scale (int), 5 - sqlValue (string) </comment>
</data>
<data name="ErrorMessageHeader" xml:space="preserve">
<value>Line {0}</value>
<comment>.
Parameters: 0 - lineNumber (int) </comment>
</data>
<data name="ErrorMessage" xml:space="preserve">
<value>Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType). Literal value: {2} </value>
<comment>.
Parameters: 0 - variableName (string), 1 - sqlDataType (string), 2 - literalValue (string) </comment>
</data>
<data name="DateTimeErrorMessage" xml:space="preserve">
<value>Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType), as it used an unsupported date/time format. Use one of the supported date/time formats. Literal value: {2}</value>
<comment>.
Parameters: 0 - variableName (string), 1 - sqlDataType (string), 2 - literalValue (string) </comment>
</data>
<data name="BinaryLiteralPrefixMissingError" xml:space="preserve">
<value>Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType), as prefix 0x is expected for a binary literals. Literal value: {2} </value>
<comment>.
Parameters: 0 - variableName (string), 1 - sqlDataType (string), 2 - literalValue (string) </comment>
</data>
<data name="ParsingErrorHeader" xml:space="preserve">
<value>Line {0}, column {1}</value>
<comment>.
Parameters: 0 - lineNumber (int), 1 - columnNumber (int) </comment>
</data>
<data name="ScriptTooLarge" xml:space="preserve">
<value>The current script is too large for Parameterization for Always Encrypted, please disable Parameterization for Always Encrypted in Query Options (Query &gt; Query Options &gt; Execution &gt; Advanced). Maximum allowable length: {0} characters, Current script length: {1} characters</value>
<comment>.
Parameters: 0 - maxChars (int), 1 - currentChars (int) </comment>
</data>
<data name="SerializationServiceUnsupportedFormat" xml:space="preserve">
<value>Unsupported Save Format: {0}</value>
<comment>.

View File

@@ -150,6 +150,22 @@ SqlCmdExitOnError = An error was encountered during execution of batch. Exiting.
SqlCmdUnsupportedToken = Encountered unsupported token {0}
### AutoParameterization for Always Encrypted strings
ParameterizationDetails (string variableName, string sqlDbType, int size, int precision, int scale, string sqlValue) = {0} will be converted to a Microsoft.Data.SqlClient.SqlParameter object with the following properties: SqlDbType = {1}, Size = {2}, Precision = {3}, Scale = {4}, SqlValue = {5}
ErrorMessageHeader(int lineNumber) = Line {0}
ErrorMessage (string variableName, string sqlDataType, string literalValue) = Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType). Literal value: {2}
DateTimeErrorMessage (string variableName, string sqlDataType, string literalValue) = Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType), as it used an unsupported date/time format. Use one of the supported date/time formats. Literal value: {2}
BinaryLiteralPrefixMissingError (string variableName, string sqlDataType, string literalValue) = Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType), as prefix 0x is expected for a binary literals. Literal value: {2}
ParsingErrorHeader (int lineNumber, int columnNumber) = Line {0}, column {1}
ScriptTooLarge (int maxChars, int currentChars) = The current script is too large for Parameterization for Always Encrypted, please disable Parameterization for Always Encrypted in Query Options (Query > Query Options > Execution > Advanced). Maximum allowable length: {0} characters, Current script length: {1} characters
############################################################################
# Serialization Service

View File

@@ -2056,11 +2056,6 @@
<target state="new">Encountered unsupported token {0}</target>
<note></note>
</trans-unit>
<trans-unit id="SqlAssessmentOperationExecuteCalledTwice">
<source>A SQL Assessment operation's Execute method should not be called more than once</source>
<target state="new">A SQL Assessment operation's Execute method should not be called more than once</target>
<note></note>
</trans-unit>
<trans-unit id="SqlAssessmentGenerateScriptTaskName">
<source>Generate SQL Assessment script</source>
<target state="new">Generate SQL Assessment script</target>
@@ -2081,6 +2076,48 @@
<target state="new">Unsupported engine edition {0}</target>
<note>.
Parameters: 0 - editionCode (int) </note>
</trans-unit>
<trans-unit id="ParameterizationDetails">
<source>{0} will be converted to a Microsoft.Data.SqlClient.SqlParameter object with the following properties: SqlDbType = {1}, Size = {2}, Precision = {3}, Scale = {4}, SqlValue = {5}</source>
<target state="new">{0} will be converted to a Microsoft.Data.SqlClient.SqlParameter object with the following properties: SqlDbType = {1}, Size = {2}, Precision = {3}, Scale = {4}, SqlValue = {5}</target>
<note>.
Parameters: 0 - variableName (string), 1 - sqlDbType (string), 2 - size (int), 3 - precision (int), 4 - scale (int), 5 - sqlValue (string) </note>
</trans-unit>
<trans-unit id="ErrorMessageHeader">
<source>Line {0}</source>
<target state="new">Line {0}</target>
<note>.
Parameters: 0 - lineNumber (int) </note>
</trans-unit>
<trans-unit id="ErrorMessage">
<source>Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType). Literal value: {2} </source>
<target state="new">Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType). Literal value: {2} </target>
<note>.
Parameters: 0 - variableName (string), 1 - sqlDataType (string), 2 - literalValue (string) </note>
</trans-unit>
<trans-unit id="DateTimeErrorMessage">
<source>Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType), as it used an unsupported date/time format. Use one of the supported date/time formats. Literal value: {2}</source>
<target state="new">Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType), as it used an unsupported date/time format. Use one of the supported date/time formats. Literal value: {2}</target>
<note>.
Parameters: 0 - variableName (string), 1 - sqlDataType (string), 2 - literalValue (string) </note>
</trans-unit>
<trans-unit id="BinaryLiteralPrefixMissingError">
<source>Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType), as prefix 0x is expected for a binary literals. Literal value: {2} </source>
<target state="new">Unable to convert {0} to a Microsoft.Data.SqlClient.SqlParameter object. The specified literal cannot be converted to {1}(Microsoft.Data.SqlDbType), as prefix 0x is expected for a binary literals. Literal value: {2} </target>
<note>.
Parameters: 0 - variableName (string), 1 - sqlDataType (string), 2 - literalValue (string) </note>
</trans-unit>
<trans-unit id="ParsingErrorHeader">
<source>Line {0}, column {1}</source>
<target state="new">Line {0}, column {1}</target>
<note>.
Parameters: 0 - lineNumber (int), 1 - columnNumber (int) </note>
</trans-unit>
<trans-unit id="ScriptTooLarge">
<source>The current script is too large for Parameterization for Always Encrypted, please disable Parameterization for Always Encrypted in Query Options (Query &gt; Query Options &gt; Execution &gt; Advanced). Maximum allowable length: {0} characters, Current script length: {1} characters</source>
<target state="new">The current script is too large for Parameterization for Always Encrypted, please disable Parameterization for Always Encrypted in Query Options (Query &gt; Query Options &gt; Execution &gt; Advanced). Maximum allowable length: {0} characters, Current script length: {1} characters</target>
<note>.
Parameters: 0 - maxChars (int), 1 - currentChars (int) </note>
</trans-unit>
<trans-unit id="ProjectExtractTaskName">
<source>Extract project files</source>