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.

177 lines
3.7 KiB

  1. /******************************************************************************
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. Column.cpp
  5. Abstract:
  6. This file contains the implementation of the JetBlueCOM::Column class.
  7. Revision History:
  8. Davide Massarenti (Dmassare) 05/20/2000
  9. created
  10. ******************************************************************************/
  11. #include <stdafx.h>
  12. #ifndef NOJETBLUECOM
  13. ////////////////////////////////////////////////////////////////////////////////
  14. JetBlueCOM::Column::Column()
  15. {
  16. m_col = NULL; // JetBlue::Column* m_col;
  17. }
  18. JetBlueCOM::Column::~Column()
  19. {
  20. Passivate();
  21. }
  22. ////////////////////////////////////////
  23. HRESULT JetBlueCOM::Column::Initialize( /*[in]*/ JetBlue::Column& col )
  24. {
  25. m_col = &col;
  26. return S_OK;
  27. }
  28. void JetBlueCOM::Column::Passivate()
  29. {
  30. MPC::SmartLock<_ThreadModel> lock( this );
  31. m_col = NULL;
  32. }
  33. ////////////////////////////////////////
  34. STDMETHODIMP JetBlueCOM::Column::get_Name( /*[out, retval]*/ BSTR *pVal )
  35. {
  36. __HCP_FUNC_ENTRY( "JetBlueCOM::Column::get_Name" );
  37. USES_CONVERSION;
  38. HRESULT hr;
  39. MPC::SmartLock<_ThreadModel> lock( this );
  40. __MPC_PARAMCHECK_BEGIN(hr)
  41. __MPC_PARAMCHECK_POINTER_AND_SET(pVal,NULL);
  42. __MPC_PARAMCHECK_END();
  43. __MPC_JET_CHECKHANDLE(hr,m_col,NULL);
  44. {
  45. const MPC::string& str = *m_col;
  46. hr = MPC::GetBSTR( A2W( str.c_str() ), pVal );
  47. }
  48. __HCP_FUNC_CLEANUP;
  49. __HCP_FUNC_EXIT(hr);
  50. }
  51. STDMETHODIMP JetBlueCOM::Column::get_Type( /*[out, retval]*/ long *pVal )
  52. {
  53. __HCP_FUNC_ENTRY( "JetBlueCOM::Column::get_Type" );
  54. HRESULT hr;
  55. MPC::SmartLock<_ThreadModel> lock( this );
  56. __MPC_PARAMCHECK_BEGIN(hr)
  57. __MPC_PARAMCHECK_POINTER_AND_SET(pVal,NULL);
  58. __MPC_PARAMCHECK_END();
  59. __MPC_JET_CHECKHANDLE(hr,m_col,NULL);
  60. {
  61. const JET_COLUMNDEF& coldef = *m_col;
  62. *pVal = coldef.coltyp;
  63. }
  64. hr = S_OK;
  65. __HCP_FUNC_CLEANUP;
  66. __HCP_FUNC_EXIT(hr);
  67. }
  68. STDMETHODIMP JetBlueCOM::Column::get_Bits( /*[out, retval]*/ long *pVal )
  69. {
  70. __HCP_FUNC_ENTRY( "JetBlueCOM::Column::get_Bits" );
  71. HRESULT hr;
  72. MPC::SmartLock<_ThreadModel> lock( this );
  73. __MPC_PARAMCHECK_BEGIN(hr)
  74. __MPC_PARAMCHECK_POINTER_AND_SET(pVal,NULL);
  75. __MPC_PARAMCHECK_END();
  76. __MPC_JET_CHECKHANDLE(hr,m_col,NULL);
  77. {
  78. const JET_COLUMNDEF& coldef = *m_col;
  79. *pVal = coldef.grbit;
  80. }
  81. hr = S_OK;
  82. __HCP_FUNC_CLEANUP;
  83. __HCP_FUNC_EXIT(hr);
  84. }
  85. STDMETHODIMP JetBlueCOM::Column::get_Value( /*[out, retval]*/ VARIANT *pVal )
  86. {
  87. __HCP_FUNC_ENTRY( "JetBlueCOM::Column::get_Value" );
  88. HRESULT hr;
  89. CComVariant vValue;
  90. MPC::SmartLock<_ThreadModel> lock( this );
  91. __MPC_PARAMCHECK_BEGIN(hr)
  92. __MPC_PARAMCHECK_NOTNULL(pVal);
  93. __MPC_PARAMCHECK_END();
  94. __MPC_JET_CHECKHANDLE(hr,m_col,NULL);
  95. __MPC_EXIT_IF_METHOD_FAILS(hr, m_col->Get( vValue ));
  96. hr = vValue.Detach( pVal );
  97. __HCP_FUNC_CLEANUP;
  98. __HCP_FUNC_EXIT(hr);
  99. }
  100. STDMETHODIMP JetBlueCOM::Column::put_Value( /*[in]*/ VARIANT newVal )
  101. {
  102. __HCP_FUNC_ENTRY( "JetBlueCOM::Column::put_Value" );
  103. HRESULT hr;
  104. CComVariant vValue;
  105. MPC::SmartLock<_ThreadModel> lock( this );
  106. __MPC_JET_CHECKHANDLE(hr,m_col,NULL);
  107. __MPC_EXIT_IF_METHOD_FAILS(hr, vValue.Attach( &newVal ));
  108. hr = m_col->Put( vValue );
  109. __HCP_FUNC_CLEANUP;
  110. __HCP_FUNC_EXIT(hr);
  111. }
  112. #endif