simpdata.idl 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. //-----------------------------------------------------------------------------
  2. // File: simpledata.idl
  3. //
  4. // Copyright: Copyright (c) Microsoft Corporation
  5. //
  6. // Contents: OLEDBSimpleProvider interface
  7. //
  8. // Comments:
  9. //
  10. //-----------------------------------------------------------------------------
  11. cpp_quote("//=--------------------------------------------------------------------------=")
  12. cpp_quote("// simpdata.h")
  13. cpp_quote("//=--------------------------------------------------------------------------=")
  14. cpp_quote("// (C) Copyright 1995-1996 Microsoft Corporation. All Rights Reserved.")
  15. cpp_quote("//")
  16. cpp_quote("// THIS CODE AND INFORMATION IS PROVIDED \"AS IS\" WITHOUT WARRANTY OF")
  17. cpp_quote("// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO")
  18. cpp_quote("// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A")
  19. cpp_quote("// PARTICULAR PURPOSE.")
  20. cpp_quote("//=--------------------------------------------------------------------------=")
  21. cpp_quote("")
  22. cpp_quote("#pragma comment(lib,\"uuid.lib\")")
  23. cpp_quote("")
  24. cpp_quote("//--------------------------------------------------------------------------")
  25. cpp_quote("// OLE DB Simple Provider Toolkit")
  26. cpp_quote("")
  27. cpp_quote("#ifndef SIMPDATA_H")
  28. cpp_quote("#define SIMPDATA_H")
  29. import "oaidl.idl";
  30. cpp_quote("")
  31. cpp_quote("#ifdef _WIN64")
  32. cpp_quote("")
  33. cpp_quote("typedef LONGLONG DBROWCOUNT;")
  34. cpp_quote("typedef LONGLONG DB_LORDINAL;")
  35. cpp_quote("")
  36. cpp_quote("#else")
  37. cpp_quote("")
  38. typedef LONG DBROWCOUNT;
  39. typedef LONG DB_LORDINAL;
  40. cpp_quote("#endif // _WIN64")
  41. // We use signed integers for row and column numbers, starting with the value 1.
  42. // The value 0 refers to any "label" or "header" information, distinct from the
  43. // data. The value -1 refers to any an unknown value, or all values, so, for
  44. // example, iRow = -1, iCol = 2 refers to all of column 2
  45. cpp_quote("#define OSP_IndexLabel (0)")
  46. cpp_quote("#define OSP_IndexAll (~0)")
  47. cpp_quote("#define OSP_IndexUnknown (~0)")
  48. cpp_quote("")
  49. [
  50. uuid(E0E270C2-C0BE-11d0-8FE4-00A0C90A6341),
  51. helpstring("Microsoft OLE DB Simple Provider 1.5 Library"),
  52. lcid(0x409),
  53. version(1.5)
  54. ]
  55. library MSDAOSP
  56. {
  57. //=--------------------------------------------------------------------------=
  58. // Standard imports
  59. //=--------------------------------------------------------------------------=
  60. importlib("STDOLE2.TLB");
  61. typedef enum OSPFORMAT
  62. {
  63. OSPFORMAT_RAW = 0, // set/get variant as is
  64. OSPFORMAT_DEFAULT = 0, // default is RAW
  65. OSPFORMAT_FORMATTED = 1, // all variants converted to string representation
  66. OSPFORMAT_HTML = 2 // variant converted to HTML string representation
  67. // (providers not required to implement this).
  68. } OSPFORMAT;
  69. typedef enum OSPRW
  70. {
  71. // All cells are presumed to be readable.
  72. OSPRW_DEFAULT = 1,
  73. OSPRW_READONLY = 0, // readonly
  74. OSPRW_READWRITE = 1, // readwrite
  75. OSPRW_MIXED = 2 // mixed or unknown; most callers will treat
  76. // as READWRITE "Lazy" provider should just
  77. // return OSPRW_MIXED
  78. } OSPRW;
  79. typedef enum OSPFIND
  80. {
  81. OSPFIND_DEFAULT = 0,
  82. OSPFIND_UP = 1, // scan backwards(decreasing row #s)
  83. OSPFIND_CASESENSITIVE = 2,
  84. OSPFIND_UPCASESENSITIVE = 3 // combine 1 and 2
  85. } OSPFIND;
  86. typedef enum OSPCOMP
  87. {
  88. // These values derived from bitmasks
  89. // i.e. GT LT EQ
  90. OSPCOMP_EQ = 1, // OSPCOMP_EQ 1 Equal
  91. OSPCOMP_DEFAULT = 1, // OSPCOMP_EQ is the default
  92. OSPCOMP_LT = 2, // OSPCOMP_LT 1 0 Less than
  93. OSPCOMP_LE = 3, // OSPCOMP_LE 1 1 Less than or equal
  94. OSPCOMP_GE = 4, // OSPCOMP_GT 1 0 0 Greater than or equal
  95. OSPCOMP_GT = 5, // OSPCOMP_GE 1 0 1 Greater than
  96. OSPCOMP_NE = 6, // OSPCOMP_NE 1 1 0 Not equal
  97. } OSPCOMP;
  98. typedef enum OSPXFER
  99. {
  100. OSPXFER_COMPLETE = 0,
  101. OSPXFER_ABORT = 1,
  102. OSPXFER_ERROR = 2
  103. } OSPXFER;
  104. [
  105. object,
  106. uuid(E0E270C1-C0BE-11d0-8FE4-00A0C90A6341),
  107. pointer_default(unique),
  108. oleautomation,
  109. version(1.4)
  110. ]
  111. interface OLEDBSimpleProviderListener : IUnknown
  112. {
  113. // As noted above; a -1 (STD_IndexAll) can be used in the row or column
  114. // (or both). For example, CellChanged(STD_IndexAll, OSP_IndexAll)
  115. // implies that all rows and columns changed shape.
  116. HRESULT aboutToChangeCell([in] DBROWCOUNT iRow, [in] DB_LORDINAL iColumn);
  117. HRESULT cellChanged([in] DBROWCOUNT iRow, [in] DB_LORDINAL iColumn);
  118. HRESULT aboutToDeleteRows([in] DBROWCOUNT iRow, [in] DBROWCOUNT cRows);
  119. HRESULT deletedRows([in] DBROWCOUNT iRow, [in] DBROWCOUNT cRows);
  120. HRESULT aboutToInsertRows([in] DBROWCOUNT iRow, [in] DBROWCOUNT cRows);
  121. HRESULT insertedRows([in] DBROWCOUNT iRow, [in] DBROWCOUNT cRows);
  122. HRESULT rowsAvailable([in] DBROWCOUNT iRow, [in] DBROWCOUNT cRows);
  123. HRESULT transferComplete([in] OSPXFER xfer);
  124. }
  125. [
  126. object,
  127. uuid(E0E270C0-C0BE-11d0-8FE4-00A0C90A6341),
  128. pointer_default(unique),
  129. oleautomation,
  130. version(1.4)
  131. ]
  132. interface OLEDBSimpleProvider : IUnknown
  133. {
  134. // Info-retrieving functions:
  135. // ==========================
  136. //
  137. // Note that column names are retrieved using GetString or GetVariant
  138. // with iRow == OSP_IndexLabel. RWStatus for a whole row or column
  139. // can be made with iRow or iColumn == OSP_IndexAll.
  140. HRESULT getRowCount([out,retval] DBROWCOUNT *pcRows);
  141. HRESULT getColumnCount([out,retval] DB_LORDINAL *pcColumns);
  142. HRESULT getRWStatus([in] DBROWCOUNT iRow, [in] DB_LORDINAL iColumn,
  143. [out, retval] OSPRW *prwStatus);
  144. // Variant-oriented Get/Set:
  145. // =========================
  146. //
  147. // Note that use of VARIANT precludes references.
  148. HRESULT getVariant([in] DBROWCOUNT iRow, [in] DB_LORDINAL iColumn,
  149. [in] OSPFORMAT format, [out, retval] VARIANT *pVar );
  150. HRESULT setVariant([in] DBROWCOUNT iRow, [in] DB_LORDINAL iColumn,
  151. [in] OSPFORMAT format, [in] VARIANT Var );
  152. // Locale information:
  153. // ===================
  154. //
  155. HRESULT getLocale([out,retval] BSTR *pbstrLocale);
  156. // Deletion and Insertion:
  157. // =======================
  158. //
  159. // For insertion, iRow or iColumn is index *before* which to insert; the
  160. // first inserted row or column will end up with that index.
  161. //
  162. // In case of error, provider may choose to insert or delete only the
  163. // first m of n rows or columns which client requested. OUT parameter
  164. // indicates how many rows or columns actually inserted or deleted. In
  165. // case of success, OUT parameter should be filled in with cRows.
  166. HRESULT deleteRows([in] DBROWCOUNT iRow, [in] DBROWCOUNT cRows,
  167. [out, retval] DBROWCOUNT *pcRowsDeleted );
  168. HRESULT insertRows([in] DBROWCOUNT iRow, [in] DBROWCOUNT cRows,
  169. [out, retval] DBROWCOUNT *pcRowsInserted );
  170. // Find
  171. // Find the first row in column iColumn that contains a value which
  172. // matches val according to the compType.
  173. // To continue searching past the found row, the caller should pass
  174. // *piRowFound+1 as the next iRowStart, or *piRowFound-1 for backward
  175. // searches (STDFIND_UP).
  176. HRESULT find([in] DBROWCOUNT iRowStart, [in] DB_LORDINAL iColumn,
  177. [in] VARIANT val,
  178. [in] OSPFIND findFlags,
  179. [in] OSPCOMP compType,
  180. [out, retval] DBROWCOUNT *piRowFound );
  181. // Establish or detach single event sink.
  182. HRESULT addOLEDBSimpleProviderListener([in] OLEDBSimpleProviderListener *pospIListener);
  183. HRESULT removeOLEDBSimpleProviderListener([in] OLEDBSimpleProviderListener *pospIListener);
  184. // Asynch support
  185. HRESULT isAsync([out, retval] bool *pbAsynch);
  186. HRESULT getEstimatedRows([out, retval] DBROWCOUNT *piRows);
  187. // Stops any asynchronous download that may be in progress.
  188. HRESULT stopTransfer();
  189. }
  190. cpp_quote("typedef OLEDBSimpleProvider *LPOLEDBSimpleProvider;")
  191. }
  192. cpp_quote("#endif")