home *** CD-ROM | disk | FTP | other *** search
- #ifndef __EXTSRC_H
- #define __EXTSRC_H
-
- #include <windows.h>
- #include <stdio.h>
-
- #ifdef _MSC_VER
- # define _export __declspec(dllexport)
- #endif
-
- #ifdef _MSC_VER
- # define _import __declspec(dllexport)
- #endif
-
- // These two defines make this include file usable from both .c and .cpp files.
- #ifdef __cplusplus
- #define CPPEXTTAG extern "C"
- #define CSTRUCT
- #else
- #define CPPEXTTAG
- #define CSTRUCT struct
- #endif
-
- #define EXT_SRC_SUCCESS 0
- #define EXT_SRC_ERROR -1
- #define EXT_SRC_NODATA -2
-
- //
- // A pointer to TExtParamBlock is passed to every function
- // allowing the function to identify the data source.
- // UserData may be used to point to DLL specific data.
- // If used this way, the block should be deallocated at
- // the time of ExtSrcDisconnect call, otherwise it will be
- // lost.
- //
- struct TExtParamBlock {
- DWORD ThreadId; // the id of the calling thread (Tango thread)
- DWORD CurrRow; // Currently processed row
- DWORD CurrColumn; // Currently processed column
- VOID *UserData; // User dependent data
- VOID *Reserved; // Must not be used
- };
-
- //
- // The function is called when the external data source is
- // connected. User data of TExtParamBlock structure can be
- // initialized at this point.
- //
- // Returns: EXT_SRC_SUCCESS - if connection is successful
- // EXT_SRC_ERROR - otherwise
- //
- CPPEXTTAG int _export ExtSrcConnect(CSTRUCT TExtParamBlock *param_block);
-
- //
- // The function is called when the data source is disconnected, This
- // is the point when user data of the parameter block has to
- // be deallocated.
- //
- // Returns: EXT_SRC_SUCCESS - if disconnection is successful
- // EXT_SRC_ERROR - otherwise
- //
- CPPEXTTAG int _export ExtSrcDisconnect(CSTRUCT TExtParamBlock *param_block);
-
- //
- // Called when the next row
- //
- // Returns: EXT_SRC_SUCCESS - if next row is successfully retrieved
- // EXT_SRC_ERROR - if error occurs
- // EXT_SRC_NODATA - if there is no more rows available
- //
- CPPEXTTAG int _export ExtSrcFetchNextRow(CSTRUCT TExtParamBlock *param_block);
-
- //
- // The function should copy column data to the provided buffer. If
- // actlen parameter is provided, then actual length value should
- // written there.
- //
- // Returns: EXT_SRC_SUCCESS - if next row is successfully retrieved
- // EXT_SRC_ERROR - if error occurs
- //
- CPPEXTTAG int _export ExtSrcGetNextColumn(CSTRUCT TExtParamBlock *param_block, UCHAR *buffer, DWORD blen, DWORD *actlen);
-
- //
- // This function has to be declared based on the number of parameters
- // of an Apple Event action of the query document. In case of three
- // parameters the prototype would look as:
- //
- // CPPEXTTAG int _export ExtSrcExecuteQuery(CSTRUCT TExtParamBlock *param_block, char *p1, char *p2, char *p3);
- //
- // Returns: EXT_SRC_ERROR - in case of an error or
- //
- // if query execution went without errors, the function
- // must return the number of columns in the result set.
- //
- //
-
-
- #endif // __EXTSRC_H
-