PageRenderTime 47ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/EsentInterop/jet_indexlist.cs

#
C# | 292 lines | 89 code | 38 blank | 165 comment | 0 complexity | b6389eb2b6cfd78cf5fa19c8e3923c2e MD5 | raw file
Possible License(s): BSD-3-Clause
  1. //-----------------------------------------------------------------------
  2. // <copyright file="jet_indexlist.cs" company="Microsoft Corporation">
  3. // Copyright (c) Microsoft Corporation.
  4. // </copyright>
  5. //-----------------------------------------------------------------------
  6. namespace Microsoft.Isam.Esent.Interop
  7. {
  8. using System;
  9. using System.Diagnostics.CodeAnalysis;
  10. using System.Globalization;
  11. using System.Runtime.InteropServices;
  12. /// <summary>
  13. /// The native version of the JET_INDEXLIST structure.
  14. /// </summary>
  15. [StructLayout(LayoutKind.Sequential)]
  16. [SuppressMessage("Microsoft.StyleCop.CSharp.NamingRules",
  17. "SA1305:FieldNamesMustNotUseHungarianNotation",
  18. Justification = "This should match the unmanaged API, which isn't capitalized.")]
  19. [SuppressMessage(
  20. "Microsoft.StyleCop.CSharp.NamingRules",
  21. "SA1307:AccessibleFieldsMustBeginWithUpperCaseLetter",
  22. Justification = "This should match the unmanaged API, which isn't capitalized.")]
  23. internal struct NATIVE_INDEXLIST
  24. {
  25. /// <summary>
  26. /// Size of the structure.
  27. /// </summary>
  28. public uint cbStruct;
  29. /// <summary>
  30. /// Tableid of the temporary table.
  31. /// </summary>
  32. public IntPtr tableid;
  33. /// <summary>
  34. /// Number of records in the table.
  35. /// </summary>
  36. public uint cRecord;
  37. /// <summary>
  38. /// Id of the column containing the name of the index.
  39. /// </summary>
  40. public uint columnidindexname;
  41. /// <summary>
  42. /// Id of the column containing index options.
  43. /// </summary>
  44. public uint columnidgrbitIndex;
  45. /// <summary>
  46. /// Id of the column containing the number of unique keys in the index.
  47. /// This is updated by <see cref="Api.JetComputeStats"/>.
  48. /// </summary>
  49. public uint columnidcKey;
  50. /// <summary>
  51. /// Id of the column containing the number of entries in the index.
  52. /// This is updated by <see cref="Api.JetComputeStats"/>.
  53. /// </summary>
  54. public uint columnidcEntry;
  55. /// <summary>
  56. /// Id of the column containing the number of pages in the index.
  57. /// This is updated by <see cref="Api.JetComputeStats"/>.
  58. /// </summary>
  59. public uint columnidcPage;
  60. /// <summary>
  61. /// Id of the column containing the number of columns in the index
  62. /// definition.
  63. /// </summary>
  64. public uint columnidcColumn;
  65. /// <summary>
  66. /// Id of the column storing the index of this column in the index key.
  67. /// </summary>
  68. public uint columnidiColumn;
  69. /// <summary>
  70. /// Id of the column containing the columnid.
  71. /// </summary>
  72. public uint columnidcolumnid;
  73. /// <summary>
  74. /// Id of the column containing the column type.
  75. /// </summary>
  76. public uint columnidcoltyp;
  77. /// <summary>
  78. /// Id of the column containing the country code (obsolete).
  79. /// </summary>
  80. [Obsolete("Deprecated")]
  81. public uint columnidCountry;
  82. /// <summary>
  83. /// Id of the column containing the LCID of the index.
  84. /// </summary>
  85. public uint columnidLangid;
  86. /// <summary>
  87. /// Id of the column containing the code page of the index.
  88. /// </summary>
  89. public uint columnidCp;
  90. /// <summary>
  91. /// Obsolete. Ignored.
  92. /// </summary>
  93. [Obsolete("Deprecated")]
  94. public uint columnidCollate;
  95. /// <summary>
  96. /// Id of the column giving the column options.
  97. /// </summary>
  98. public uint columnidgrbitColumn;
  99. /// <summary>
  100. /// Id of the column giving the column name.
  101. /// </summary>
  102. public uint columnidcolumnname;
  103. /// <summary>
  104. /// Id of the column giving the LCMapString options.
  105. /// </summary>
  106. public uint columnidLCMapFlags;
  107. }
  108. /// <summary>
  109. /// Information about a temporary table containing information
  110. /// about all indexes for a given table.
  111. /// </summary>
  112. [SuppressMessage(
  113. "Microsoft.StyleCop.CSharp.NamingRules",
  114. "SA1300:ElementMustBeginWithUpperCaseLetter",
  115. Justification = "This should match the unmanaged API, which isn't capitalized.")]
  116. public sealed class JET_INDEXLIST
  117. {
  118. /// <summary>
  119. /// Gets tableid of the temporary table. This should be closed
  120. /// when the table is no longer needed.
  121. /// </summary>
  122. public JET_TABLEID tableid { get; internal set; }
  123. /// <summary>
  124. /// Gets the number of records in the temporary table.
  125. /// </summary>
  126. public int cRecord { get; internal set; }
  127. /// <summary>
  128. /// Gets the columnid of the column in the temporary table which
  129. /// stores the name of the index.
  130. /// The column is of type JET_coltyp.Text.
  131. /// </summary>
  132. public JET_COLUMNID columnidindexname { get; internal set; }
  133. /// <summary>
  134. /// Gets the columnid of the column in the temporary table which
  135. /// stores the the grbits used on the index. See <see cref="CreateIndexGrbit"/>.
  136. /// The column is of type JET_coltyp.Long.
  137. /// </summary>
  138. public JET_COLUMNID columnidgrbitIndex { get; internal set; }
  139. /// <summary>
  140. /// Gets the columnid of the column in the temporary table which
  141. /// stores the number of unique keys in the index.
  142. /// This value is not current and is only is updated by <see cref="Api.JetComputeStats"/>.
  143. /// The column is of type JET_coltyp.Long.
  144. /// </summary>
  145. public JET_COLUMNID columnidcKey { get; internal set; }
  146. /// <summary>
  147. /// Gets the columnid of the column in the temporary table which
  148. /// stores the number of entries in the index.
  149. /// This value is not current and is only is updated by <see cref="Api.JetComputeStats"/>.
  150. /// The column is of type JET_coltyp.Long.
  151. /// </summary>
  152. public JET_COLUMNID columnidcEntry { get; internal set; }
  153. /// <summary>
  154. /// Gets the columnid of the column in the temporary table which
  155. /// stores the number of pages in the index.
  156. /// This value is not current and is only is updated by <see cref="Api.JetComputeStats"/>.
  157. /// The column is of type JET_coltyp.Long.
  158. /// </summary>
  159. public JET_COLUMNID columnidcPage { get; internal set; }
  160. /// <summary>
  161. /// Gets the columnid of the column in the temporary table which
  162. /// stores the number of columns in the index key.
  163. /// The column is of type JET_coltyp.Long.
  164. /// </summary>
  165. public JET_COLUMNID columnidcColumn { get; internal set; }
  166. /// <summary>
  167. /// Gets the columnid of the column in the temporary table which
  168. /// stores the index of of this column in the index key.
  169. /// The column is of type JET_coltyp.Long.
  170. /// </summary>
  171. public JET_COLUMNID columnidiColumn { get; internal set; }
  172. /// <summary>
  173. /// Gets the columnid of the column in the temporary table which
  174. /// stores the columnid of the column being indexed.
  175. /// The column is of type JET_coltyp.Long.
  176. /// </summary>
  177. public JET_COLUMNID columnidcolumnid { get; internal set; }
  178. /// <summary>
  179. /// Gets the columnid of the column in the temporary table which
  180. /// stores the column type of the column being indexed.
  181. /// The column is of type JET_coltyp.Long.
  182. /// </summary>
  183. public JET_COLUMNID columnidcoltyp { get; internal set; }
  184. /// <summary>
  185. /// Gets the columnid of the column in the temporary table which
  186. /// stores the language id (LCID) of the index.
  187. /// The column is of type JET_coltyp.Short.
  188. /// </summary>
  189. public JET_COLUMNID columnidLangid { get; internal set; }
  190. /// <summary>
  191. /// Gets the columnid of the column in the temporary table which
  192. /// stores the code page of the indexed column.
  193. /// The column is of type JET_coltyp.Short.
  194. /// </summary>
  195. public JET_COLUMNID columnidCp { get; internal set; }
  196. /// <summary>
  197. /// Gets the columnid of the column in the temporary table which
  198. /// stores the grbit that apply to the indexed column. See <see cref="IndexKeyGrbit"/>.
  199. /// The column is of type JET_coltyp.Long.
  200. /// </summary>
  201. public JET_COLUMNID columnidgrbitColumn { get; internal set; }
  202. /// <summary>
  203. /// Gets the columnid of the column in the temporary table which
  204. /// stores the grbit that apply to the indexed column. See <see cref="IndexKeyGrbit"/>.
  205. /// The column is of type JET_coltyp.Text.
  206. /// </summary>
  207. public JET_COLUMNID columnidcolumnname { get; internal set; }
  208. /// <summary>
  209. /// Gets the columnid of the column in the temporary table which
  210. /// stores the unicode normalization flags for the index.
  211. /// The column is of type JET_coltyp.Long.
  212. /// </summary>
  213. public JET_COLUMNID columnidLCMapFlags { get; internal set; }
  214. /// <summary>
  215. /// Returns a <see cref="T:System.String"/> that represents the current <see cref="JET_INDEXLIST"/>.
  216. /// </summary>
  217. /// <returns>
  218. /// A <see cref="T:System.String"/> that represents the current <see cref="JET_INDEXLIST"/>.
  219. /// </returns>
  220. public override string ToString()
  221. {
  222. return string.Format(
  223. CultureInfo.InvariantCulture,
  224. "JET_INDEXLIST(0x{0:x},{1} records)",
  225. this.tableid,
  226. this.cRecord);
  227. }
  228. /// <summary>
  229. /// Sets the fields of the object from a native JET_INDEXLIST struct.
  230. /// </summary>
  231. /// <param name="value">
  232. /// The native indexlist to set the values from.
  233. /// </param>
  234. internal void SetFromNativeIndexlist(NATIVE_INDEXLIST value)
  235. {
  236. this.tableid = new JET_TABLEID { Value = value.tableid };
  237. this.cRecord = checked((int)value.cRecord);
  238. this.columnidindexname = new JET_COLUMNID { Value = value.columnidindexname };
  239. this.columnidgrbitIndex = new JET_COLUMNID { Value = value.columnidgrbitIndex };
  240. this.columnidcKey = new JET_COLUMNID { Value = value.columnidcKey };
  241. this.columnidcEntry = new JET_COLUMNID { Value = value.columnidcEntry };
  242. this.columnidcPage = new JET_COLUMNID { Value = value.columnidcPage };
  243. this.columnidcColumn = new JET_COLUMNID { Value = value.columnidcColumn };
  244. this.columnidiColumn = new JET_COLUMNID { Value = value.columnidiColumn };
  245. this.columnidcolumnid = new JET_COLUMNID { Value = value.columnidcolumnid };
  246. this.columnidcoltyp = new JET_COLUMNID { Value = value.columnidcoltyp };
  247. this.columnidLangid = new JET_COLUMNID { Value = value.columnidLangid };
  248. this.columnidCp = new JET_COLUMNID { Value = value.columnidCp };
  249. this.columnidgrbitColumn = new JET_COLUMNID { Value = value.columnidgrbitColumn };
  250. this.columnidcolumnname = new JET_COLUMNID { Value = value.columnidcolumnname };
  251. this.columnidLCMapFlags = new JET_COLUMNID { Value = value.columnidLCMapFlags };
  252. }
  253. }
  254. }