Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
3.7 KiB

  1. /****************************************************************************/
  2. -- tssdschm.sql
  3. --
  4. -- Terminal Server Session Directory SQL schema table definitions.
  5. --
  6. -- Copyright (C) 2000 Microsoft Corporation
  7. /****************************************************************************/
  8. -- Drop previous table contents in favor of the new definitions.
  9. IF EXISTS (SELECT table_name FROM INFORMATION_SCHEMA.TABLES
  10. WHERE table_name = 'TSSD_Sessions') DROP TABLE TSSD_Sessions
  11. IF EXISTS (SELECT table_name FROM INFORMATION_SCHEMA.TABLES
  12. WHERE table_name = 'TSSD_Servers') DROP TABLE TSSD_Servers
  13. IF EXISTS (SELECT table_name FROM INFORMATION_SCHEMA.TABLES
  14. WHERE table_name = 'TSSD_Clusters') DROP TABLE TSSD_Clusters
  15. /****************************************************************************/
  16. -- TSSD_Clusters contains the set of Terminal Server clusters managed
  17. -- managed by this SQL server. Clusters are joined by individual TS
  18. -- machines via the unique cluster name configured on that server and
  19. -- passed by the session directory provider during init. TSSD_Servers
  20. -- entries are in a many-to-one relationship with this table.
  21. /****************************************************************************/
  22. CREATE TABLE TSSD_Clusters (
  23. -- Cluster ID, used as a search key for server references.
  24. ClusterID int IDENTITY PRIMARY KEY CLUSTERED,
  25. -- The corresponding name.
  26. ClusterName nvarchar(63) NOT NULL UNIQUE
  27. )
  28. GO
  29. /****************************************************************************/
  30. -- TSSD_Servers contains server-specific information.
  31. -- TSSD_Sessions are in a many-to-one relationship with this table.
  32. /****************************************************************************/
  33. CREATE TABLE TSSD_Servers (
  34. -- A searchable, indexed integer ID.
  35. ServerID int IDENTITY PRIMARY KEY CLUSTERED,
  36. -- The server address
  37. ServerAddress nvarchar(63) NOT NULL UNIQUE,
  38. -- The cluster to which this server belongs.
  39. ClusterID int FOREIGN KEY REFERENCES TSSD_Clusters(ClusterID),
  40. -- Directory Integrity Service last accessed time
  41. AlmostInTimeLow int NOT NULL,
  42. AlmostInTimeHigh int NOT NULL,
  43. )
  44. GO
  45. /****************************************************************************/
  46. -- TSSD_Sessions embodies a server-pool-wide Terminal Server session record.
  47. /****************************************************************************/
  48. CREATE TABLE TSSD_Sessions (
  49. -- UserName and domain identify the session user. These are queried
  50. -- together as a key when doing a lookup of disconnected sessions by
  51. -- user.
  52. UserName nvarchar(255) NOT NULL,
  53. Domain nvarchar(127) NOT NULL,
  54. -- A searchable, indexed integer ID.
  55. ServerID int FOREIGN KEY REFERENCES TSSD_Servers(ServerID),
  56. -- The session ID (unique to a single server only)
  57. SessionID int NOT NULL,
  58. -- The TS network protocol for the session. 1 = ICA, 2 = RDP.
  59. TSProtocol int NOT NULL,
  60. -- Creation and disconnection FILETIMEs for the session. Disconnection time
  61. -- might not be set for a session that has never been disconnected.
  62. -- These are broken into two 4-byte integers since T-SQL has no 64-bit
  63. -- integer type.
  64. CreateTimeLow int NOT NULL,
  65. CreateTimeHigh int NOT NULL,
  66. DisconnectionTimeLow int,
  67. DisconnectionTimeHigh int,
  68. -- Application type, used to filter sessions according to their published
  69. -- application type. NULL or zero length imply a desktop session.
  70. ApplicationType nvarchar(255),
  71. -- Session display parameters.
  72. ResolutionWidth int NOT NULL,
  73. ResolutionHeight int NOT NULL,
  74. ColorDepth int NOT NULL,
  75. -- Session state - 0 = connected, 1 = disconnected
  76. State tinyint NOT NULL DEFAULT 0 CHECK (State >= 0 AND State <= 1),
  77. )
  78. GO