mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-18 01:25:41 -05:00
Adding new setting for numeric or text bit display (#243)
Adding a new setting to query execution setting that will change the display value we generate for `BIT` columns. The new setting is `DefaultDisplayBitAsNumber`. If true, bit columns will be displayed as 1 or 0. If false, they'll be displayed as true or false. The default value is true, to keep parity with SSMS behavior. Enables us to solve https://github.com/Microsoft/vscode-mssql/issues/690 and https://github.com/Microsoft/vscode-mssql/issues/513
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.SqlContext
|
||||
@@ -33,12 +34,17 @@ namespace Microsoft.SqlTools.ServiceLayer.SqlContext
|
||||
/// Default selection of returning an actual XML showplan with all batches
|
||||
/// Do not return any execution plan by default
|
||||
/// </summary>
|
||||
private ExecutionPlanOptions DefaultExecutionPlanOptions = new ExecutionPlanOptions()
|
||||
private static readonly ExecutionPlanOptions DefaultExecutionPlanOptions = new ExecutionPlanOptions
|
||||
{
|
||||
IncludeActualExecutionPlanXml = false,
|
||||
IncludeEstimatedExecutionPlanXml = false
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Default option for displaying a bit column as a number. (defacto standard as per SSMS)
|
||||
/// </summary>
|
||||
private const bool DefaultDisplayBitAsNumber = true;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Member Variables
|
||||
@@ -51,6 +57,8 @@ namespace Microsoft.SqlTools.ServiceLayer.SqlContext
|
||||
|
||||
private ExecutionPlanOptions? executionPlanOptions;
|
||||
|
||||
private bool? displayBitAsNumber;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
@@ -64,24 +72,46 @@ namespace Microsoft.SqlTools.ServiceLayer.SqlContext
|
||||
set { batchSeparator = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maximum number of characters to store in temp file for long character fields and binary
|
||||
/// fields. Will use a default if a value was not configured.
|
||||
/// </summary>
|
||||
public int MaxCharsToStore
|
||||
{
|
||||
get { return maxCharsToStore ?? DefaultMaxCharsToStore; }
|
||||
set { maxCharsToStore = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maximum number of characters to store in temp file for XML columns. Will use a default
|
||||
/// value if one was not configured.
|
||||
/// </summary>
|
||||
public int MaxXmlCharsToStore
|
||||
{
|
||||
get { return maxXmlCharsToStore ?? DefaultMaxXmlCharsToStore; }
|
||||
set { maxXmlCharsToStore = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Options for returning execution plans when executing queries
|
||||
/// </summary>
|
||||
public ExecutionPlanOptions ExecutionPlanOptions
|
||||
{
|
||||
get { return executionPlanOptions ?? DefaultExecutionPlanOptions; }
|
||||
set { executionPlanOptions = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines how to generate display value for bit columns. If <c>true</c>, bit columns
|
||||
/// will be rendered as "1" or "0". If <c>false</c>, bit columns will be rendered as
|
||||
/// "true" or "false"
|
||||
/// </summary>
|
||||
public bool DisplayBitAsNumber
|
||||
{
|
||||
get { return displayBitAsNumber ?? DefaultDisplayBitAsNumber; }
|
||||
set { displayBitAsNumber = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
@@ -96,6 +126,7 @@ namespace Microsoft.SqlTools.ServiceLayer.SqlContext
|
||||
MaxCharsToStore = newSettings.MaxCharsToStore;
|
||||
MaxXmlCharsToStore = newSettings.MaxXmlCharsToStore;
|
||||
ExecutionPlanOptions = newSettings.ExecutionPlanOptions;
|
||||
DisplayBitAsNumber = newSettings.DisplayBitAsNumber;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user