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.

121 lines
4.1 KiB

  1. Sub CheckError( iExpError )
  2. If Err.Number <> iExpError Then
  3. wscript.echo "Expected 0x" & Hex(iExpError) & ", Got 0x" & Hex(Err.Number)
  4. description = trim (Err.Description)
  5. do while chr(10) = Right(description,1) or chr(13) = Right(description,1)
  6. description = Left(description,len(description) - 1)
  7. loop
  8. wscript.echo " " & Err.Source, description
  9. cErrors = cErrors + 1
  10. Else
  11. ' wscript.echo ("No Error")
  12. End If
  13. if Err.Number <> 0 then Err.Clear
  14. End Sub
  15. Sub DefineColumnMessage( strColumn )
  16. wscript.echo ("<LI>Query.DefineColumn(""" & strColumn & """)")
  17. End Sub
  18. cErrors = 0
  19. On Error Resume Next
  20. wscript.Echo "Bad parameter tests for Query.DefineColumn"
  21. ' <p>HITS=15 (count of rows in the table)
  22. ' <TABLE BORDER>
  23. ' <TH>Action/Error Number</TH><TH>Error Source</TH><TH>Error Description</TH>
  24. ' <TR><TD>Same property twice</TD></TR>
  25. set Q1=wscript.CreateObject("IXSSO.Query")
  26. strNewColumn = "terryla_error_test(DBTYPE_I4, 1) = CF2EAF90-9311-11CF-BF8C-0020AFE50508 terryla_error_test"
  27. 'DefineColumnMessage(strNewColumn)
  28. Q1.DefineColumn(strNewColumn)
  29. CheckError( 0 )
  30. 'DefineColumnMessage(strNewColumn)
  31. Q1.DefineColumn(strNewColumn)
  32. CheckError( 0 )
  33. ' <TR><TD>Long property name</TD></TR>
  34. strNewColumn = "dcsourcetypecategory(dbtype_wstr|dbtype_byref) = CF2EAF90-9311-11CF-BF8C-0020AFE50508 dc.source.type.category"
  35. 'DefineColumnMessage(strNewColumn)
  36. Q1.DefineColumn(strNewColumn)
  37. CheckError( 0 )
  38. ' <TR><TD>No property specifier</TD></TR>
  39. set Q2=wscript.CreateObject("IXSSO.Query")
  40. strNewColumn = "terryla_error_test(DBTYPE_I4, 1) = CF2EAF90-9311-11CF-BF8C-0020AFE50508"
  41. 'DefineColumnMessage(strNewColumn)
  42. Q2.DefineColumn(strNewColumn)
  43. CheckError( &h8004165A )
  44. ' <TR><TD>Expecting property name</TD></TR>
  45. set Q3=wscript.CreateObject("IXSSO.Query")
  46. strNewColumn = "(DBTYPE_I4, 1) = CF2EAF90-9311-11CF-BF8C-0020AFE50508 terryla_error_test"
  47. 'DefineColumnMessage(strNewColumn)
  48. Q3.DefineColumn(strNewColumn)
  49. CheckError( &h80041653 )
  50. ' <TR><TD>Invalid GUID (BUBBA)</TD></TR>
  51. set Q4=wscript.CreateObject("IXSSO.Query")
  52. strNewColumn = "terryla_error_test(DBTYPE_I4, 1) = CF2BUBBA-9311-11CF-BF8C-0020AFE50508 terryla_error_test"
  53. 'DefineColumnMessage(strNewColumn)
  54. Q4.DefineColumn(strNewColumn)
  55. CheckError( &h80041659 )
  56. ' <TR><TD>Invalid GUID (missing part)</TD></TR>
  57. set Q5=wscript.CreateObject("IXSSO.Query")
  58. strNewColumn = "terryla_error_test(DBTYPE_I4, 1) = CF2EAF90-11CF-BF8C-0020AFE50508 terryla_error_test"
  59. 'DefineColumnMessage(strNewColumn)
  60. Q5.DefineColumn(strNewColumn)
  61. CheckError( &h80041659 )
  62. ' <TR><TD>Unrecognized property type (BUBBA)</TD></TR>
  63. set Q6=wscript.CreateObject("IXSSO.Query")
  64. strNewColumn = "terryla_error_test(DBTYPE_BUBBA, 1) = CF2EAF90-9311-11CF-BF8C-0020AFE50508 terryla_error_test"
  65. 'DefineColumnMessage(strNewColumn)
  66. Q6.DefineColumn(strNewColumn)
  67. CheckError( &h80041655 )
  68. ' <TR><TD>Illegal character in friendly name</TD></TR>
  69. set Q7=wscript.CreateObject("IXSSO.Query")
  70. strNewColumn = "terryla!scope_test(DBTYPE_I4, 1) = CF2EAF90-9311-11CF-BF8C-0020AFE50508 terryla_error_test"
  71. 'DefineColumnMessage(strNewColumn)
  72. Q7.DefineColumn(strNewColumn)
  73. CheckError( &h80041658 )
  74. strNewColumn = "terryla.scope_test(DBTYPE_I4, 1) = CF2EAF90-9311-11CF-BF8C-0020AFE50508 terryla_error_test"
  75. 'DefineColumnMessage(strNewColumn)
  76. Q7.DefineColumn(strNewColumn)
  77. CheckError( &h80041659 )
  78. strNewColumn = """terryla!scope_test""(DBTYPE_I4, 1) = CF2EAF90-9311-11CF-BF8C-0020AFE50508 terryla_error_test"
  79. 'DefineColumnMessage(strNewColumn)
  80. Q7.DefineColumn(strNewColumn)
  81. CheckError( &h0 )
  82. strNewColumn = """terryla.scope_test""(DBTYPE_I4, 1) = CF2EAF90-9311-11CF-BF8C-0020AFE50508 terryla_error_test"
  83. 'DefineColumnMessage(strNewColumn)
  84. Q7.DefineColumn(strNewColumn)
  85. CheckError( &h0 )
  86. if cErrors <> 0 then
  87. wscript.Echo "FAIL"
  88. else
  89. wscript.Echo "PASS"
  90. end if
  91. set Q1 = nothing
  92. set Q2 = nothing
  93. set Q3 = nothing
  94. set Q4 = nothing
  95. set Q5 = nothing
  96. set Q6 = nothing
  97. set Q7 = nothing