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

  1. // MFCPDocFast.cpp : implementation file
  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. #include "stdafx.h"
  9. #include "MFCPerf.h"
  10.  
  11. #include "MFCPCust.h"
  12. #include "DocFast.h"
  13.  
  14. #ifdef _DEBUG
  15. #define new DEBUG_NEW
  16. #undef THIS_FILE
  17. static char THIS_FILE[] = __FILE__;
  18. #endif
  19.  
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CMFCPDocFast
  22. IMPLEMENT_DYNCREATE(CMFCPDocFast, CDocument)
  23. BEGIN_MESSAGE_MAP(CMFCPDocFast, CDocument)
  24.     //{{AFX_MSG_MAP(CMFCPDocFast)
  25.     //}}AFX_MSG_MAP
  26. END_MESSAGE_MAP()
  27.  
  28. CMFCPDocFast::CMFCPDocFast()
  29.     {
  30.     m_pMFCPCust = NULL;
  31.     }
  32.  
  33. BOOL CMFCPDocFast::OnNewDocument()
  34.     {
  35.     if (!CDocument::OnNewDocument())
  36.         return FALSE;
  37.  
  38.     if (m_pMFCPCust == NULL)
  39.         {
  40.         m_pMFCPCust = new CMFCPCust(&m_Database);
  41.         CString strConnect = m_pMFCPCust->GetDefaultConnect();
  42.  
  43.         try
  44.             {
  45.             m_Database.Open(NULL, FALSE, FALSE, strConnect, FALSE);
  46.  
  47.             if (!m_Database.IsOpen())
  48.                 {
  49.                 return (FALSE);
  50.                 }
  51.             }
  52.         catch (CException* e)
  53.             {
  54.             e->Delete();
  55.             return (FALSE);
  56.             }
  57.         }
  58.     
  59.     return TRUE;
  60.     }
  61.  
  62. CMFCPDocFast::~CMFCPDocFast()
  63.     {
  64.     if (m_pMFCPCust != NULL)
  65.         {
  66.         delete m_pMFCPCust;
  67.         }
  68.     }
  69.  
  70. /////////////////////////////////////////////////////////////////////////////
  71. // CMFCPDocFast diagnostics
  72. #ifdef _DEBUG
  73. void CMFCPDocFast::AssertValid() const
  74.     {
  75.     CDocument::AssertValid();
  76.     }
  77.  
  78. void CMFCPDocFast::Dump(CDumpContext& dc) const
  79.     {
  80.     CDocument::Dump(dc);
  81.     }
  82. #endif //_DEBUG
  83.  
  84. /////////////////////////////////////////////////////////////////////////////
  85. // CMFCPDocFast commands
  86.