mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 18:47:57 -05:00
added a binding queue for oe to force one operation on a node at a time (#441)
* added a binding queue for oe to force one operation on a node at a time * setting node subtype to temporal for temporal tables * disposing oe service on shutdown
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Microsoft.SqlTools.Credentials;
|
using Microsoft.SqlTools.Credentials;
|
||||||
using Microsoft.SqlTools.Extensibility;
|
using Microsoft.SqlTools.Extensibility;
|
||||||
using Microsoft.SqlTools.Hosting;
|
using Microsoft.SqlTools.Hosting;
|
||||||
@@ -112,12 +113,23 @@ namespace Microsoft.SqlTools.ServiceLayer
|
|||||||
provider.RegisterSingleService(service.ServiceType, service);
|
provider.RegisterSingleService(service.ServiceType, service);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ServiceHost serviceHost = host as ServiceHost;
|
||||||
foreach (IHostedService service in provider.GetServices<IHostedService>())
|
foreach (IHostedService service in provider.GetServices<IHostedService>())
|
||||||
{
|
{
|
||||||
// Initialize all hosted services, and register them in the service provider for their requested
|
// Initialize all hosted services, and register them in the service provider for their requested
|
||||||
// service type. This ensures that when searching for the ConnectionService you can get it without
|
// service type. This ensures that when searching for the ConnectionService you can get it without
|
||||||
// searching for an IHostedService of type ConnectionService
|
// searching for an IHostedService of type ConnectionService
|
||||||
service.InitializeService(host);
|
service.InitializeService(host);
|
||||||
|
|
||||||
|
IDisposable disposable = service as IDisposable;
|
||||||
|
if (serviceHost != null && disposable != null)
|
||||||
|
{
|
||||||
|
serviceHost.RegisterShutdownTask(async (shutdownParams, shutdownRequestContext) =>
|
||||||
|
{
|
||||||
|
disposable.Dispose();
|
||||||
|
await Task.FromResult(0);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,17 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes
|
|||||||
// some nodes may need to set it
|
// some nodes may need to set it
|
||||||
NodeValue = value;
|
NodeValue = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private object buildingMetadataLock = new object();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Event which tells if MetadataProvider is built fully or not
|
||||||
|
/// </summary>
|
||||||
|
public object BuildingMetadataLock
|
||||||
|
{
|
||||||
|
get { return this.buildingMetadataLock; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Value describing this node
|
/// Value describing this node
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ using Microsoft.SqlTools.Hosting;
|
|||||||
using Microsoft.SqlTools.Hosting.Protocol;
|
using Microsoft.SqlTools.Hosting.Protocol;
|
||||||
using Microsoft.SqlTools.ServiceLayer.Connection;
|
using Microsoft.SqlTools.ServiceLayer.Connection;
|
||||||
using Microsoft.SqlTools.ServiceLayer.Connection.Contracts;
|
using Microsoft.SqlTools.ServiceLayer.Connection.Contracts;
|
||||||
|
using Microsoft.SqlTools.ServiceLayer.LanguageServices;
|
||||||
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts;
|
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts;
|
||||||
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes;
|
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes;
|
||||||
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel;
|
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel;
|
||||||
@@ -32,16 +33,19 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
|
|||||||
/// The APIs used for this are modeled closely on the VSCode TreeExplorerNodeProvider API.
|
/// The APIs used for this are modeled closely on the VSCode TreeExplorerNodeProvider API.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(IHostedService))]
|
[Export(typeof(IHostedService))]
|
||||||
public class ObjectExplorerService : HostedService<ObjectExplorerService>, IComposableService, IHostedService
|
public class ObjectExplorerService : HostedService<ObjectExplorerService>, IComposableService, IHostedService, IDisposable
|
||||||
{
|
{
|
||||||
internal const string uriPrefix = "objectexplorer://";
|
internal const string uriPrefix = "objectexplorer://";
|
||||||
|
|
||||||
// Instance of the connection service, used to get the connection info for a given owner URI
|
// Instance of the connection service, used to get the connection info for a given owner URI
|
||||||
private ConnectionService connectionService;
|
private ConnectionService connectionService;
|
||||||
private IProtocolEndpoint serviceHost;
|
private IProtocolEndpoint serviceHost;
|
||||||
private ConcurrentDictionary<string, ObjectExplorerSession> sessionMap;
|
private ConcurrentDictionary<string, ObjectExplorerSession> sessionMap;
|
||||||
private readonly Lazy<Dictionary<string, HashSet<ChildFactory>>> applicableNodeChildFactories;
|
private readonly Lazy<Dictionary<string, HashSet<ChildFactory>>> applicableNodeChildFactories;
|
||||||
private IMultiServiceProvider serviceProvider;
|
private IMultiServiceProvider serviceProvider;
|
||||||
|
private ConnectedBindingQueue bindingQueue = new ConnectedBindingQueue();
|
||||||
|
private const int PrepopulateBindTimeout = 10000;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This timeout limits the amount of time that object explorer tasks can take to complete
|
/// This timeout limits the amount of time that object explorer tasks can take to complete
|
||||||
@@ -83,8 +87,8 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
|
|||||||
{
|
{
|
||||||
return new ReadOnlyCollection<string>(sessionMap.Keys.ToList());
|
return new ReadOnlyCollection<string>(sessionMap.Keys.ToList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// As an <see cref="IComposableService"/>, this will be set whenever the service is initialized
|
/// As an <see cref="IComposableService"/>, this will be set whenever the service is initialized
|
||||||
/// via an <see cref="IMultiServiceProvider"/>
|
/// via an <see cref="IMultiServiceProvider"/>
|
||||||
@@ -198,7 +202,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
await HandleRequestAsync(expandNode, context, "HandleExpandRequest");
|
await HandleRequestAsync(expandNode, context, "HandleExpandRequest");
|
||||||
}
|
}
|
||||||
|
|
||||||
internal async Task HandleRefreshRequest(RefreshParams refreshParams, RequestContext<bool> context)
|
internal async Task HandleRefreshRequest(RefreshParams refreshParams, RequestContext<bool> context)
|
||||||
@@ -280,7 +284,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RunCreateSessionTask(ConnectionDetails connectionDetails, string uri)
|
private void RunCreateSessionTask(ConnectionDetails connectionDetails, string uri)
|
||||||
{
|
{
|
||||||
Logger.Write(LogLevel.Normal, "Creating OE session");
|
Logger.Write(LogLevel.Normal, "Creating OE session");
|
||||||
CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
|
CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
|
||||||
@@ -288,9 +292,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
|
|||||||
{
|
{
|
||||||
Task task = CreateSessionAsync(connectionDetails, uri, cancellationTokenSource.Token);
|
Task task = CreateSessionAsync(connectionDetails, uri, cancellationTokenSource.Token);
|
||||||
CreateSessionTask = task;
|
CreateSessionTask = task;
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
ObjectExplorerTaskResult result = await RunTaskWithTimeout(task,
|
ObjectExplorerTaskResult result = await RunTaskWithTimeout(task,
|
||||||
settings?.CreateSessionTimeout ?? ObjectExplorerSettings.DefaultCreateSessionTimeout);
|
settings?.CreateSessionTimeout ?? ObjectExplorerSettings.DefaultCreateSessionTimeout);
|
||||||
|
|
||||||
if (result != null && !result.IsCompleted)
|
if (result != null && !result.IsCompleted)
|
||||||
@@ -338,7 +342,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
|
|||||||
RootNode = session.Root.ToNodeInfo(),
|
RootNode = session.Root.ToNodeInfo(),
|
||||||
SessionId = uri,
|
SessionId = uri,
|
||||||
ErrorMessage = session.ErrorMessage
|
ErrorMessage = session.ErrorMessage
|
||||||
|
|
||||||
};
|
};
|
||||||
await serviceHost.SendEvent(CreateSessionCompleteNotification.Type, response);
|
await serviceHost.SendEvent(CreateSessionCompleteNotification.Type, response);
|
||||||
return response;
|
return response;
|
||||||
@@ -351,21 +355,54 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
|
|||||||
{
|
{
|
||||||
return await Task.Factory.StartNew(() =>
|
return await Task.Factory.StartNew(() =>
|
||||||
{
|
{
|
||||||
NodeInfo[] nodes = null;
|
return QueueExpandNodeRequest(session, nodePath, forceRefresh);
|
||||||
TreeNode node = session.Root.FindNodeByPath(nodePath);
|
});
|
||||||
if(node != null)
|
}
|
||||||
|
internal ExpandResponse QueueExpandNodeRequest(ObjectExplorerSession session, string nodePath, bool forceRefresh = false)
|
||||||
|
{
|
||||||
|
NodeInfo[] nodes = null;
|
||||||
|
TreeNode node = session.Root.FindNodeByPath(nodePath);
|
||||||
|
ExpandResponse response = new ExpandResponse { Nodes = new NodeInfo[] { }, ErrorMessage = node.ErrorMessage, SessionId = session.Uri, NodePath = nodePath };
|
||||||
|
|
||||||
|
if (node != null && Monitor.TryEnter(node.BuildingMetadataLock, LanguageService.OnConnectionWaitTimeout))
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (forceRefresh)
|
QueueItem queueItem = bindingQueue.QueueBindingOperation(
|
||||||
|
key: session.Uri,
|
||||||
|
bindingTimeout: PrepopulateBindTimeout,
|
||||||
|
waitForLockTimeout: PrepopulateBindTimeout,
|
||||||
|
bindOperation: (bindingContext, cancelToken) =>
|
||||||
|
{
|
||||||
|
|
||||||
|
if (forceRefresh)
|
||||||
|
{
|
||||||
|
nodes = node.Refresh().Select(x => x.ToNodeInfo()).ToArray();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nodes = node.Expand().Select(x => x.ToNodeInfo()).ToArray();
|
||||||
|
}
|
||||||
|
response.Nodes = nodes;
|
||||||
|
response.ErrorMessage = node.ErrorMessage;
|
||||||
|
return response;
|
||||||
|
});
|
||||||
|
|
||||||
|
queueItem.ItemProcessed.WaitOne();
|
||||||
|
if (queueItem.GetResultAsT<ExpandResponse>() != null)
|
||||||
{
|
{
|
||||||
nodes = node.Refresh().Select(x => x.ToNodeInfo()).ToArray();
|
response = queueItem.GetResultAsT<ExpandResponse>();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nodes = node.Expand().Select(x => x.ToNodeInfo()).ToArray();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new ExpandResponse { Nodes = nodes, ErrorMessage = node.ErrorMessage, SessionId = session.Uri, NodePath = nodePath };
|
catch
|
||||||
});
|
{
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Monitor.Exit(node.BuildingMetadataLock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -590,6 +627,14 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer
|
|||||||
public Exception Exception { get; set; }
|
public Exception Exception { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
if (bindingQueue != null)
|
||||||
|
{
|
||||||
|
bindingQueue.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal class ObjectExplorerSession
|
internal class ObjectExplorerSession
|
||||||
{
|
{
|
||||||
private ConnectionService connectionService;
|
private ConnectionService connectionService;
|
||||||
|
|||||||
@@ -128,6 +128,15 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
|
|||||||
}
|
}
|
||||||
typeName += ")";
|
typeName += ")";
|
||||||
break;
|
break;
|
||||||
|
case SqlDataType.Numeric:
|
||||||
|
case SqlDataType.Decimal:
|
||||||
|
typeName += $"({dataType.NumericPrecision},{dataType.NumericScale})";
|
||||||
|
break;
|
||||||
|
case SqlDataType.DateTime2:
|
||||||
|
case SqlDataType.Time:
|
||||||
|
case SqlDataType.DateTimeOffset:
|
||||||
|
typeName += $"({dataType.NumericScale})";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return typeName;
|
return typeName;
|
||||||
|
|||||||
@@ -29,6 +29,26 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
|
|||||||
|
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string GetNodeSubType(object context)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Table table = context as Table;
|
||||||
|
if (table != null && table.TemporalType != TableTemporalType.None)
|
||||||
|
{
|
||||||
|
return "Temporal";
|
||||||
|
}
|
||||||
|
// return string.Empty;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
//Ignore the exception and just not change create custom name
|
||||||
|
}
|
||||||
|
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -77,6 +77,7 @@
|
|||||||
</Filters>
|
</Filters>
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property Name="IsSystemVersioned" ValidFor="Sql2016|Sql2017|AzureV12"/>
|
<Property Name="IsSystemVersioned" ValidFor="Sql2016|Sql2017|AzureV12"/>
|
||||||
|
<Property Name="TemporalType" ValidFor="Sql2016|Sql2017|AzureV12"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Child Name="SystemTables" IsSystemObject="1"/>
|
<Child Name="SystemTables" IsSystemObject="1"/>
|
||||||
<!--
|
<!--
|
||||||
@@ -201,6 +202,7 @@
|
|||||||
<Value>IndexKeyType.DriUniqueKey</Value>
|
<Value>IndexKeyType.DriUniqueKey</Value>
|
||||||
</Filter>
|
</Filter>
|
||||||
</Filters>
|
</Filters>
|
||||||
|
|
||||||
</Node>
|
</Node>
|
||||||
<Node Name="Constraints" LocLabel="SR.SchemaHierarchy_Constraints" BaseClass="ModelBased" NodeType="Constraint" Strategy="ElementsInRelationship" ChildQuerierTypes="SqlDefaultConstraint;SqlCheck"/>
|
<Node Name="Constraints" LocLabel="SR.SchemaHierarchy_Constraints" BaseClass="ModelBased" NodeType="Constraint" Strategy="ElementsInRelationship" ChildQuerierTypes="SqlDefaultConstraint;SqlCheck"/>
|
||||||
<Node Name="Triggers" LocLabel="SR.SchemaHierarchy_Triggers" BaseClass="ModelBased" Strategy="ElementsInRelationship" NodeType="Trigger" ChildQuerierTypes="SqlDmlTrigger" ValidFor="Sql2005|Sql2008|Sql2012|Sql2014|Sql2016|Sql2017|AzureV12"/>
|
<Node Name="Triggers" LocLabel="SR.SchemaHierarchy_Triggers" BaseClass="ModelBased" Strategy="ElementsInRelationship" NodeType="Trigger" ChildQuerierTypes="SqlDmlTrigger" ValidFor="Sql2005|Sql2008|Sql2012|Sql2014|Sql2016|Sql2017|AzureV12"/>
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Composition;
|
using System.Composition;
|
||||||
using Microsoft.SqlServer.Management.Smo;
|
using Microsoft.SqlServer.Management.Smo;
|
||||||
using Microsoft.SqlTools.ServiceLayer;
|
using Microsoft.SqlTools.ServiceLayer;
|
||||||
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes;
|
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes;
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
|
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
|
||||||
{
|
{
|
||||||
|
|
||||||
internal sealed partial class DatabaseTreeNode : SmoTreeNode
|
internal sealed partial class DatabaseTreeNode : SmoTreeNode
|
||||||
{
|
{
|
||||||
public DatabaseTreeNode() : base()
|
public DatabaseTreeNode() : base()
|
||||||
@@ -775,6 +775,11 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
|
|||||||
Name = "IsSystemVersioned",
|
Name = "IsSystemVersioned",
|
||||||
ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12
|
ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12
|
||||||
});
|
});
|
||||||
|
properties.Add(new NodeSmoProperty
|
||||||
|
{
|
||||||
|
Name = "TemporalType",
|
||||||
|
ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12
|
||||||
|
});
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3965,5 +3970,5 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,18 @@
|
|||||||
|
NodeType: Table Label: dbo.tableWithAllDataTypes SubType: Status:
|
||||||
|
NodeType: Column Label: cDecimal (decimal(18,5), null) SubType: Status:
|
||||||
|
NodeType: Column Label: cNumeric (numeric(18,2), null) SubType: Status:
|
||||||
|
NodeType: Column Label: cBigint (bigint, null) SubType: Status:
|
||||||
|
NodeType: Column Label: cDate (date, null) SubType: Status:
|
||||||
|
NodeType: Column Label: cDatetime (datetime, null) SubType: Status:
|
||||||
|
NodeType: Column Label: cFloat (float, null) SubType: Status:
|
||||||
|
NodeType: Column Label: cSmalldatetime (smalldatetime, null) SubType: Status:
|
||||||
|
NodeType: Column Label: cDatetime2 (datetime2(7), null) SubType: Status:
|
||||||
|
NodeType: Column Label: cDatetimeoffset (datetimeoffset(7), null) SubType: Status:
|
||||||
|
NodeType: Column Label: cTime (time(7), null) SubType: Status:
|
||||||
|
NodeType: Column Label: cBinary (binary(1), null) SubType: Status:
|
||||||
|
NodeType: Column Label: cBit (bit, null) SubType: Status:
|
||||||
|
NodeType: Column Label: cChar (char(1), null) SubType: Status:
|
||||||
|
NodeType: Column Label: cMoney (money, null) SubType: Status:
|
||||||
NodeType: Table Label: dbo.tableWithColumnset SubType: Status:
|
NodeType: Table Label: dbo.tableWithColumnset SubType: Status:
|
||||||
NodeType: Column Label: i (int, null) SubType: Status:
|
NodeType: Column Label: i (int, null) SubType: Status:
|
||||||
NodeType: Column Label: cs (Column Set, null) SubType: Status:
|
NodeType: Column Label: cs (Column Set, null) SubType: Status:
|
||||||
@@ -29,7 +44,7 @@ NodeType: Constraint Label: CK_Employee_VacationHours SubType: Status:
|
|||||||
NodeType: Index Label: NonClusteredIndex-Login (Non-Unique, Non-Clustered) SubType: Status:
|
NodeType: Index Label: NonClusteredIndex-Login (Non-Unique, Non-Clustered) SubType: Status:
|
||||||
NodeType: Statistic Label: NonClusteredIndex-Login SubType: Status:
|
NodeType: Statistic Label: NonClusteredIndex-Login SubType: Status:
|
||||||
NodeType: Statistic Label: PK_Employee_BusinessEntityID SubType: Status:
|
NodeType: Statistic Label: PK_Employee_BusinessEntityID SubType: Status:
|
||||||
NodeType: Table Label: HumanResources.Employee_Temporal (System-Versioned) SubType: Status:
|
NodeType: Table Label: HumanResources.Employee_Temporal (System-Versioned) SubType:Temporal Status:
|
||||||
NodeType: Column Label: BusinessEntityID (PK, int, not null) SubType: Status:
|
NodeType: Column Label: BusinessEntityID (PK, int, not null) SubType: Status:
|
||||||
NodeType: Column Label: NationalIDNumber (nvarchar(15), not null) SubType: Status:
|
NodeType: Column Label: NationalIDNumber (nvarchar(15), not null) SubType: Status:
|
||||||
NodeType: Column Label: LoginID (nvarchar(256), not null) SubType: Status:
|
NodeType: Column Label: LoginID (nvarchar(256), not null) SubType: Status:
|
||||||
@@ -42,8 +57,8 @@ NodeType: Column Label: Gender (nchar(1), not null) SubType: Status:
|
|||||||
NodeType: Column Label: HireDate (date, not null) SubType: Status:
|
NodeType: Column Label: HireDate (date, not null) SubType: Status:
|
||||||
NodeType: Column Label: VacationHours (smallint, not null) SubType: Status:
|
NodeType: Column Label: VacationHours (smallint, not null) SubType: Status:
|
||||||
NodeType: Column Label: SickLeaveHours (smallint, not null) SubType: Status:
|
NodeType: Column Label: SickLeaveHours (smallint, not null) SubType: Status:
|
||||||
NodeType: Column Label: ValidFrom (datetime2, not null) SubType: Status:
|
NodeType: Column Label: ValidFrom (datetime2(7), not null) SubType: Status:
|
||||||
NodeType: Column Label: ValidTo (datetime2, not null) SubType: Status:
|
NodeType: Column Label: ValidTo (datetime2(7), not null) SubType: Status:
|
||||||
NodeType: Key Label: PK_Employee_History_BusinessEntityID SubType:PrimaryKey Status:
|
NodeType: Key Label: PK_Employee_History_BusinessEntityID SubType:PrimaryKey Status:
|
||||||
NodeType: Statistic Label: PK_Employee_History_BusinessEntityID SubType: Status:
|
NodeType: Statistic Label: PK_Employee_History_BusinessEntityID SubType: Status:
|
||||||
NodeType: HistoryTable Label: HumanResources.Employee_Temporal_History (History) SubType: Status:
|
NodeType: HistoryTable Label: HumanResources.Employee_Temporal_History (History) SubType: Status:
|
||||||
@@ -59,8 +74,8 @@ NodeType: Column Label: Gender (nchar(1), not null) SubType: Status:
|
|||||||
NodeType: Column Label: HireDate (date, not null) SubType: Status:
|
NodeType: Column Label: HireDate (date, not null) SubType: Status:
|
||||||
NodeType: Column Label: VacationHours (smallint, not null) SubType: Status:
|
NodeType: Column Label: VacationHours (smallint, not null) SubType: Status:
|
||||||
NodeType: Column Label: SickLeaveHours (smallint, not null) SubType: Status:
|
NodeType: Column Label: SickLeaveHours (smallint, not null) SubType: Status:
|
||||||
NodeType: Column Label: ValidFrom (datetime2, not null) SubType: Status:
|
NodeType: Column Label: ValidFrom (datetime2(7), not null) SubType: Status:
|
||||||
NodeType: Column Label: ValidTo (datetime2, not null) SubType: Status:
|
NodeType: Column Label: ValidTo (datetime2(7), not null) SubType: Status:
|
||||||
NodeType: Table Label: Person.Person SubType: Status:
|
NodeType: Table Label: Person.Person SubType: Status:
|
||||||
NodeType: Column Label: BusinessEntityID (PK, int, not null) SubType: Status:
|
NodeType: Column Label: BusinessEntityID (PK, int, not null) SubType: Status:
|
||||||
NodeType: Column Label: PersonType (nchar(2), not null) SubType: Status:
|
NodeType: Column Label: PersonType (nchar(2), not null) SubType: Status:
|
||||||
|
|||||||
@@ -240,6 +240,24 @@
|
|||||||
|
|
||||||
|
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
CREATE TABLE [dbo].[tableWithAllDataTypes](
|
||||||
|
[cDecimal] [decimal](18, 5) NULL,
|
||||||
|
[cNumeric] [numeric](18, 2) NULL,
|
||||||
|
[cBigint] [bigint] NULL,
|
||||||
|
[cDate] [date] NULL,
|
||||||
|
[cDatetime] [datetime] NULL,
|
||||||
|
[cFloat] [float] NULL,
|
||||||
|
[cSmalldatetime] [smalldatetime] NULL,
|
||||||
|
[cDatetime2] [datetime2](7) NULL,
|
||||||
|
[cDatetimeoffset] [datetimeoffset](7) NULL,
|
||||||
|
[cTime] [time](7) NULL,
|
||||||
|
[cBinary] [Binary] NULL,
|
||||||
|
[cBit] [Bit] NULL,
|
||||||
|
[cChar] [Char] NULL,
|
||||||
|
[cMoney] [Money] NULL
|
||||||
|
) ON [PRIMARY]
|
||||||
|
GO
|
||||||
ALTER TABLE [HumanResources].[Employee] ADD CONSTRAINT [DF_Employee_SalariedFlag] DEFAULT ((1)) FOR [SalariedFlag]
|
ALTER TABLE [HumanResources].[Employee] ADD CONSTRAINT [DF_Employee_SalariedFlag] DEFAULT ((1)) FOR [SalariedFlag]
|
||||||
GO
|
GO
|
||||||
ALTER TABLE [HumanResources].[Employee] ADD CONSTRAINT [DF_Employee_VacationHours] DEFAULT ((0)) FOR [VacationHours]
|
ALTER TABLE [HumanResources].[Employee] ADD CONSTRAINT [DF_Employee_VacationHours] DEFAULT ((0)) FOR [VacationHours]
|
||||||
|
|||||||
Reference in New Issue
Block a user