-
Notifications
You must be signed in to change notification settings - Fork 1
/
DatabaseExplorer.h
98 lines (81 loc) · 2.88 KB
/
DatabaseExplorer.h
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
90
91
92
93
94
95
96
97
98
// DatabaseExplorer.h : main header file for the DatabaseExplorer application
//
#pragma once
#ifndef __AFXWIN_H__
#error "include 'pch.h' before including this file for PCH"
#endif
#include "resource.h" // main symbols
#include "DatabaseExplorerDoc.h"
#include <vector>
#include <string>
#include <unordered_map>
#define WMU_SETMESSAGETEXT (WM_APP + 39)
#define WMU_CHILDFRAMEADDED (WM_APP + 40)
#define WMU_CHILDFRAMEREMOVED (WM_APP + 41)
#define WMU_CHILDFRAMEACTIVATE (WM_APP + 42)
#define WMU_CHILDFRAMEACTIVATED (WM_APP + 43)
#define WMU_ISPOPULATEMODE (WM_APP + 44)
#define WMU_RESTOREQUERIES (WM_APP + 45)
#define WMU_SETWORDWRAP (WM_APP + 46)
#define WMU_POSTINIT (WM_APP + 80)
#define TIME_ONEMINUTE (60 * 1000)
#define STR_DSNSOURCE _T("DSNSource")
#define STR_DATABASETYPE _T("DatabaseType")
#define STR_RSTYPE _T("RsType")
#define STR_MSSQLAUTHENTICATIONREQUIRED _T("MsSqlAuthenticationRequired")
// CDatabaseExplorerApp:
// See DatabaseExplorer.cpp for the implementation of this class
//
class CDatabaseExplorerApp : public CWinAppEx
{
public:
CDatabaseExplorerApp() noexcept;
enum UH_POPULATELIST
{
UH_INITDATABASE = 1,
UH_SELECTDATABASE,
UH_POPULATEDATABASEPANEL,
UH_RUNSQLSATEMENTS,
UH_LISTTABLE
};
public:
BOOL m_bWordWrap{ FALSE };
BOOL m_bHiColorIcons{ TRUE };
BOOL m_bVirtualMode{ FALSE };
UINT m_nAppLook{ ID_VIEW_APPLOOK_OFF_2007_BLACK };
// Overrides
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
// Implementation
public:
virtual void PreLoadState();
virtual void LoadCustomState();
virtual void SaveCustomState();
CString GetAppPath() const;
CString GetAppPathTemp() const;
CString GetFileNameFrom(const CString& sPath) const;
void UpdateBackupFiles();
CString GetTitleNormalized(const CString& sTitle) const;
BOOL HasValidDocumentTitle(CString sTitle) const;
void DisconnectAllDatabases() const;
#ifdef _UNICODE
BOOL FileExist(const CString sFilePath) const { return (-1 != _waccess(sFilePath, 0)); }
#else
BOOL FileExist(const CString sFilePath) const { return (-1 != _access(sFilePath, 0)); }
#endif
private:
std::vector<std::wstring> GetBackupFiles() const;
void SaveQueries(const std::wstring& filename, std::vector<CString>&& queries) const;
std::unordered_map<std::wstring, SDocData> GetDocumentsData() const;
void RemoveOldBackup(const std::unordered_map<std::wstring, SDocData>& docdata);
void SaveNewBackup(std::unordered_map<std::wstring, SDocData>&& docdata);
void SaveDocsOrder(std::vector<CString>&& names) const;
std::vector<std::wstring> GetDocsOrder() const;
CString GetBackupPath() const { return GetAppPath() + _T("Backup\\"); }
// Generated message map functions
protected:
afx_msg void OnAppAbout();
DECLARE_MESSAGE_MAP()
};
extern CDatabaseExplorerApp theApp;