//--------------------------------------------------------------------
// Microsoft OLE DB ISAPI Sample
// Copyight(c) 1996 Microsoft Corporation. All Rights Reserved.
//
// @doc
//
// @module DOCLIENT.H | Headers for DOCLIENT.CPP
//
// @rev 1 | 06-11-96 | Created
//
#include <afxisapi.h>
//Constants
#define MAXBUFLEN256//display buffer size
#define MAXDATALEN25//maximum data length per column
#define NUMROWS_CHUNK20 // Number of Rows to Grab at a Time
#define DEFAULT_CBMAXLENGTH40 // cbMaxLength for binding
#define COLUMN_ALIGNVAL8
#define MAX_ROW_SIZE1000
#define NUMBER_OF_PROPERTY_SETS1
#define ROUND_UP( Size, Amount ) (((DWORD)(Size) + ((Amount) - 1)) & ~((Amount) - 1))
//Data Structures ****************************************************************
struct COLUMNDATA
{
DWORDdwLength;// length of data (not space allocated)
DBSTATUSwStatus;// status of column
SHORT wReserved; // padding
BYTEbData[1];// data here and beyond
};
//Exposed Functions ****************************************************************
HRESULT GetAndWrite
(
IRowset*pIRowset,
ULONG cMaxRowSize,
HACCESSOR hAccessor,
DBBINDING*rgBind,
ULONGcBind,
DBCOLUMNINFO*pColumnInfo,
ULONGcCol,
CHttpServerContext* pCtxt
);
HRESULT ConnectDB
(
IDBCreateCommand **ppIDBCreateCommand_out, //@param |
LPCSTR pstrDNS, //@param | Login Inforamtion
LPCSTR pstrUserName, //@param | Login Inforamtion
LPCSTR pstrPassword, //@param | Login Inforamtion
CHttpServerContext* pCtxt //@param|
);
HRESULT SetAndExecute
(
WCHAR * wszSQLCommand, //@param IN | SQL command
IDBCreateCommand * pIDBCreateCommand, //@param IN |
IRowset** ppIRowset_out, //@param OUT | Pointer to set of rows
DBCOLUMNINFO ** ppColumnInfo_out, //@param OUT | array of DBCOLUMNINFO structures
WCHAR ** ppStringBuffer_out,
ULONG * pcCol, //@param OUT | Number of columns
DBBINDING ** rgBind, //@param
ULONG * pcBind, //@param
HACCESSOR * phAccessor, //@param
ULONG * pcbMaxRowSize, //@param
CHttpServerContext* pCtxt //@param IN | Server Context
);
void FreeEnvironment
(
IRowset*pIRowset, //@param IN | Pointer to set of rows
HACCESSOR hAccessor, //@param IN | Accessor Handle
DBCOLUMNINFO*pColumnInfo, //@param IN | DBCOLUMNINFO array pointer
WCHAR * pStringBuffer //@param IN | String Buffer contining the info about columns
);
//Internal functions ************************************************************
void PrintErrorInfo
(
IUnknown * pBadObject, //@param IN | Pointer to the object where error happened
REFIID IID_BadIntereface, //@param IN | Interface that caused the error
CHttpServerContext* pCtxt//@param IN | Output place
);
HRESULT SetInitializationData
(
LPCSTR pstrDNS,//@param IN | DNS Name
LPCSTR pstrUserName,//@param IN | User Name
LPCSTR pstrPassword,//@param IN | Passwd
DBPROPSET rgPropertySet[],//@param OUT | Array of propery sets (only one)
CHttpServerContext* pCtxt//@param IN | Web page context
);
HRESULT SetupBindings
(
ULONG cCol,
DBCOLUMNINFO*pColumnInfo,
DBBINDING*rgBind_out,
ULONG*pcBind_out,
ULONG*pcMaxRowSize_out
);
HRESULT CleanupRowset
(
IRowset*pIRowset,
HACCESSOR hAccessor
);
void DumpRow
(
DBBINDING* rgBind,
ULONGcBind,
BYTE* pData,
CHttpServerContext* pCtxt
);