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.

62 lines
1.3 KiB

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