Leaked source code of windows server 2003
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.

81 lines
2.8 KiB

  1. /****************************************************************************/
  2. -- tssdsp.sql
  3. --
  4. -- Terminal Server Session Directory Integrity Service stored procedures.
  5. --
  6. -- Copyright (C) 2000 Microsoft Corporation
  7. /****************************************************************************/
  8. /****************************************************************************/
  9. -- SP_TSDISServerNotResponding
  10. --
  11. -- Called by DIS to remove all
  12. -- previous entries related to this server in case of unexpected shutdown.
  13. /****************************************************************************/
  14. CREATE PROCEDURE SP_TSDISServerNotResponding
  15. @ServerAddress nvarchar(63)
  16. AS
  17. -- We need to perform some locking on the tables to make sure
  18. -- of the data integrity. We are assuming default isolation level
  19. -- of Read Committed.
  20. BEGIN TRANSACTION
  21. DELETE FROM TSSD_Sessions WHERE ServerID =
  22. (SELECT MIN(SERV.ServerID) FROM TSSD_Servers SERV
  23. WHERE SERV.ServerAddress = @ServerAddress)
  24. DELETE FROM TSSD_Servers WHERE ServerAddress = @ServerAddress
  25. -- Finished the update.
  26. COMMIT TRANSACTION
  27. GO
  28. /****************************************************************************/
  29. -- SP_TSDISGetServersWithDisconnectedSessions
  30. --
  31. -- Retrieves a list of every server with at least one disconnected session.
  32. /****************************************************************************/
  33. CREATE PROCEDURE SP_TSDISGetServersWithDisconnectedSessions
  34. AS
  35. BEGIN TRANSACTION
  36. SELECT SERV.ServerAddress FROM TSSD_Servers SERV WHERE SERV.ServerID =
  37. (SELECT DISTINCT SESS.ServerID FROM TSSD_Sessions SESS
  38. WHERE SESS.State = 1)
  39. COMMIT TRANSACTION
  40. GO
  41. /****************************************************************************/
  42. -- SP_TSDISGetServersWithPendingReconnects
  43. --
  44. -- Retrieves a list of every server pending a reconnect.
  45. /****************************************************************************/
  46. CREATE PROCEDURE SP_TSDISGetServersPendingReconnects
  47. AS
  48. BEGIN TRANSACTION
  49. SELECT ServerAddress, AlmostInTimeLow, AlmostInTimeHigh FROM TSSD_Servers
  50. WHERE AlmostInTimeLow != 0 AND AlmostInTimeHigh != 0
  51. COMMIT TRANSACTION
  52. GO
  53. /****************************************************************************/
  54. -- SP_TSDISSetServerPingSuccessful
  55. --
  56. -- Resets a server that has been pinged successfully.
  57. /****************************************************************************/
  58. CREATE PROCEDURE SP_TSDISSetServerPingSuccessful
  59. @ServerAddress nvarchar(63)
  60. AS
  61. BEGIN TRANSACTION
  62. UPDATE TSSD_Servers SET AlmostInTimeLow = 0, AlmostInTimeHigh = 0
  63. WHERE ServerAddress = @ServerAddress
  64. COMMIT TRANSACTION
  65. GO