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.

796 lines
34 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  4. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  5. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  6. // PARTICULAR PURPOSE.
  7. //
  8. // Copyright (c) Microsoft Corporation, 1997 - 1999. All Rights Reserved.
  9. //
  10. // FILE: disptree.cxx
  11. //
  12. // PURPOSE: Displays a command tree, for debugging.
  13. //
  14. // PLATFORM: Windows 2000
  15. //
  16. //--------------------------------------------------------------------------
  17. #define UNICODE
  18. #include <stdio.h>
  19. #include <windows.h>
  20. #include <oledberr.h>
  21. #include <oledb.h>
  22. #include <cmdtree.h>
  23. //+-------------------------------------------------------------------------
  24. //
  25. // Function: PrintVectorItems
  26. //
  27. // Synopsis: Prints items in a PROPVARIANT vector
  28. //
  29. // Arguments: [pVal] - The array of values
  30. // [cVals] - The count of values
  31. // [pcFmt] - The format string
  32. //
  33. //--------------------------------------------------------------------------
  34. template<class T> void PrintVectorItems(
  35. T * pVal,
  36. ULONG cVals,
  37. char * pcFmt )
  38. {
  39. printf( "{ " );
  40. for( ULONG iVal = 0; iVal < cVals; iVal++ )
  41. {
  42. if ( 0 != iVal )
  43. printf( "," );
  44. printf( pcFmt, *pVal++ );
  45. }
  46. printf( " }" );
  47. } //PrintVectorItems
  48. //+-------------------------------------------------------------------------
  49. //
  50. // Function: DisplayVariant
  51. //
  52. // Synopsis: Displays a PROPVARIANT. This is not a complete
  53. // implementation; many VT_ types are not complete.
  54. //
  55. // Arguments: [pNode] - The command tree node
  56. // [iLevel] - The 0-based level in the tree
  57. //
  58. //--------------------------------------------------------------------------
  59. void DisplayVariant( PROPVARIANT * pVar )
  60. {
  61. if ( 0 == pVar )
  62. {
  63. printf( "NULL" );
  64. return;
  65. }
  66. PROPVARIANT & v = *pVar;
  67. switch ( v.vt )
  68. {
  69. case VT_I4 : printf( "VT_I4 %d", v.lVal ); break;
  70. case VT_UI1 : printf( "VT_UI1 %d", v.bVal ); break;
  71. case VT_I2 : printf( "VT_I2 %d", v.iVal ); break;
  72. case VT_R4 : printf( "VT_R4 %f", v.fltVal ); break;
  73. case VT_R8 : printf( "VT_R8 %lf", v.dblVal ); break;
  74. case VT_BOOL : printf( "VT_BOOL %d", v.boolVal ); break;
  75. case VT_ERROR : printf( "VT_ERROR %#x", v.scode ); break;
  76. case VT_CY :
  77. {
  78. double dbl;
  79. VarR8FromCy( pVar->cyVal, &dbl );
  80. printf( "VT_CY %lf", dbl );
  81. break;
  82. }
  83. case VT_DATE : printf( "VT_DATE " ); break;
  84. case VT_FILETIME : printf( "VT_FILETIME %#I64x ", v.filetime ); break;
  85. case VT_BSTR : printf( "VT_BSTR '%ws'", v.bstrVal ); break;
  86. case VT_UNKNOWN : printf( "VT_UNKNOWN " ); break;
  87. case VT_DISPATCH : printf( "VT_DISPATCH " ); break;
  88. case VT_BYREF|VT_UI1 : printf( "VT_BYREF|VT_UI1 " ); break;
  89. case VT_BYREF|VT_I2 : printf( "VT_BYREF|VT_I2 " ); break;
  90. case VT_BYREF|VT_I4 : printf( "VT_BYREF|VT_I4 " ); break;
  91. case VT_BYREF|VT_R4 : printf( "VT_BYREF|VT_R4 " ); break;
  92. case VT_BYREF|VT_R8 : printf( "VT_BYREF|VT_R8 " ); break;
  93. case VT_BYREF|VT_BOOL : printf( "VT_BYREF|VT_BOOL " ); break;
  94. case VT_BYREF|VT_ERROR : printf( "VT_BYREF|VT_ERROR " ); break;
  95. case VT_BYREF|VT_CY : printf( "VT_BYREF|VT_CY " ); break;
  96. case VT_BYREF|VT_DATE : printf( "VT_BYREF|VT_DATE " ); break;
  97. case VT_BYREF|VT_BSTR : printf( "VT_BYREF|VT_BSTR " ); break;
  98. case VT_BYREF|VT_UNKNOWN : printf( "VT_BYREF|VT_UNKNOWN " ); break;
  99. case VT_BYREF|VT_DISPATCH : printf( "VT_BYREF|VT_DISPATCH " ); break;
  100. case VT_BYREF|VT_ARRAY : printf( "VT_BYREF|VT_ARRAY " ); break;
  101. case VT_BYREF|VT_VARIANT : printf( "VT_BYREF|VT_VARIANT " ); break;
  102. case VT_I1 : printf( "VT_I1 %d", v.bVal ); break;
  103. case VT_UI2 : printf( "VT_UI2 %u", v.uiVal ); break;
  104. case VT_UI4 : printf( "VT_UI4 %u", v.ulVal ); break;
  105. case VT_INT : printf( "VT_INT %d", v.lVal ); break;
  106. case VT_UINT : printf( "VT_UINT %u", v.ulVal ); break;
  107. case VT_BYREF|VT_DECIMAL : printf( "VT_BYREF|VT_DECIMAL " ); break;
  108. case VT_BYREF|VT_I1 : printf( "VT_BYREF|VT_I1 " ); break;
  109. case VT_BYREF|VT_UI2 : printf( "VT_BYREF|VT_UI2 " ); break;
  110. case VT_BYREF|VT_UI4 : printf( "VT_BYREF|VT_UI4 " ); break;
  111. case VT_BYREF|VT_INT : printf( "VT_BYREF|VT_INT " ); break;
  112. case VT_BYREF|VT_UINT : printf( "VT_BYREF|VT_UINT " ); break;
  113. case VT_LPSTR : printf( "VT_LPSTR '%s'", v.pszVal ); break;
  114. case VT_LPWSTR : printf( "VT_LPWSTR '%ws'", v.pwszVal ); break;
  115. case VT_I8 : printf( "VT_I8 %I64d", v.hVal ); break;
  116. case VT_UI8 : printf( "VT_I8 %I64u", v.hVal ); break;
  117. case VT_VECTOR | VT_I1:
  118. printf( "VT_VECTOR | VT_I1 " );
  119. PrintVectorItems( v.caub.pElems, v.caub.cElems, "%d" );
  120. break;
  121. case VT_VECTOR | VT_I2:
  122. printf( "VT_VECTOR | VT_I2 " );
  123. PrintVectorItems( v.cai.pElems, v.cai.cElems, "%d" );
  124. break;
  125. case VT_VECTOR | VT_I4:
  126. printf( "VT_VECTOR | VT_I4 " );
  127. PrintVectorItems( v.cal.pElems, v.cal.cElems, "%d" );
  128. break;
  129. case VT_VECTOR | VT_I8:
  130. printf( "VT_VECTOR | VT_I8 " );
  131. PrintVectorItems( v.cah.pElems, v.cah.cElems, "%I64d" );
  132. break;
  133. case VT_VECTOR | VT_UI1:
  134. printf( "VT_VECTOR | VT_UI1 " );
  135. PrintVectorItems( v.caub.pElems, v.caub.cElems, "%u" );
  136. break;
  137. case VT_VECTOR | VT_UI2:
  138. printf( "VT_VECTOR | VT_UI2 " );
  139. PrintVectorItems( v.caui.pElems, v.caui.cElems, "%u" );
  140. break;
  141. case VT_VECTOR | VT_UI4:
  142. printf( "VT_VECTOR | VT_UI4 " );
  143. PrintVectorItems( v.caul.pElems, v.caul.cElems, "%u" );
  144. break;
  145. case VT_VECTOR | VT_UI8:
  146. printf( "VT_VECTOR | VT_UI8 " );
  147. PrintVectorItems( v.cauh.pElems, v.cauh.cElems, "%I64u" );
  148. break;
  149. case VT_VECTOR | VT_BSTR:
  150. printf( "VT_VECTOR | VT_BSTR " );
  151. PrintVectorItems( v.cabstr.pElems, v.cabstr.cElems, "%ws" );
  152. break;
  153. case VT_VECTOR | VT_LPSTR:
  154. printf( "VT_VECTOR | VT_LPSTR " );
  155. PrintVectorItems( v.calpstr.pElems, v.calpstr.cElems, "%s" );
  156. break;
  157. case VT_VECTOR | VT_LPWSTR:
  158. printf( "VT_VECTOR | VT_LPWSTR " );
  159. PrintVectorItems( v.calpwstr.pElems, v.calpwstr.cElems, "%ws" );
  160. break;
  161. case VT_VECTOR | VT_R4:
  162. printf( "VT_VECTOR | VT_R4 " );
  163. PrintVectorItems( v.caflt.pElems, v.caflt.cElems, "%f" );
  164. break;
  165. case VT_VECTOR | VT_R8:
  166. printf( "VT_VECTOR | VT_R8 " );
  167. PrintVectorItems( v.cadbl.pElems, v.cadbl.cElems, "%lf" );
  168. break;
  169. default : printf( "unknown vt %#x", v.vt );
  170. }
  171. } //DisplayVariant
  172. //+-------------------------------------------------------------------------
  173. //
  174. // Function: PrintSpace
  175. //
  176. // Synopsis: Prints white space.
  177. //
  178. // Arguments: [cPlaces] - Number of levels to print
  179. //
  180. //--------------------------------------------------------------------------
  181. void PrintSpace( ULONG cPlaces )
  182. {
  183. for( ULONG iPlace = 0; iPlace < cPlaces; iPlace++ )
  184. printf( " " );
  185. } //PrintSpace
  186. //+-------------------------------------------------------------------------
  187. //
  188. // Function: DisplayCommandTree
  189. //
  190. // Synopsis: Displays the command tree, useful for debugging. This is
  191. // not a complete implementation; many DBVALUEKINDs are not
  192. // complete.
  193. //
  194. // Arguments: [pNode] - The command tree node
  195. // [iLevel] - The 0-based level in the tree
  196. //
  197. //--------------------------------------------------------------------------
  198. void DisplayCommandTree(
  199. DBCOMMANDTREE * pNode,
  200. ULONG iLevel )
  201. {
  202. PrintSpace( iLevel );
  203. printf( "op: (%d) ", pNode->op );
  204. switch ( pNode->op )
  205. {
  206. case DBOP_scalar_constant : printf( "DBOP_scalar_constant" ); break;
  207. case DBOP_DEFAULT : printf( "DBOP_DEFAULT" ); break;
  208. case DBOP_NULL : printf( "DBOP_NULL" ); break;
  209. case DBOP_bookmark_name : printf( "DBOP_bookmark_name" ); break;
  210. case DBOP_catalog_name : printf( "DBOP_catalog_name" ); break;
  211. case DBOP_column_name : printf( "DBOP_column_name" ); break;
  212. case DBOP_schema_name : printf( "DBOP_schema_name" ); break;
  213. case DBOP_outall_name : printf( "DBOP_outall_name" ); break;
  214. case DBOP_qualifier_name : printf( "DBOP_qualifier_name" ); break;
  215. case DBOP_qualified_column_name : printf( "DBOP_qualified_column_name" ); break;
  216. case DBOP_table_name : printf( "DBOP_table_name" ); break;
  217. case DBOP_nested_table_name : printf( "DBOP_nested_table_name" ); break;
  218. case DBOP_nested_column_name : printf( "DBOP_nested_column_name" ); break;
  219. case DBOP_row : printf( "DBOP_row" ); break;
  220. case DBOP_table : printf( "DBOP_table" ); break;
  221. case DBOP_sort : printf( "DBOP_sort" ); break;
  222. case DBOP_distinct : printf( "DBOP_distinct" ); break;
  223. case DBOP_distinct_order_preserving : printf( "DBOP_distinct_order_preserving" ); break;
  224. case DBOP_alias : printf( "DBOP_alias" ); break;
  225. case DBOP_cross_join : printf( "DBOP_cross_join" ); break;
  226. case DBOP_union_join : printf( "DBOP_union_join" ); break;
  227. case DBOP_inner_join : printf( "DBOP_inner_join" ); break;
  228. case DBOP_left_semi_join : printf( "DBOP_left_semi_join" ); break;
  229. case DBOP_right_semi_join : printf( "DBOP_right_semi_join" ); break;
  230. case DBOP_left_anti_semi_join : printf( "DBOP_left_anti_semi_join" ); break;
  231. case DBOP_right_anti_semi_join : printf( "DBOP_right_anti_semi_join" ); break;
  232. case DBOP_left_outer_join : printf( "DBOP_left_outer_join" ); break;
  233. case DBOP_right_outer_join : printf( "DBOP_right_outer_join" ); break;
  234. case DBOP_full_outer_join : printf( "DBOP_full_outer_join" ); break;
  235. case DBOP_natural_join : printf( "DBOP_natural_join" ); break;
  236. case DBOP_natural_left_outer_join : printf( "DBOP_natural_left_outer_join" ); break;
  237. case DBOP_natural_right_outer_join : printf( "DBOP_natural_right_outer_join" ); break;
  238. case DBOP_natural_full_outer_join : printf( "DBOP_natural_full_outer_join" ); break;
  239. case DBOP_set_intersection : printf( "DBOP_set_intersection" ); break;
  240. case DBOP_set_union : printf( "DBOP_set_union" ); break;
  241. case DBOP_set_left_difference : printf( "DBOP_set_left_difference" ); break;
  242. case DBOP_set_right_difference : printf( "DBOP_set_right_difference" ); break;
  243. case DBOP_set_anti_difference : printf( "DBOP_set_anti_difference" ); break;
  244. case DBOP_bag_intersection : printf( "DBOP_bag_intersection" ); break;
  245. case DBOP_bag_union : printf( "DBOP_bag_union" ); break;
  246. case DBOP_bag_left_difference : printf( "DBOP_bag_left_difference" ); break;
  247. case DBOP_bag_right_difference : printf( "DBOP_bag_right_difference" ); break;
  248. case DBOP_bag_anti_difference : printf( "DBOP_bag_anti_difference" ); break;
  249. case DBOP_division : printf( "DBOP_division" ); break;
  250. case DBOP_relative_sampling : printf( "DBOP_relative_sampling" ); break;
  251. case DBOP_absolute_sampling : printf( "DBOP_absolute_sampling" ); break;
  252. case DBOP_transitive_closure : printf( "DBOP_transitive_closure" ); break;
  253. case DBOP_recursive_union : printf( "DBOP_recursive_union" ); break;
  254. case DBOP_aggregate : printf( "DBOP_aggregate" ); break;
  255. case DBOP_remote_table : printf( "DBOP_remote_table" ); break;
  256. case DBOP_select : printf( "DBOP_select" ); break;
  257. case DBOP_order_preserving_select : printf( "DBOP_order_preserving_select" ); break;
  258. case DBOP_project : printf( "DBOP_project" ); break;
  259. case DBOP_project_order_preserving : printf( "DBOP_project_order_preserving" ); break;
  260. case DBOP_top : printf( "DBOP_top" ); break;
  261. case DBOP_top_percent : printf( "DBOP_top_percent" ); break;
  262. case DBOP_top_plus_ties : printf( "DBOP_top_plus_ties" ); break;
  263. case DBOP_top_percent_plus_ties : printf( "DBOP_top_percent_plus_ties" ); break;
  264. case DBOP_rank : printf( "DBOP_rank" ); break;
  265. case DBOP_rank_ties_equally : printf( "DBOP_rank_ties_equally" ); break;
  266. case DBOP_rank_ties_equally_and_skip : printf( "DBOP_rank_ties_equally_and_skip" ); break;
  267. case DBOP_navigate : printf( "DBOP_navigate" ); break;
  268. case DBOP_nesting : printf( "DBOP_nesting" ); break;
  269. case DBOP_unnesting : printf( "DBOP_unnesting" ); break;
  270. case DBOP_nested_apply : printf( "DBOP_nested_apply" ); break;
  271. case DBOP_cross_tab : printf( "DBOP_cross_tab" ); break;
  272. case DBOP_is_NULL : printf( "DBOP_is_NULL" ); break;
  273. case DBOP_is_NOT_NULL : printf( "DBOP_is_NOT_NULL" ); break;
  274. case DBOP_equal : printf( "DBOP_equal" ); break;
  275. case DBOP_not_equal : printf( "DBOP_not_equal" ); break;
  276. case DBOP_less : printf( "DBOP_less" ); break;
  277. case DBOP_less_equal : printf( "DBOP_less_equal" ); break;
  278. case DBOP_greater : printf( "DBOP_greater" ); break;
  279. case DBOP_greater_equal : printf( "DBOP_greater_equal" ); break;
  280. case DBOP_equal_all : printf( "DBOP_equal_all" ); break;
  281. case DBOP_not_equal_all : printf( "DBOP_not_equal_all" ); break;
  282. case DBOP_less_all : printf( "DBOP_less_all" ); break;
  283. case DBOP_less_equal_all : printf( "DBOP_less_equal_all" ); break;
  284. case DBOP_greater_all : printf( "DBOP_greater_all" ); break;
  285. case DBOP_greater_equal_all : printf( "DBOP_greater_equal_all" ); break;
  286. case DBOP_equal_any : printf( "DBOP_equal_any" ); break;
  287. case DBOP_not_equal_any : printf( "DBOP_not_equal_any" ); break;
  288. case DBOP_less_any : printf( "DBOP_less_any" ); break;
  289. case DBOP_less_equal_any : printf( "DBOP_less_equal_any" ); break;
  290. case DBOP_greater_any : printf( "DBOP_greater_any" ); break;
  291. case DBOP_greater_equal_any : printf( "DBOP_greater_equal_any" ); break;
  292. case DBOP_anybits : printf( "DBOP_anybits" ); break;
  293. case DBOP_allbits : printf( "DBOP_allbits" ); break;
  294. case DBOP_anybits_any : printf( "DBOP_anybits_any" ); break;
  295. case DBOP_allbits_any : printf( "DBOP_allbits_any" ); break;
  296. case DBOP_anybits_all : printf( "DBOP_anybits_all" ); break;
  297. case DBOP_allbits_all : printf( "DBOP_allbits_all" ); break;
  298. case DBOP_between : printf( "DBOP_between" ); break;
  299. case DBOP_between_unordered : printf( "DBOP_between_unordered" ); break;
  300. case DBOP_match : printf( "DBOP_match" ); break;
  301. case DBOP_match_unique : printf( "DBOP_match_unique" ); break;
  302. case DBOP_match_partial : printf( "DBOP_match_partial" ); break;
  303. case DBOP_match_partial_unique : printf( "DBOP_match_partial_unique" ); break;
  304. case DBOP_match_full : printf( "DBOP_match_full" ); break;
  305. case DBOP_match_full_unique : printf( "DBOP_match_full_unique" ); break;
  306. case DBOP_scalar_parameter : printf( "DBOP_scalar_parameter" ); break;
  307. case DBOP_scalar_function : printf( "DBOP_scalar_function" ); break;
  308. case DBOP_plus : printf( "DBOP_plus" ); break;
  309. case DBOP_minus : printf( "DBOP_minus" ); break;
  310. case DBOP_times : printf( "DBOP_times" ); break;
  311. case DBOP_over : printf( "DBOP_over" ); break;
  312. case DBOP_div : printf( "DBOP_div" ); break;
  313. case DBOP_modulo : printf( "DBOP_modulo" ); break;
  314. case DBOP_power : printf( "DBOP_power" ); break;
  315. case DBOP_like : printf( "DBOP_like" ); break;
  316. case DBOP_sounds_like : printf( "DBOP_sounds_like" ); break;
  317. case DBOP_like_any : printf( "DBOP_like_any" ); break;
  318. case DBOP_like_all : printf( "DBOP_like_all" ); break;
  319. case DBOP_is_INVALID : printf( "DBOP_is_INVALID" ); break;
  320. case DBOP_is_TRUE : printf( "DBOP_is_TRUE" ); break;
  321. case DBOP_is_FALSE : printf( "DBOP_is_FALSE" ); break;
  322. case DBOP_and : printf( "DBOP_and" ); break;
  323. case DBOP_or : printf( "DBOP_or" ); break;
  324. case DBOP_xor : printf( "DBOP_xor" ); break;
  325. case DBOP_equivalent : printf( "DBOP_equivalent" ); break;
  326. case DBOP_not : printf( "DBOP_not" ); break;
  327. case DBOP_implies : printf( "DBOP_implies" ); break;
  328. case DBOP_overlaps : printf( "DBOP_overlaps" ); break;
  329. case DBOP_case_condition : printf( "DBOP_case_condition" ); break;
  330. case DBOP_case_value : printf( "DBOP_case_value" ); break;
  331. case DBOP_nullif : printf( "DBOP_nullif" ); break;
  332. case DBOP_cast : printf( "DBOP_cast" ); break;
  333. case DBOP_coalesce : printf( "DBOP_coalesce" ); break;
  334. case DBOP_position : printf( "DBOP_position" ); break;
  335. case DBOP_extract : printf( "DBOP_extract" ); break;
  336. case DBOP_char_length : printf( "DBOP_char_length" ); break;
  337. case DBOP_octet_length : printf( "DBOP_octet_length" ); break;
  338. case DBOP_bit_length : printf( "DBOP_bit_length" ); break;
  339. case DBOP_substring : printf( "DBOP_substring" ); break;
  340. case DBOP_upper : printf( "DBOP_upper" ); break;
  341. case DBOP_lower : printf( "DBOP_lower" ); break;
  342. case DBOP_trim : printf( "DBOP_trim" ); break;
  343. case DBOP_translate : printf( "DBOP_translate" ); break;
  344. case DBOP_convert : printf( "DBOP_convert" ); break;
  345. case DBOP_string_concat : printf( "DBOP_string_concat" ); break;
  346. case DBOP_current_date : printf( "DBOP_current_date" ); break;
  347. case DBOP_current_time : printf( "DBOP_current_time" ); break;
  348. case DBOP_current_timestamp : printf( "DBOP_current_timestamp" ); break;
  349. case DBOP_content_select : printf( "DBOP_content_select" ); break;
  350. case DBOP_content : printf( "DBOP_content" ); break;
  351. case DBOP_content_freetext : printf( "DBOP_content_freetext" ); break;
  352. case DBOP_content_proximity : printf( "DBOP_content_proximity" ); break;
  353. case DBOP_content_vector_or : printf( "DBOP_content_vector_or" ); break;
  354. case DBOP_delete : printf( "DBOP_delete" ); break;
  355. case DBOP_update : printf( "DBOP_update" ); break;
  356. case DBOP_insert : printf( "DBOP_insert" ); break;
  357. case DBOP_min : printf( "DBOP_min" ); break;
  358. case DBOP_max : printf( "DBOP_max" ); break;
  359. case DBOP_count : printf( "DBOP_count" ); break;
  360. case DBOP_sum : printf( "DBOP_sum" ); break;
  361. case DBOP_avg : printf( "DBOP_avg" ); break;
  362. case DBOP_any_sample : printf( "DBOP_any_sample" ); break;
  363. case DBOP_stddev : printf( "DBOP_stddev" ); break;
  364. case DBOP_stddev_pop : printf( "DBOP_stddev_pop" ); break;
  365. case DBOP_var : printf( "DBOP_var" ); break;
  366. case DBOP_var_pop : printf( "DBOP_var_pop" ); break;
  367. case DBOP_first : printf( "DBOP_first" ); break;
  368. case DBOP_last : printf( "DBOP_last" ); break;
  369. case DBOP_in : printf( "DBOP_in" ); break;
  370. case DBOP_exists : printf( "DBOP_exists" ); break;
  371. case DBOP_unique : printf( "DBOP_unique" ); break;
  372. case DBOP_subset : printf( "DBOP_subset" ); break;
  373. case DBOP_proper_subset : printf( "DBOP_proper_subset" ); break;
  374. case DBOP_superset : printf( "DBOP_superset" ); break;
  375. case DBOP_proper_superset : printf( "DBOP_proper_superset" ); break;
  376. case DBOP_disjoint : printf( "DBOP_disjoint" ); break;
  377. case DBOP_pass_through : printf( "DBOP_pass_through" ); break;
  378. case DBOP_defined_by_GUID : printf( "DBOP_defined_by_GUID" ); break;
  379. case DBOP_text_command : printf( "DBOP_text_command" ); break;
  380. case DBOP_SQL_select : printf( "DBOP_SQL_select" ); break;
  381. case DBOP_prior_command_tree : printf( "DBOP_prior_command_tree" ); break;
  382. case DBOP_add_columns : printf( "DBOP_add_columns" ); break;
  383. case DBOP_column_list_anchor : printf( "DBOP_column_list_anchor" ); break;
  384. case DBOP_column_list_element : printf( "DBOP_column_list_element" ); break;
  385. case DBOP_command_list_anchor : printf( "DBOP_command_list_anchor" ); break;
  386. case DBOP_command_list_element : printf( "DBOP_command_list_element" ); break;
  387. case DBOP_from_list_anchor : printf( "DBOP_from_list_anchor" ); break;
  388. case DBOP_from_list_element : printf( "DBOP_from_list_element" ); break;
  389. case DBOP_project_list_anchor : printf( "DBOP_project_list_anchor" ); break;
  390. case DBOP_project_list_element : printf( "DBOP_project_list_element" ); break;
  391. case DBOP_row_list_anchor : printf( "DBOP_row_list_anchor" ); break;
  392. case DBOP_row_list_element : printf( "DBOP_row_list_element" ); break;
  393. case DBOP_scalar_list_anchor : printf( "DBOP_scalar_list_anchor" ); break;
  394. case DBOP_scalar_list_element : printf( "DBOP_scalar_list_element" ); break;
  395. case DBOP_set_list_anchor : printf( "DBOP_set_list_anchor" ); break;
  396. case DBOP_set_list_element : printf( "DBOP_set_list_element" ); break;
  397. case DBOP_sort_list_anchor : printf( "DBOP_sort_list_anchor" ); break;
  398. case DBOP_sort_list_element : printf( "DBOP_sort_list_element" ); break;
  399. case DBOP_alter_character_set : printf( "DBOP_alter_character_set" ); break;
  400. case DBOP_alter_collation : printf( "DBOP_alter_collation" ); break;
  401. case DBOP_alter_domain : printf( "DBOP_alter_domain" ); break;
  402. case DBOP_alter_index : printf( "DBOP_alter_index" ); break;
  403. case DBOP_alter_procedure : printf( "DBOP_alter_procedure" ); break;
  404. case DBOP_alter_schema : printf( "DBOP_alter_schema" ); break;
  405. case DBOP_alter_table : printf( "DBOP_alter_table" ); break;
  406. case DBOP_alter_trigger : printf( "DBOP_alter_trigger" ); break;
  407. case DBOP_alter_view : printf( "DBOP_alter_view" ); break;
  408. case DBOP_coldef_list_anchor : printf( "DBOP_coldef_list_anchor" ); break;
  409. case DBOP_coldef_list_element : printf( "DBOP_coldef_list_element" ); break;
  410. case DBOP_create_assertion : printf( "DBOP_create_assertion" ); break;
  411. case DBOP_create_character_set : printf( "DBOP_create_character_set" ); break;
  412. case DBOP_create_collation : printf( "DBOP_create_collation" ); break;
  413. case DBOP_create_domain : printf( "DBOP_create_domain" ); break;
  414. case DBOP_create_index : printf( "DBOP_create_index" ); break;
  415. case DBOP_create_procedure : printf( "DBOP_create_procedure" ); break;
  416. case DBOP_create_schema : printf( "DBOP_create_schema" ); break;
  417. case DBOP_create_synonym : printf( "DBOP_create_synonym" ); break;
  418. case DBOP_create_table : printf( "DBOP_create_table" ); break;
  419. case DBOP_create_temporary_table : printf( "DBOP_create_temporary_table" ); break;
  420. case DBOP_create_translation : printf( "DBOP_create_translation" ); break;
  421. case DBOP_create_trigger : printf( "DBOP_create_trigger" ); break;
  422. case DBOP_create_view : printf( "DBOP_create_view" ); break;
  423. case DBOP_drop_assertion : printf( "DBOP_drop_assertion" ); break;
  424. case DBOP_drop_character_set : printf( "DBOP_drop_character_set" ); break;
  425. case DBOP_drop_collation : printf( "DBOP_drop_collation" ); break;
  426. case DBOP_drop_domain : printf( "DBOP_drop_domain" ); break;
  427. case DBOP_drop_index : printf( "DBOP_drop_index" ); break;
  428. case DBOP_drop_procedure : printf( "DBOP_drop_procedure" ); break;
  429. case DBOP_drop_schema : printf( "DBOP_drop_schema" ); break;
  430. case DBOP_drop_synonym : printf( "DBOP_drop_synonym" ); break;
  431. case DBOP_drop_table : printf( "DBOP_drop_table" ); break;
  432. case DBOP_drop_translation : printf( "DBOP_drop_translation" ); break;
  433. case DBOP_drop_trigger : printf( "DBOP_drop_trigger" ); break;
  434. case DBOP_drop_view : printf( "DBOP_drop_view" ); break;
  435. case DBOP_foreign_key : printf( "DBOP_foreign_key" ); break;
  436. case DBOP_grant_privileges : printf( "DBOP_grant_privileges" ); break;
  437. case DBOP_index_list_anchor : printf( "DBOP_index_list_anchor" ); break;
  438. case DBOP_index_list_element : printf( "DBOP_index_list_element" ); break;
  439. case DBOP_primary_key : printf( "DBOP_primary_key" ); break;
  440. case DBOP_property_list_anchor : printf( "DBOP_property_list_anchor" ); break;
  441. case DBOP_property_list_element : printf( "DBOP_property_list_element" ); break;
  442. case DBOP_referenced_table : printf( "DBOP_referenced_table" ); break;
  443. case DBOP_rename_object : printf( "DBOP_rename_object" ); break;
  444. case DBOP_revoke_privileges : printf( "DBOP_revoke_privileges" ); break;
  445. case DBOP_schema_authorization : printf( "DBOP_schema_authorization" ); break;
  446. case DBOP_unique_key : printf( "DBOP_unique_key" ); break;
  447. case DBOP_scope_list_anchor : printf( "DBOP_scope_list_anchor" ); break;
  448. case DBOP_scope_list_element : printf( "DBOP_scope_list_element" ); break;
  449. case DBOP_content_table : printf( "DBOP_content_table" ); break;
  450. default : printf( "unknown DBOP" ); break;
  451. }
  452. printf( "\n" );
  453. PrintSpace( iLevel );
  454. printf( "wKind: (%d) ", pNode->wKind );
  455. switch( pNode->wKind )
  456. {
  457. case DBVALUEKIND_BYGUID :
  458. {
  459. printf( "DBVALUEKIND_BYGUID " );
  460. break;
  461. }
  462. case DBVALUEKIND_COLDESC :
  463. {
  464. printf( "DBVALUEKIND_COLDESC " );
  465. break;
  466. }
  467. case DBVALUEKIND_ID :
  468. {
  469. printf( "DBVALUEKIND_ID: " );
  470. if ( 0 == pNode->value.pdbidValue )
  471. printf( "NULL" );
  472. else
  473. {
  474. DBKIND kind = pNode->value.pdbidValue->eKind;
  475. if ( DBKIND_GUID == kind ||
  476. DBKIND_GUID_NAME == kind ||
  477. DBKIND_GUID_PROPID == kind )
  478. {
  479. GUID &g = pNode->value.pdbidValue->uGuid.guid;
  480. printf( "%8.8x-%4.4x-%4.4x-%2.2x%2.2x-"
  481. "%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x",
  482. g.Data1,g.Data2,g.Data3,g.Data4[0],
  483. g.Data4[1],g.Data4[2],g.Data4[3],g.Data4[4],
  484. g.Data4[5],g.Data4[6],g.Data4[7] );
  485. }
  486. if ( DBKIND_GUID_PROPID == kind ||
  487. DBKIND_PROPID == kind )
  488. printf( " %d", pNode->value.pdbidValue->uName.ulPropid );
  489. if ( DBKIND_GUID_NAME == kind ||
  490. DBKIND_NAME == kind )
  491. printf( " '%ws'", pNode->value.pdbidValue->uName.pwszName );
  492. }
  493. break;
  494. }
  495. case DBVALUEKIND_CONTENT :
  496. {
  497. printf( "DBVALUEKIND_CONTENT: " );
  498. if ( 0 == pNode->value.pdbcntntValue )
  499. printf( "NULL" );
  500. else
  501. printf( "'%ws', method %d, weight %d, lcid %#x",
  502. pNode->value.pdbcntntValue->pwszPhrase,
  503. pNode->value.pdbcntntValue->dwGenerateMethod,
  504. pNode->value.pdbcntntValue->lWeight,
  505. pNode->value.pdbcntntValue->lcid );
  506. break;
  507. }
  508. case DBVALUEKIND_CONTENTVECTOR :
  509. {
  510. printf( "DBVALUEKIND_CONTENTVECTOR: " );
  511. DBCONTENTVECTOR *p = pNode->value.pdbcntntvcValue;
  512. if ( 0 == p )
  513. printf( "NULL" );
  514. else
  515. {
  516. printf( "method %d, weight %d ",
  517. p->dwRankingMethod,
  518. p->lWeight );
  519. }
  520. break;
  521. }
  522. case DBVALUEKIND_GROUPINFO :
  523. {
  524. printf( "DBVALUEKIND_GROUPINFO " );
  525. break;
  526. }
  527. case DBVALUEKIND_PARAMETER :
  528. {
  529. printf( "DBVALUEKIND_PARAMETER " );
  530. break;
  531. }
  532. case DBVALUEKIND_PROPERTY :
  533. {
  534. printf( "DBVALUEKIND_PROPERTY " );
  535. break;
  536. }
  537. case DBVALUEKIND_SETFUNC :
  538. {
  539. printf( "DBVALUEKIND_SETFUNC " );
  540. break;
  541. }
  542. case DBVALUEKIND_SORTINFO :
  543. {
  544. printf( "DBVALUEKIND_SORTINFO: " );
  545. if ( 0 == pNode->value.pdbsrtinfValue )
  546. printf( "NULL" );
  547. else
  548. printf( "fDesc %d, lcid %#x",
  549. pNode->value.pdbsrtinfValue->fDesc,
  550. pNode->value.pdbsrtinfValue->lcid );
  551. break;
  552. }
  553. case DBVALUEKIND_TEXT :
  554. {
  555. printf( "DBVALUEKIND_TEXT " );
  556. break;
  557. }
  558. case DBVALUEKIND_COMMAND :
  559. {
  560. printf( "DBVALUEKIND_COMMAND " );
  561. break;
  562. }
  563. case DBVALUEKIND_MONIKER :
  564. {
  565. printf( "DBVALUEKIND_MONIKER " );
  566. break;
  567. }
  568. case DBVALUEKIND_ROWSET :
  569. {
  570. printf( "DBVALUEKIND_ROWSET " );
  571. break;
  572. }
  573. case DBVALUEKIND_LIKE :
  574. {
  575. printf( "DBVALUEKIND_LIKE " );
  576. break;
  577. }
  578. case DBVALUEKIND_CONTENTPROXIMITY :
  579. {
  580. printf( "DBVALUEKIND_CONTENTPROXIMITY " );
  581. break;
  582. }
  583. case DBVALUEKIND_CONTENTSCOPE :
  584. {
  585. printf( "DBVALUEKIND_CONTENTSCOPE " );
  586. if ( 0 == pNode->value.pdbcntntscpValue )
  587. printf( "NULL" );
  588. else
  589. printf( "dwFlags %#x, pwszElementValue %ws",
  590. pNode->value.pdbcntntscpValue->dwFlags,
  591. pNode->value.pdbcntntscpValue->pwszElementValue );
  592. break;
  593. }
  594. case DBVALUEKIND_CONTENTTABLE :
  595. {
  596. printf( "DBVALUEKIND_CONTENTTABLE " );
  597. if ( 0 == pNode->value.pdbcntnttblValue )
  598. printf( "NULL" );
  599. else
  600. printf( "machine %ws, catalog %ws",
  601. pNode->value.pdbcntnttblValue->pwszMachine,
  602. pNode->value.pdbcntnttblValue->pwszCatalog );
  603. break;
  604. }
  605. case DBVALUEKIND_IDISPATCH :
  606. {
  607. printf( "DBVALUEKIND_IDISPATCH " );
  608. break;
  609. }
  610. case DBVALUEKIND_IUNKNOWN :
  611. {
  612. printf( "DBVALUEKIND_IUNKNOWN " );
  613. break;
  614. }
  615. case DBVALUEKIND_EMPTY :
  616. {
  617. printf( "DBVALUEKIND_EMPTY " );
  618. break;
  619. }
  620. case DBVALUEKIND_NULL :
  621. {
  622. printf( "DBVALUEKIND_NULL " );
  623. break;
  624. }
  625. case DBVALUEKIND_I2 :
  626. {
  627. printf( "DBVALUEKIND_I2: %d", pNode->value.sValue );
  628. break;
  629. }
  630. case DBVALUEKIND_I4 :
  631. {
  632. printf( "DBVALUEKIND_I4: %d", pNode->value.lValue );
  633. break;
  634. }
  635. case DBVALUEKIND_R4 :
  636. {
  637. printf( "DBVALUEKIND_R4: %f", pNode->value.flValue );
  638. break;
  639. }
  640. case DBVALUEKIND_R8 :
  641. {
  642. printf( "DBVALUEKIND_R8: %lf", pNode->value.dblValue );
  643. break;
  644. }
  645. case DBVALUEKIND_CY :
  646. {
  647. printf( "DBVALUEKIND_CY " );
  648. break;
  649. }
  650. case DBVALUEKIND_DATE :
  651. {
  652. printf( "DBVALUEKIND_DATE " );
  653. break;
  654. }
  655. case DBVALUEKIND_BSTR :
  656. {
  657. printf( "DBVALUEKIND_BSTR: '%ws'", pNode->value.pbstrValue );
  658. break;
  659. }
  660. case DBVALUEKIND_ERROR :
  661. {
  662. printf( "DBVALUEKIND_ERROR: %d", pNode->value.scodeValue );
  663. break;
  664. }
  665. case DBVALUEKIND_BOOL :
  666. {
  667. printf( "DBVALUEKIND_BOOL: %d", pNode->value.fValue );
  668. break;
  669. }
  670. case DBVALUEKIND_VARIANT :
  671. {
  672. printf( "DBVALUEKIND_VARIANT " );
  673. // Indexing Service uses PROPVARIANTs (extended VARIANTs)
  674. DisplayVariant( (PROPVARIANT *) pNode->value.pvarValue );
  675. break;
  676. }
  677. case DBVALUEKIND_I1 :
  678. {
  679. printf( "DBVALUEKIND_I1: %d", pNode->value.schValue );
  680. break;
  681. }
  682. case DBVALUEKIND_UI1 :
  683. {
  684. printf( "DBVALUEKIND_UI1: %u", pNode->value.uchValue );
  685. break;
  686. }
  687. case DBVALUEKIND_UI2 :
  688. {
  689. printf( "DBVALUEKIND_UI2: %u", pNode->value.usValue );
  690. break;
  691. }
  692. case DBVALUEKIND_UI4 :
  693. {
  694. printf( "DBVALUEKIND_UI4: %u", pNode->value.ulValue );
  695. break;
  696. }
  697. case DBVALUEKIND_I8 :
  698. {
  699. printf( "DBVALUEKIND_I8: %I64d", pNode->value.llValue );
  700. break;
  701. }
  702. case DBVALUEKIND_UI8 :
  703. {
  704. printf( "DBVALUEKIND_UI8: %I64u", pNode->value.llValue );
  705. break;
  706. }
  707. case DBVALUEKIND_GUID :
  708. {
  709. printf( "DBVALUEKIND_GUID " );
  710. break;
  711. }
  712. case DBVALUEKIND_BYTES :
  713. {
  714. printf( "DBVALUEKIND_BYTES " );
  715. break;
  716. }
  717. case DBVALUEKIND_STR :
  718. {
  719. printf( "DBVALUEKIND_STR: '%s'", pNode->value.pzValue );
  720. break;
  721. }
  722. case DBVALUEKIND_WSTR :
  723. {
  724. printf( "DBVALUEKIND_WSTR: '%ws'", pNode->value.pwszValue );
  725. break;
  726. }
  727. case DBVALUEKIND_NUMERIC :
  728. {
  729. printf( "DBVALUEKIND_NUMERIC " );
  730. break;
  731. }
  732. case DBVALUEKIND_DBDATE :
  733. {
  734. printf( "DBVALUEKIND_DBDATE " );
  735. break;
  736. }
  737. case DBVALUEKIND_DBTIME :
  738. {
  739. printf( "DBVALUEKIND_DBTIME " );
  740. break;
  741. }
  742. case DBVALUEKIND_DBTIMESTAMP :
  743. {
  744. printf( "DBVALUEKIND_DBTIMESTAMP " );
  745. break;
  746. }
  747. default :
  748. {
  749. printf( "unknown DBVALUEKIND " );
  750. break;
  751. }
  752. }
  753. printf( "\n" );
  754. if ( pNode->pctFirstChild )
  755. {
  756. PrintSpace( iLevel );
  757. printf( "first child:\n" );
  758. DisplayCommandTree( pNode->pctFirstChild, iLevel + 1 );
  759. }
  760. if ( pNode->pctNextSibling )
  761. {
  762. PrintSpace( iLevel );
  763. printf( "next sibling:\n" );
  764. DisplayCommandTree( pNode->pctNextSibling, iLevel + 1 );
  765. }
  766. if ( 0 == iLevel )
  767. printf( "\n" );
  768. } //DisplayCommandTree