dbvar.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10. #include "stdafx.h"
  11. #ifdef AFX_DB_SEG
  12. #pragma code_seg(AFX_DB_SEG)
  13. #endif
  14. #ifdef _DEBUG
  15. #undef THIS_FILE
  16. static char THIS_FILE[] = __FILE__;
  17. #endif
  18. #define new DEBUG_NEW
  19. //////////////////////////////////////////////////////////////////////////////
  20. // Implementation of CDBVariant
  21. CDBVariant::CDBVariant()
  22. {
  23. // Initialize type and value
  24. m_dwType = DBVT_NULL;
  25. }
  26. void CDBVariant::Clear()
  27. {
  28. if (m_dwType == DBVT_STRING)
  29. delete (CString*)m_pstring;
  30. else if (m_dwType == DBVT_BINARY)
  31. delete (CLongBinary*)m_pbinary;
  32. else if (m_dwType == DBVT_DATE)
  33. delete (TIMESTAMP_STRUCT*)m_pdate;
  34. m_dwType = DBVT_NULL;
  35. }
  36. CDBVariant::~CDBVariant()
  37. {
  38. Clear();
  39. }
  40. //////////////////////////////////////////////////////////////////////////////
  41. #ifdef AFX_INIT_SEG
  42. #pragma code_seg(AFX_INIT_SEG)
  43. #endif
  44. /////////////////////////////////////////////////////////////////////////////