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.

190 lines
4.4 KiB

  1. //-----------------------------------------------------------------------------
  2. // File: icrsint.h
  3. //
  4. // Copyright: Copyright (c) Microsoft Corporation
  5. //
  6. // Contents: ADO C/C++ Record Binding Definitions
  7. //
  8. // Comments:
  9. //
  10. //-----------------------------------------------------------------------------
  11. #ifndef _ICRSINT_H_
  12. #define _ICRSINT_H_
  13. #include <olectl.h>
  14. #include <stddef.h>
  15. // forwards
  16. class CADORecordBinding;
  17. #define classoffset(base, derived) ((DWORD_PTR)(static_cast<base*>((derived*)8))-8)
  18. enum ADOFieldStatusEnum
  19. {
  20. adFldOK = 0,
  21. adFldBadAccessor = 1,
  22. adFldCantConvertValue = 2,
  23. adFldNull = 3,
  24. adFldTruncated = 4,
  25. adFldSignMismatch = 5,
  26. adFldDataOverFlow = 6,
  27. adFldCantCreate = 7,
  28. adFldUnavailable = 8,
  29. adFldPermissionDenied = 9,
  30. adFldIntegrityViolation = 10,
  31. adFldSchemaViolation = 11,
  32. adFldBadStatus = 12,
  33. adFldDefault = 13
  34. };
  35. typedef struct stADO_BINDING_ENTRY
  36. {
  37. ULONG_PTR ulOrdinal;
  38. WORD wDataType;
  39. BYTE bPrecision;
  40. BYTE bScale;
  41. ULONG_PTR ulSize;
  42. ULONG_PTR ulBufferOffset;
  43. ULONG_PTR ulStatusOffset;
  44. ULONG_PTR ulLengthOffset;
  45. ULONG_PTR ulADORecordBindingOffSet;
  46. BOOL fModify;
  47. } ADO_BINDING_ENTRY;
  48. #define BEGIN_ADO_BINDING(cls) public: \
  49. typedef cls ADORowClass; \
  50. const ADO_BINDING_ENTRY* STDMETHODCALLTYPE GetADOBindingEntries() { \
  51. static const ADO_BINDING_ENTRY rgADOBindingEntries[] = {
  52. //
  53. // Fixed length non-numeric data
  54. //
  55. #define ADO_FIXED_LENGTH_ENTRY(Ordinal, DataType, Buffer, Status, Modify)\
  56. {Ordinal, \
  57. DataType, \
  58. 0, \
  59. 0, \
  60. 0, \
  61. offsetof(ADORowClass, Buffer), \
  62. offsetof(ADORowClass, Status), \
  63. 0, \
  64. classoffset(CADORecordBinding, ADORowClass), \
  65. Modify},
  66. #define ADO_FIXED_LENGTH_ENTRY2(Ordinal, DataType, Buffer, Modify)\
  67. {Ordinal, \
  68. DataType, \
  69. 0, \
  70. 0, \
  71. 0, \
  72. offsetof(ADORowClass, Buffer), \
  73. 0, \
  74. 0, \
  75. classoffset(CADORecordBinding, ADORowClass), \
  76. Modify},
  77. //
  78. // Numeric data
  79. //
  80. #define ADO_NUMERIC_ENTRY(Ordinal, DataType, Buffer, Precision, Scale, Status, Modify)\
  81. {Ordinal, \
  82. DataType, \
  83. Precision, \
  84. Scale, \
  85. 0, \
  86. offsetof(ADORowClass, Buffer), \
  87. offsetof(ADORowClass, Status), \
  88. 0, \
  89. classoffset(CADORecordBinding, ADORowClass), \
  90. Modify},
  91. #define ADO_NUMERIC_ENTRY2(Ordinal, DataType, Buffer, Precision, Scale, Modify)\
  92. {Ordinal, \
  93. DataType, \
  94. Precision, \
  95. Scale, \
  96. 0, \
  97. offsetof(ADORowClass, Buffer), \
  98. 0, \
  99. 0, \
  100. classoffset(CADORecordBinding, ADORowClass), \
  101. Modify},
  102. //
  103. // Variable length data
  104. //
  105. #define ADO_VARIABLE_LENGTH_ENTRY(Ordinal, DataType, Buffer, Size, Status, Length, Modify)\
  106. {Ordinal, \
  107. DataType, \
  108. 0, \
  109. 0, \
  110. Size, \
  111. offsetof(ADORowClass, Buffer), \
  112. offsetof(ADORowClass, Status), \
  113. offsetof(ADORowClass, Length), \
  114. classoffset(CADORecordBinding, ADORowClass), \
  115. Modify},
  116. #define ADO_VARIABLE_LENGTH_ENTRY2(Ordinal, DataType, Buffer, Size, Status, Modify)\
  117. {Ordinal, \
  118. DataType, \
  119. 0, \
  120. 0, \
  121. Size, \
  122. offsetof(ADORowClass, Buffer), \
  123. offsetof(ADORowClass, Status), \
  124. 0, \
  125. classoffset(CADORecordBinding, ADORowClass), \
  126. Modify},
  127. #define ADO_VARIABLE_LENGTH_ENTRY3(Ordinal, DataType, Buffer, Size, Length, Modify)\
  128. {Ordinal, \
  129. DataType, \
  130. 0, \
  131. 0, \
  132. Size, \
  133. offsetof(ADORowClass, Buffer), \
  134. 0, \
  135. offsetof(ADORowClass, Length), \
  136. classoffset(CADORecordBinding, ADORowClass), \
  137. Modify},
  138. #define ADO_VARIABLE_LENGTH_ENTRY4(Ordinal, DataType, Buffer, Size, Modify)\
  139. {Ordinal, \
  140. DataType, \
  141. 0, \
  142. 0, \
  143. Size, \
  144. offsetof(ADORowClass, Buffer), \
  145. 0, \
  146. 0, \
  147. classoffset(CADORecordBinding, ADORowClass), \
  148. Modify},
  149. #define END_ADO_BINDING() {0, adEmpty, 0, 0, 0, 0, 0, 0, 0, FALSE}};\
  150. return rgADOBindingEntries;}
  151. //
  152. // Interface that the client 'record' class needs to support. The ADO Binding entries
  153. // provide the implementation for this interface.
  154. //
  155. class CADORecordBinding
  156. {
  157. public:
  158. STDMETHOD_(const ADO_BINDING_ENTRY*, GetADOBindingEntries) (VOID) PURE;
  159. };
  160. //
  161. // Interface that allows a client to fetch a record of data into class data members.
  162. //
  163. struct __declspec(uuid("00000544-0000-0010-8000-00aa006d2ea4")) IADORecordBinding;
  164. DECLARE_INTERFACE_(IADORecordBinding, IUnknown)
  165. {
  166. public:
  167. STDMETHOD(BindToRecordset) (CADORecordBinding *pAdoRecordBinding) PURE;
  168. STDMETHOD(AddNew) (CADORecordBinding *pAdoRecordBinding) PURE;
  169. STDMETHOD(Update) (CADORecordBinding *pAdoRecordBinding) PURE;
  170. };
  171. #endif // !_ICRSINT_H_