home *** CD-ROM | disk | FTP | other *** search
/ Datatid 1999 #6 / Datatid_1999-06.iso / internet / Tango352Promo / Tango / data.z / ExtSrc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-03  |  2.9 KB  |  99 lines

  1. #ifndef __EXTSRC_H
  2. #define __EXTSRC_H
  3.  
  4. #include <windows.h>
  5. #include <stdio.h>
  6.  
  7. #ifdef _MSC_VER
  8. #  define _export __declspec(dllexport)
  9. #endif
  10.  
  11. #ifdef _MSC_VER
  12. #  define _import __declspec(dllexport)
  13. #endif
  14.  
  15. // These two defines make this include file usable from both .c and .cpp files.
  16. #ifdef __cplusplus
  17. #define CPPEXTTAG extern "C"
  18. #define CSTRUCT
  19. #else
  20. #define CPPEXTTAG
  21. #define CSTRUCT   struct
  22. #endif
  23.  
  24. #define EXT_SRC_SUCCESS     0 
  25. #define EXT_SRC_ERROR         -1
  26. #define EXT_SRC_NODATA         -2
  27.  
  28. //
  29. //    A pointer to TExtParamBlock is passed to every function 
  30. // allowing the function to identify the data source. 
  31. // UserData may be used to point to DLL specific data.
  32. // If used this way, the block should be deallocated at
  33. // the time of ExtSrcDisconnect call, otherwise it will be
  34. // lost.
  35. //
  36. struct TExtParamBlock {    
  37.     DWORD        ThreadId;        // the id of the calling thread (Tango thread)
  38.     DWORD        CurrRow;            // Currently processed row
  39.     DWORD        CurrColumn;        // Currently processed column
  40.     VOID        *UserData;        // User dependent data
  41.     VOID        *Reserved;        // Must not be used
  42. };
  43.  
  44. //
  45. //    The function is called when the external data source is 
  46. // connected. User data of TExtParamBlock structure can be
  47. // initialized at this point.
  48. //
  49. // Returns: EXT_SRC_SUCCESS - if connection is successful
  50. //                EXT_SRC_ERROR     - otherwise
  51. //
  52. CPPEXTTAG int _export ExtSrcConnect(CSTRUCT TExtParamBlock *param_block);
  53.  
  54. //
  55. //    The function is called when the data source is disconnected, This
  56. // is the point when user data of the parameter block has to
  57. // be deallocated.
  58. //
  59. // Returns: EXT_SRC_SUCCESS - if disconnection is successful
  60. //                EXT_SRC_ERROR     - otherwise
  61. //
  62. CPPEXTTAG int _export ExtSrcDisconnect(CSTRUCT TExtParamBlock *param_block);
  63.  
  64. //
  65. // Called when the next row
  66. //
  67. // Returns: EXT_SRC_SUCCESS - if next row is successfully retrieved
  68. //                EXT_SRC_ERROR     - if error occurs
  69. //                EXT_SRC_NODATA     -    if there is no more rows available
  70. //
  71. CPPEXTTAG int _export ExtSrcFetchNextRow(CSTRUCT TExtParamBlock *param_block);
  72.  
  73. //
  74. //    The function should copy column data to the provided buffer. If
  75. // actlen parameter is provided, then actual length value should
  76. // written there.
  77. //
  78. // Returns: EXT_SRC_SUCCESS - if next row is successfully retrieved
  79. //                EXT_SRC_ERROR     - if error occurs
  80. //
  81. CPPEXTTAG int _export ExtSrcGetNextColumn(CSTRUCT TExtParamBlock *param_block, UCHAR *buffer, DWORD blen, DWORD *actlen);
  82.  
  83. //
  84. //    This function has to be declared based on the number of parameters
  85. // of an Apple Event action of the query document. In case of three
  86. // parameters the prototype would look as:
  87. //
  88. // CPPEXTTAG int _export ExtSrcExecuteQuery(CSTRUCT TExtParamBlock *param_block, char *p1, char *p2, char *p3);
  89. //
  90. // Returns:         EXT_SRC_ERROR - in case of an error or
  91. //
  92. //                    if query execution went without errors, the function
  93. //                    must return the number of columns in the result set.
  94. //
  95. //
  96.  
  97.  
  98. #endif // __EXTSRC_H
  99.