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.

92 lines
3.2 KiB

  1. Option Explicit
  2. '--------------------------------------------------------------------------
  3. '-- SetBldStatus.vbs
  4. '--------------------------------------------------------------------------
  5. '-- This a wrapper script for pushing build status information into the
  6. '-- buildinfo database.
  7. '--
  8. '--------------------------------------------------------------------------
  9. '-- 2002-05-01 [email protected]
  10. '-- Cleaned up pre-existing code.
  11. '-- 2002-05-13 [email protected]
  12. '-- Fixed status translation.
  13. const DB_CONNECT_STRING = "PROVIDER=SQLOLEDB;DRIVER={SQL SERVER};SERVER=primecd-ixf;DATABASE=buildinfo;User Id=SCRIPT;Password=T00l!User"
  14. const adCmdStoredProc = 4
  15. const adInteger = 3
  16. const adparamInput = 1
  17. const adparamOutput = 2
  18. const adChar = 129
  19. const adVarChar = 200
  20. Main
  21. '--------------------------------------------------------------------------
  22. public sub Main
  23. if wscript.arguments.count <> 4 then
  24. wscript.stdout.writeline "Error: Wrong number of arguments"
  25. Usage
  26. wscript.quit
  27. end if
  28. WriteBuildRecord wscript.arguments(0) , wscript.arguments(1) , wscript.arguments(2) , wscript.arguments(3)
  29. end sub
  30. '--------------------------------------------------------------------------
  31. public sub Usage
  32. wscript.stdout.writeline "SetBldStatus.vbs [buildname] [language] [branch] [status]"
  33. end sub
  34. '--------------------------------------------------------------------------
  35. '-- WriteBuildRecord
  36. public sub WriteBuildRecord( buildnumber , language , branch , status )
  37. dim dbCon , dbCmd , dbParamSwitch , dbParamUser , switch
  38. '-- Open a connection to the database and get a ADODB Commend
  39. set dbCon = GetDbConnect( DB_CONNECT_STRING )
  40. set dbCmd = GetDbCmd( dbCon , adCmdStoredProc , "spPubBuild" )
  41. '-- Build the Switch parameter.
  42. switch = "+build:" + buildnumber + " (" + language + ") +branch:" + branch + " +status:" + status
  43. set dbParamSwitch = GetDBParameter( "@Switch" , adChar , 7000 , adParamInput , switch )
  44. dbCmd.Parameters.Append( dbParamSwitch )
  45. '-- Build the user parameter
  46. set dbParamUser = GetDBParameter( "@Username" , adChar , 255 , adParamInput , "SetBuildStatus.vbs" )
  47. dbCmd.Parameters.Append( dbParamUser )
  48. '-- Execute the command and close the connection
  49. dbCmd.Execute
  50. dbCon.Close
  51. End Sub
  52. '--------------------------------------------------------------------------
  53. '-- Standard ADODB Functions
  54. Public Function GetDBConnect( connectStr )
  55. dim dbcon
  56. set dbCon = CreateObject( "ADODB.Connection" )
  57. dbCon.Open connectStr
  58. dbCon.CommandTimeOut = 180
  59. set GetDBConnect = DbCon
  60. end Function
  61. Public Function GetDBCmd( DBConnection , cmdType , cmdText )
  62. dim dbCmd
  63. set DbCmd = Createobject("ADODB.Command")
  64. DBCmd.CommandTimeOut = 180
  65. DbCmd.ActiveConnection = DbConnection
  66. DbCmd.CommandType = cmdType
  67. DbCmd.CommandText = cmdText
  68. set GetDBCmd = DbCmd
  69. end Function
  70. Public Function GetDBParameter( pName , pType , pSize , pDirection , pValue )
  71. dim DBParam
  72. set DBParam = CreateObject( "ADODB.Parameter")
  73. DBParam.Name = pName
  74. DBParam.Type = pType
  75. DBParam.Size = pSize
  76. DBParam.Direction = pDirection
  77. DBParam.Value = pValue
  78. Set GetDBParameter = DBParam
  79. end function