home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 32 / IOPROG_32.ISO / SOFT / SqlEval7 / devtools / samples / ODBC / mfcperf / docslow.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-20  |  2.3 KB  |  92 lines

  1. // MFCPDocSlow.cpp : implementation of the CMFCPDocSlow class
  2. //
  3. // This file is part of Microsoft SQL Server online documentation.
  4. // Copyright (C) 1992-1997 Microsoft Corporation. All rights reserved.
  5. //
  6. // This source code is an intended supplement to the Microsoft SQL
  7. // Server online references and related electronic documentation.
  8.  
  9. #include "stdafx.h"
  10. #include "MFCPerf.h"
  11.  
  12. #include "MFCPCust.h"
  13. #include "DocSlow.h"
  14.  
  15. #ifdef _DEBUG
  16. #define new DEBUG_NEW
  17. #undef THIS_FILE
  18. static char THIS_FILE[] = __FILE__;
  19. #endif
  20.  
  21. /////////////////////////////////////////////////////////////////////////////
  22. // CMFCPDocSlow
  23. IMPLEMENT_DYNCREATE(CMFCPDocSlow, CDocument)
  24.  
  25. BEGIN_MESSAGE_MAP(CMFCPDocSlow, CDocument)
  26.     //{{AFX_MSG_MAP(CMFCPDocSlow)
  27.         // NOTE - the ClassWizard will add and remove mapping macros here.
  28.         //    DO NOT EDIT what you see in these blocks of generated code!
  29.     //}}AFX_MSG_MAP
  30. END_MESSAGE_MAP()
  31.  
  32. /////////////////////////////////////////////////////////////////////////////
  33. // CMFCPDocSlow construction/destruction
  34. CMFCPDocSlow::CMFCPDocSlow()
  35.     {
  36.     m_pMFCPCust = NULL;
  37.     }
  38.  
  39. CMFCPDocSlow::~CMFCPDocSlow()
  40.     {
  41.     if (m_pMFCPCust != NULL)
  42.         {
  43.         delete m_pMFCPCust;
  44.         }
  45.     }
  46.  
  47. BOOL CMFCPDocSlow::OnNewDocument()
  48.     {
  49.     if (!CDocument::OnNewDocument())
  50.         return FALSE;
  51.  
  52.     if (m_pMFCPCust == NULL)
  53.         {
  54.         m_pMFCPCust = new CMFCPCust(&m_Database);
  55.         CString strConnect = m_pMFCPCust->GetDefaultConnect();
  56.  
  57.         try
  58.             {
  59.             m_Database.Open(NULL, FALSE, FALSE, strConnect, FALSE);
  60.  
  61.             if (!m_Database.IsOpen())
  62.                 {
  63.                 return (FALSE);
  64.                 }
  65.             }
  66.         catch (CException* e)
  67.             {
  68.             e->Delete();
  69.             return (FALSE);
  70.             }
  71.         }
  72.  
  73.     return TRUE;
  74.     }
  75.  
  76. /////////////////////////////////////////////////////////////////////////////
  77. // CMFCPDocSlow diagnostics
  78. #ifdef _DEBUG
  79. void CMFCPDocSlow::AssertValid() const
  80.     {
  81.     CDocument::AssertValid();
  82.     }
  83.  
  84. void CMFCPDocSlow::Dump(CDumpContext& dc) const
  85.     {
  86.     CDocument::Dump(dc);
  87.     }
  88. #endif //_DEBUG
  89.  
  90. /////////////////////////////////////////////////////////////////////////////
  91. // CMFCPDocSlow commands
  92.