Leaked source code of windows server 2003
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.

64 lines
1.4 KiB

  1. // ADM_setAdminAccount.h : Declaration of the ADM_setAdminAccount class
  2. #ifndef __ADM_SETADMINACCOUNT_H_
  3. #define __ADM_SETADMINACCOUNT_H_
  4. class ADM_setAdminAccountAccessor
  5. {
  6. public:
  7. LONG m_RETURNVALUE;
  8. TCHAR m_accountName[129];
  9. CComBSTR m_connectionString;
  10. BEGIN_PARAM_MAP(ADM_setAdminAccountAccessor)
  11. SET_PARAM_TYPE(DBPARAMIO_OUTPUT)
  12. COLUMN_ENTRY(1, m_RETURNVALUE)
  13. SET_PARAM_TYPE(DBPARAMIO_INPUT)
  14. COLUMN_ENTRY(2, m_accountName)
  15. END_PARAM_MAP()
  16. DEFINE_COMMAND(ADM_setAdminAccountAccessor, _T("{ ? = CALL dbo.ADM_setAdminAccount;1 (?) }"))
  17. // You may wish to call this function if you are inserting a record and wish to
  18. // initialize all the fields, if you are not going to explicitly set all of them.
  19. void ClearRecord()
  20. {
  21. memset(this, 0, sizeof(*this));
  22. }
  23. };
  24. class ADM_setAdminAccount : public CCommand<CAccessor<ADM_setAdminAccountAccessor> >
  25. {
  26. public:
  27. HRESULT Open()
  28. {
  29. HRESULT hr;
  30. hr = OpenDataSource();
  31. if( FAILED(hr) )
  32. return hr;
  33. return OpenRowset();
  34. }
  35. HRESULT OpenDataSource()
  36. {
  37. HRESULT hr;
  38. CDataSource db;
  39. hr = db.OpenFromInitializationString( m_connectionString );
  40. if( FAILED(hr) )
  41. return hr;
  42. return m_session.Open(db);
  43. }
  44. HRESULT OpenRowset()
  45. {
  46. return CCommand<CAccessor<ADM_setAdminAccountAccessor> >::Open(m_session);
  47. }
  48. CSession m_session;
  49. };
  50. #endif // __ADM_SETADMINACCOUNT_H_