/Main/Libraries/Esent/jet_objectlist.cs

# · C# · 178 lines · 63 code · 24 blank · 91 comment · 0 complexity · bd8e5fa9b4a403d5a527cc833bac1d46 MD5 · raw file

  1. //-----------------------------------------------------------------------
  2. // <copyright file="jet_objectlist.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_OBJECTLIST structure.
  14. /// </summary>
  15. [StructLayout(LayoutKind.Sequential)]
  16. [SuppressMessage(
  17. "Microsoft.StyleCop.CSharp.NamingRules",
  18. "SA1307:AccessibleFieldsMustBeginWithUpperCaseLetter",
  19. Justification = "This should match the unmanaged API, which isn't capitalized.")]
  20. internal struct NATIVE_OBJECTLIST
  21. {
  22. /// <summary>
  23. /// Size of the structure.
  24. /// </summary>
  25. public uint cbStruct;
  26. /// <summary>
  27. /// Tableid of the temporary table.
  28. /// </summary>
  29. public IntPtr tableid;
  30. /// <summary>
  31. /// Number of records in the temporary table.
  32. /// </summary>
  33. public uint cRecord;
  34. /// <summary>
  35. /// The id of column containing the name of the container type.
  36. /// </summary>
  37. public uint columnidcontainername;
  38. /// <summary>
  39. /// The id of the column containing the name of the object.
  40. /// </summary>
  41. public uint columnidobjectname;
  42. /// <summary>
  43. /// The id of the column containing the type of the object.
  44. /// </summary>
  45. public uint columnidobjtyp;
  46. /// <summary>
  47. /// Obsolete. Do not use.
  48. /// </summary>
  49. [Obsolete("Unused member")]
  50. public uint columniddtCreate;
  51. /// <summary>
  52. /// Obsolete. Do not use.
  53. /// </summary>
  54. [Obsolete("Unused member")]
  55. public uint columniddtUpdate;
  56. /// <summary>
  57. /// The id of the column containing object grbits.
  58. /// </summary>
  59. public uint columnidgrbit;
  60. /// <summary>
  61. /// The id of the column containing object flags.
  62. /// </summary>
  63. public uint columnidflags;
  64. /// <summary>
  65. /// The id of the column containing the number of records in the table.
  66. /// </summary>
  67. public uint columnidcRecord;
  68. /// <summary>
  69. /// The id of the column containing the number of pages the object uses.
  70. /// </summary>
  71. public uint columnidcPage;
  72. }
  73. /// <summary>
  74. /// Information about a temporary table containing information
  75. /// about all tables for a given database.
  76. /// </summary>
  77. [SuppressMessage(
  78. "Microsoft.StyleCop.CSharp.NamingRules",
  79. "SA1300:ElementMustBeginWithUpperCaseLetter",
  80. Justification = "This should match the unmanaged API, which isn't capitalized.")]
  81. public class JET_OBJECTLIST
  82. {
  83. /// <summary>
  84. /// Gets tableid of the temporary table. This should be closed
  85. /// when the table is no longer needed.
  86. /// </summary>
  87. public JET_TABLEID tableid { get; internal set; }
  88. /// <summary>
  89. /// Gets the number of records in the temporary table.
  90. /// </summary>
  91. public int cRecord { get; internal set; }
  92. /// <summary>
  93. /// Gets the columnid of the column in the temporary table which
  94. /// stores the name of the table.
  95. /// </summary>
  96. public JET_COLUMNID columnidobjectname { get; internal set; }
  97. /// <summary>
  98. /// Gets the columnid of the column in the temporary table which
  99. /// stores the type of the table.
  100. /// </summary>
  101. public JET_COLUMNID columnidobjtyp { get; internal set; }
  102. /// <summary>
  103. /// Gets the columnid of the column in the temporary table which
  104. /// stores the grbits used when the table was created.
  105. /// </summary>
  106. public JET_COLUMNID columnidgrbit { get; internal set; }
  107. /// <summary>
  108. /// Gets the columnid of the column in the temporary table which
  109. /// stores the table flags (e.g. the system table flag).
  110. /// </summary>
  111. public JET_COLUMNID columnidflags { get; internal set; }
  112. /// <summary>
  113. /// Gets the columnid of the column in the temporary table which
  114. /// stores the number of records in the table.
  115. /// </summary>
  116. public JET_COLUMNID columnidcRecord { get; internal set; }
  117. /// <summary>
  118. /// Gets the columnid of the column in the temporary table which
  119. /// stores the number of pages used by the table.
  120. /// </summary>
  121. public JET_COLUMNID columnidcPage { get; internal set; }
  122. /// <summary>
  123. /// Returns a <see cref="T:System.String"/> that represents the current <see cref="JET_OBJECTLIST"/>.
  124. /// </summary>
  125. /// <returns>
  126. /// A <see cref="T:System.String"/> that represents the current <see cref="JET_OBJECTLIST"/>.
  127. /// </returns>
  128. public override string ToString()
  129. {
  130. return String.Format(
  131. CultureInfo.InvariantCulture,
  132. "JET_OBJECTLIST(0x{0:x},{1} records)",
  133. this.tableid,
  134. this.cRecord);
  135. }
  136. /// <summary>
  137. /// Sets the fields of the object from a native JET_OBJECTLIST struct.
  138. /// </summary>
  139. /// <param name="value">
  140. /// The native objectlist to set the values from.
  141. /// </param>
  142. internal void SetFromNativeObjectlist(NATIVE_OBJECTLIST value)
  143. {
  144. this.tableid = new JET_TABLEID { Value = value.tableid };
  145. this.cRecord = checked((int)value.cRecord);
  146. this.columnidobjectname = new JET_COLUMNID { Value = value.columnidobjectname };
  147. this.columnidobjtyp = new JET_COLUMNID { Value = value.columnidobjtyp };
  148. this.columnidgrbit = new JET_COLUMNID { Value = value.columnidgrbit };
  149. this.columnidflags = new JET_COLUMNID { Value = value.columnidflags };
  150. this.columnidcRecord = new JET_COLUMNID { Value = value.columnidcRecord };
  151. this.columnidcPage = new JET_COLUMNID { Value = value.columnidcPage };
  152. }
  153. }
  154. }