Source code of Windows XP (NT5)
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.

87 lines
2.5 KiB

  1. /********************************************************************
  2. Copyright (c) 1999-2000 Microsoft Corporation
  3. Module Name:
  4. pfdb.h
  5. Abstract:
  6. definition for the class that encapsulates all DB access
  7. Revision History:
  8. DerekM created 05/01/99
  9. DerekM modified 02/24/00
  10. DerekM modified 03/24/00
  11. ********************************************************************/
  12. #ifndef PFDB_H
  13. #define PFDB_H
  14. #include "util.h"
  15. #include "adoint.h"
  16. /////////////////////////////////////////////////////////////////////////////
  17. // constants
  18. const DWORD c_cInitialProps = 16;
  19. /////////////////////////////////////////////////////////////////////////////
  20. // CPFDB definition
  21. class CPFDB : private CPFGenericClassBase,
  22. public IUnknown
  23. {
  24. private:
  25. // meber data
  26. CommandTypeEnum m_cte;
  27. ADOConnection *m_pConn;
  28. ADOParameters *m_pParams;
  29. ADORecordset *m_pRS;
  30. ADOParameter **m_rgpParams;
  31. ADOCommand *m_pCmd;
  32. ADOFields *m_pFields;
  33. CComBSTR m_bstrCmd;
  34. CComBSTR m_bstrConn;
  35. DWORD m_cSlots;
  36. DWORD m_iLastSlot;
  37. DWORD m_cRef;
  38. BOOL m_fNeedReset;
  39. // internal methods
  40. HRESULT GetData(VARIANT &varField, VARIANT *pvarData);
  41. HRESULT GetOutParam(VARIANT &varParam, VARIANT *pvarData, VARTYPE vt);
  42. HRESULT TestConnAndRefresh(void);
  43. HRESULT AddParameterObj(DWORD iPos);
  44. void Cleanup(void);
  45. public:
  46. CPFDB(void);
  47. ~CPFDB(void);
  48. static CPFDB *CreateInstance(void) { return new CPFDB(); }
  49. STDMETHOD(QueryInterface)(REFIID, LPVOID *) { return E_NOTIMPL; }
  50. STDMETHOD_(ULONG, AddRef)(void);
  51. STDMETHOD_(ULONG, Release)(void);
  52. HRESULT Reset(void);
  53. HRESULT Init(LPCWSTR wszConn, DWORD dwTimeout = 300);
  54. HRESULT Init(ADOConnection *pConn, DWORD dwTimeout = 300,
  55. BSTR bstrConn = NULL);
  56. HRESULT Begin(LPCWSTR wszCmd, CommandTypeEnum cte = adCmdText);
  57. HRESULT AddInParam(VARIANT &varData, DataTypeEnum dtADO, DWORD iPos = -1);
  58. HRESULT AddOutParam(DataTypeEnum dtADO, DWORD iPos = -1,
  59. BOOL fSPRetVal = FALSE, DWORD cchSize = 0);
  60. HRESULT Execute(BOOL fWantRS = TRUE);
  61. HRESULT GetOutParam(BSTR bstrParam, VARIANT *pvarData, VARTYPE vt = VT_ILLEGAL);
  62. HRESULT GetOutParam(DWORD iParam, VARIANT *pvarData, VARTYPE vt = VT_ILLEGAL);
  63. HRESULT GetErrors(ADOErrors **ppErrs);
  64. HRESULT GetNextRow(void);
  65. HRESULT GetData(BSTR bstrField, VARIANT *pvarData);
  66. HRESULT GetData(DWORD iField, VARIANT *pvarData);
  67. };
  68. #endif