forked from sabrogden/Ditto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTypesTable.cpp
89 lines (72 loc) · 1.68 KB
/
TypesTable.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// TypesTable.cpp : implementation file
//
#include "stdafx.h"
#include "cp_main.h"
#include "TypesTable.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTypesTable
IMPLEMENT_DYNAMIC(CTypesTable, CDaoRecordset)
CTypesTable::CTypesTable(CDaoDatabase* pdb)
: CDaoRecordset(pdb)
{
//{{AFX_FIELD_INIT(CTypesTable)
m_ID = 0;
m_TypeText = _T("");
m_nFields = 2;
//}}AFX_FIELD_INIT
m_nDefaultType = dbOpenDynaset;
}
CString CTypesTable::GetDefaultDBName()
{
return _T("C:\\Projects\\Ditto\\CP_Shared\\Release_DLL\\97.mdb");
}
CString CTypesTable::GetDefaultSQL()
{
return _T("[Types]");
}
void CTypesTable::DoFieldExchange(CDaoFieldExchange* pFX)
{
//{{AFX_FIELD_MAP(CTypesTable)
pFX->SetFieldType(CDaoFieldExchange::outputColumn);
DFX_Long(pFX, _T("[ID]"), m_ID);
DFX_Text(pFX, _T("[TypeText]"), m_TypeText);
//}}AFX_FIELD_MAP
}
/////////////////////////////////////////////////////////////////////////////
// CTypesTable diagnostics
#ifdef _DEBUG
void CTypesTable::AssertValid() const
{
CDaoRecordset::AssertValid();
}
void CTypesTable::Dump(CDumpContext& dc) const
{
CDaoRecordset::Dump(dc);
}
#endif //_DEBUG
BOOL CTypesTable::DeleteAll()
{
BOOL bRet = FALSE;
try
{
theApp.EnsureOpenDB();
theApp.m_pDatabase->Execute("DELETE * FROM Types", dbFailOnError);
bRet = TRUE;
}
catch(CDaoException* e)
{
AfxMessageBox(e->m_pErrorInfo->m_strDescription);
e->Delete();
}
return bRet;
}
void CTypesTable::Open(int nOpenType, LPCTSTR lpszSql, int nOptions)
{
m_pDatabase = theApp.EnsureOpenDB();
CDaoRecordset::Open(nOpenType, lpszSql, nOptions);
}