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.

421 lines
12 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1993.
  5. //
  6. // File: QueryS.idl
  7. //
  8. // Contents: Pickle-able structures used in IQuery, et. al.
  9. //
  10. // History: 29-Mar-93 KyleP Created
  11. //
  12. //--------------------------------------------------------------------------
  13. [ uuid(E3971E54-4D6E-101A-971D-08002B2ECDA9),
  14. pointer_default(unique)
  15. ]
  16. interface IQueryStructures
  17. {
  18. //
  19. // Property set for dynamic query properties
  20. //
  21. // NOTE: PSGUID_QUERY is now defined in oledb.h as const GUID
  22. cpp_quote("#define DBQUERYGUID { 0x49691C90, \\")
  23. cpp_quote(" 0x7E17, 0x101A, \\")
  24. cpp_quote(" 0xA9, 0x1C, 0x08, 0x00, 0x2B, \\")
  25. cpp_quote(" 0x2E, 0xCD, 0xA9 } ")
  26. const DISPID DISPID_QUERY_RANKVECTOR = 2;
  27. const DISPID DISPID_QUERY_RANK = 3;
  28. const DISPID DISPID_QUERY_HITCOUNT = 4;
  29. const DISPID DISPID_QUERY_WORKID = 5;
  30. const DISPID DISPID_QUERY_ALL = 6;
  31. const DISPID DISPID_QUERY_UNFILTERED = 7;
  32. const DISPID DISPID_QUERY_REVNAME = 8;
  33. const DISPID DISPID_QUERY_VIRTUALPATH = 9;
  34. const DISPID DISPID_QUERY_LASTSEENTIME = 10;
  35. //
  36. // NOTE: The number of query properties includes the seven above,
  37. // plus 28 OLE-DB column IDs for pseudo-columns, plus eight
  38. // OLE-DB bookmark columns (41 total). In addition, dispids
  39. // always start at 2, a fact which is not taken into account in
  40. // the mapping macros. Reserve a few more to
  41. // allow for growth in the set of special columns.
  42. //
  43. const ULONG CQUERYDISPIDS = 11;
  44. cpp_quote("#define PSGUID_QUERY_METADATA { 0x624C9360, \\")
  45. cpp_quote(" 0x93D0, 0x11CF, \\")
  46. cpp_quote(" 0xA7, 0x87, 0x00, 0x00, 0x4C, \\")
  47. cpp_quote(" 0x75, 0x27, 0x52 } ")
  48. const DISPID DISPID_QUERY_METADATA_VROOTUSED = 2;
  49. const DISPID DISPID_QUERY_METADATA_VROOTAUTOMATIC = 3;
  50. const DISPID DISPID_QUERY_METADATA_VROOTMANUAL = 4;
  51. const DISPID DISPID_QUERY_METADATA_PROPGUID = 5;
  52. const DISPID DISPID_QUERY_METADATA_PROPDISPID = 6;
  53. const DISPID DISPID_QUERY_METADATA_PROPNAME = 7;
  54. const DISPID DISPID_QUERY_METADATA_STORELEVEL = 8;
  55. const DISPID DISPID_QUERY_METADATA_PROPMODIFIABLE = 9;
  56. const ULONG CQUERYMETADISPIDS = 10;
  57. //
  58. // Property set for OLE-DB bookmark properties
  59. //
  60. // BUGBUG - this may someday be defined in oledb.h. see ole-db spec bug #1271
  61. cpp_quote("#define DBBMKGUID { 0xC8B52232L, \\")
  62. cpp_quote(" 0x5CF3, 0x11CE, \\")
  63. cpp_quote(" {0xAD, 0xE5, 0x00, 0xAA, 0x00, \\")
  64. cpp_quote(" 0x44, 0x77, 0x3D } }")
  65. const DISPID PROPID_DBBMK_BOOKMARK = 2;
  66. const DISPID PROPID_DBBMK_CHAPTER = 3;
  67. const ULONG CDBBMKDISPIDS = 8;
  68. // BUGBUG - this may someday be defined in oledb.h. see ole-db spec bug #1271
  69. cpp_quote("#define DBSELFGUID {0xc8b52231,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}}")
  70. const DISPID PROPID_DBSELF_SELF = 2;
  71. const ULONG CDBSELFDISPIDS = 8;
  72. const ULONG CDBCOLDISPIDS = 28;
  73. // NOTE: CQUERYPROPERTY must be < sum of:
  74. // CQUERYDISPIDS + CBQUERYMETADISPIDS + CDBBMKDISPIDS + CDBCOLDISPIDS + CDBSELFDISPIDS
  75. // Warning: Changing this number can change the ondisk format of OFS and CI
  76. const ULONG CQUERYPROPERTY = 64;
  77. cpp_quote("#define PSGUID_CHARACTERIZATION { 0x560c36c0, \\")
  78. cpp_quote(" 0x503a, 0x11cf, \\")
  79. cpp_quote(" 0xba, 0xa1, 0x00, 0x00, \\")
  80. cpp_quote(" 0x4c, 0x75, 0x2a, 0x9a } ")
  81. //
  82. // Query flags
  83. //
  84. const ULONG QUERY_VALIDBITS = 3;
  85. //
  86. // Restriction structures
  87. //
  88. const ULONG RTNone = 0;
  89. const ULONG RTAnd = 1;
  90. const ULONG RTOr = 2;
  91. const ULONG RTNot = 3;
  92. const ULONG RTContent = 4;
  93. const ULONG RTProperty = 5;
  94. const ULONG RTProximity = 6;
  95. const ULONG RTVector = 7;
  96. const ULONG RTNatLanguage = 8;
  97. typedef struct tagRESTRICTION RESTRICTION;
  98. //
  99. // Negation (NOT) Restriction
  100. //
  101. typedef struct tagNOTRESTRICTION
  102. {
  103. RESTRICTION * pRes;
  104. } NOTRESTRICTION;
  105. //
  106. // Node (AND/OR/PROXIMITY) Restriction
  107. //
  108. typedef struct tagNODERESTRICTION
  109. {
  110. ULONG cRes;
  111. [ size_is(cRes) ] RESTRICTION ** paRes;
  112. ULONG reserved;
  113. } NODERESTRICTION;
  114. //
  115. // Vector Restriction
  116. //
  117. // The vector restriction is similar to the OR restriction except
  118. // that each branch of the vector can be individually weighted and
  119. // a vector of ranks can be returned (the .RankVector property)
  120. // where each element of the vector is the rank of the corresponding
  121. // child restriction in the rank vector.
  122. //
  123. // Vector weights can have values between 0 and MAX_QUERY_RANK (currently
  124. // 1000). They are effectively the numerator of a fraction. MAX_QUERY_RANK
  125. // is the denominator.
  126. //
  127. // Note that no query optimization/reorganization is performed below
  128. // this level.
  129. //
  130. // The rank of a vector restriction may be computed in one of
  131. // several ways. These are:
  132. //
  133. //
  134. // MAX[ wi * ( MaxRank - ri ) ]
  135. // VECTOR_RANK_MIN MaxRank - ---------------------------------
  136. // MAX[wi]
  137. //
  138. // MAX[ wi * ri ]
  139. // VECTOR_RANK_MAX -----------------
  140. // MAX[wi]
  141. //
  142. // n
  143. // SUM ri * wi
  144. // i=1
  145. // VECTOR_RANK_INNER -------------
  146. // n
  147. // SUM wi
  148. // i=1
  149. //
  150. // n
  151. // 2 * SUM ri * wi
  152. // i=1
  153. // VECTOR_RANK_DICE --------------------
  154. // n 2 n 2
  155. // SUM ri + SUM wi
  156. // i=1 i=1
  157. //
  158. // n
  159. // SUM ri * wi
  160. // i=1
  161. // VECTOR_RANK_JACCARD ---------------------------------
  162. // n 2 n 2 n
  163. // SUM ri + SUM wi - SUM ri * wi
  164. // i=1 i=1 i=1
  165. //
  166. //
  167. // * wi = Weight of term i, ri = rank of term i in a given document
  168. //
  169. const ULONG VECTOR_RANK_MIN = 0;
  170. const ULONG VECTOR_RANK_MAX = 1;
  171. const ULONG VECTOR_RANK_INNER = 2;
  172. const ULONG VECTOR_RANK_DICE = 3;
  173. const ULONG VECTOR_RANK_JACCARD = 4;
  174. typedef struct tagVECTORRESTRICTION
  175. {
  176. NODERESTRICTION Node;
  177. ULONG RankMethod;
  178. } VECTORRESTRICTION;
  179. //
  180. // Content Restriction
  181. //
  182. const ULONG GENERATE_METHOD_EXACT = 0;
  183. const ULONG GENERATE_METHOD_PREFIXMATCH = 1;
  184. const ULONG GENERATE_METHOD_STEMMED = 2;
  185. typedef struct tagCONTENTRESTRICTION
  186. {
  187. FULLPROPSPEC prop; // Property
  188. [string] WCHAR * pwcsPhrase; // Content to search for
  189. LCID lcid; // locale
  190. ULONG ulGenerateMethod; // Generate method.
  191. } CONTENTRESTRICTION;
  192. //
  193. // Natural Language Restriction
  194. //
  195. typedef struct tagNATLANGUAGERESTRICTION
  196. {
  197. FULLPROPSPEC prop; // Property
  198. [string] WCHAR * pwcsPhrase; // Content to search for
  199. LCID lcid; // locale
  200. } NATLANGUAGERESTRICTION;
  201. //
  202. // Property Restriction
  203. //
  204. const ULONG PRLT = 0; // <
  205. const ULONG PRLE = 1; // <=
  206. const ULONG PRGT = 2; // >
  207. const ULONG PRGE = 3; // >=
  208. const ULONG PREQ = 4; // ==
  209. const ULONG PRNE = 5; // !=
  210. const ULONG PRRE = 6; // LIKE (Regular expression)
  211. const ULONG PRAllBits = 7; // (VAL & MASK) == MASK
  212. const ULONG PRSomeBits = 8; // (VAL & MASK) != 0
  213. const ULONG PRAll = 0x100; // all elements of vector
  214. const ULONG PRAny = 0x200; // any elements of vector
  215. typedef struct tagPROPERTYRESTRICTION
  216. {
  217. ULONG rel; // Relation
  218. FULLPROPSPEC prop; // Property
  219. PROPVARIANT prval; // Constant value
  220. } PROPERTYRESTRICTION;
  221. //
  222. // Base Restriction
  223. //
  224. union _URes;
  225. struct tagRESTRICTION
  226. {
  227. ULONG rt; // Restriction Type
  228. ULONG weight; // Query Weight
  229. [ switch_type(ULONG), switch_is(rt) ] union _URes
  230. {
  231. [ case(RTAnd) ] NODERESTRICTION ar;
  232. [ case(RTOr) ] NODERESTRICTION or;
  233. [ case(RTProximity) ] NODERESTRICTION pxr;
  234. [ case(RTVector) ] VECTORRESTRICTION vr;
  235. [ case(RTNot) ] NOTRESTRICTION nr;
  236. [ case(RTContent) ] CONTENTRESTRICTION cr;
  237. [ case(RTNatLanguage) ] NATLANGUAGERESTRICTION nlr;
  238. [ case(RTProperty) ] PROPERTYRESTRICTION pr;
  239. [ default ] ;
  240. } res;
  241. };
  242. //
  243. // Column descriptors.
  244. //
  245. // Each column represents a single property. A property is defined by
  246. // a UUID for the property set and either a index (DISPID) or name
  247. // to locate the property within the property set.
  248. //
  249. //
  250. typedef struct tagCOLUMNSET
  251. {
  252. ULONG cCol;
  253. [size_is(cCol)] FULLPROPSPEC * aCol;
  254. } COLUMNSET;
  255. //
  256. // Sort descriptors
  257. //
  258. // A sort is over a [sub] set of columns specified as return columns in
  259. // the query.
  260. //
  261. // BUGBUG - this should go away and be replaced by DBSORTKEY.
  262. //
  263. const ULONG QUERY_SORTASCEND = 0;
  264. const ULONG QUERY_SORTDESCEND = 1;
  265. const ULONG QUERY_SORTXASCEND = 2;
  266. const ULONG QUERY_SORTXDESCEND = 3;
  267. const ULONG QUERY_SORTDEFAULT = 4;
  268. typedef struct tagSORTKEY
  269. {
  270. FULLPROPSPEC propColumn;
  271. ULONG dwOrder; // Ascending/Descending
  272. LCID locale; //
  273. } SORTKEY;
  274. typedef struct tagSORTSET
  275. {
  276. ULONG cCol; // Number of sort columns
  277. [size_is(cCol)] SORTKEY * aCol;
  278. } SORTSET;
  279. //
  280. // Categorization descriptor
  281. //
  282. // Defines categorization of table. In IQuery this is just used as a
  283. // hint, indicating this categorization is likely to be used. The
  284. // column used for categorization is always the first uncategorized
  285. // sort column, except when clustering is used.
  286. //
  287. //
  288. // Unique categorization. Each unique value forms a category.
  289. //
  290. const ULONG CATEGORIZE_UNIQUE = 0;
  291. //
  292. // Cluster categorization. Use Inference clustering. Number of
  293. // clusters specified on entry.
  294. //
  295. const ULONG CATEGORIZE_CLUSTER = 1;
  296. //
  297. // Bucket categorization. Number of buckets and distribution of values
  298. // into buckets is defined.
  299. //
  300. const ULONG CATEGORIZE_BUCKETS = 2;
  301. const ULONG BUCKET_LINEAR = 0;
  302. const ULONG BUCKET_EXPONENTIAL = 1;
  303. typedef struct tagBUCKETCATEGORIZE
  304. {
  305. ULONG cBuckets;
  306. ULONG Distribution;
  307. } BUCKETCATEGORIZE;
  308. //
  309. // Range categorization. Ranges are explicitly specified.
  310. // The first range is from <minimum_value> to aRangeBegin[0] - <1 unit>.
  311. // Next from aRangeBegin[0] to aRangeBegin[1] - <1 unit>, etc.
  312. // The last range is from aRangeBegin[cRange-1] to <maximum_value>.
  313. // There will be a total of cRange + 1 ranges.
  314. //
  315. const ULONG CATEGORIZE_RANGE = 3;
  316. typedef struct tagRANGECATEGORIZE
  317. {
  318. ULONG cRange;
  319. [size_is(cRange)] PROPVARIANT * aRangeBegin;
  320. } RANGECATEGORIZE;
  321. typedef struct tagCATEGORIZATION
  322. {
  323. ULONG ulCatType;
  324. [ switch_type(ULONG), switch_is( ulCatType ) ] union
  325. {
  326. [ case(CATEGORIZE_CLUSTER) ] ULONG cClusters;
  327. [ case(CATEGORIZE_BUCKETS) ] BUCKETCATEGORIZE bucket;
  328. [ case(CATEGORIZE_RANGE) ] RANGECATEGORIZE range;
  329. [ case(CATEGORIZE_UNIQUE) ] ;
  330. };
  331. COLUMNSET csColumns; // columns that can be bound to for categorization
  332. } CATEGORIZATION;
  333. typedef struct tagCATEGORIZATIONSET
  334. {
  335. ULONG cCat; // Number of categorizations
  336. [size_is(cCat)] CATEGORIZATION * aCat;
  337. } CATEGORIZATIONSET;
  338. // Some other stuff, moved here from winnot.h [mikese]
  339. typedef unsigned long OCCURRENCE;
  340. const OCCURRENCE OCC_INVALID = 0xFFFFFFFF; // Invalid Occurrence
  341. const LONG MAX_QUERY_RANK = 1000; // Maximum Rank / Weight
  342. }