Debian Codegraph @

DatabaseExplorer/SqlCommandPanel.h

raw
1 //////////////////////////////////////////////////////////////////////////////
2 //////////////////////////////////////////////////////////////////////////////
3 //
4 // copyright : (C) 2014 Eran Ifrah
5 // file name : SqlCommandPanel.h
6 //
7 // -------------------------------------------------------------------------
8 // A
9 // _____ _ _ _ _
10 // / __ \ | | | | (_) |
11 // | / \/ ___ __| | ___| | _| |_ ___
12 // | | / _ \ / _ |/ _ \ | | | __/ _ )
13 // | \__/\ (_) | (_| | __/ |___| | || __/
14 // \____/\___/ \__,_|\___\_____/_|\__\___|
15 //
16 // F i l e
17 //
18 // This program is free software; you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation; either version 2 of the License, or
21 // (at your option) any later version.
22 //
23 //////////////////////////////////////////////////////////////////////////////
24 //////////////////////////////////////////////////////////////////////////////
25
26 #ifndef SQLCOMMANDPANEL_H
27 #define SQLCOMMANDPANEL_H
28
29 #include "GUI.h" // Base class: _SqlCommandPanel
30 #include "IDbAdapter.h"
31 #include "clEditorEditEventsHandler.h"
32 #include "clToolBar.h"
33
34 #include <map>
35 #include <wx/dblayer/include/DatabaseErrorCodes.h>
36 #include <wx/dblayer/include/DatabaseLayer.h>
37 #include <wx/dblayer/include/DatabaseLayerException.h>
38 #include <wx/wx.h>
39
40 // ----------------------------------------------------------------
41 class ColumnInfo
42 {
43 int m_type;
44 wxString m_name;
45
46 public:
47 typedef std::vector<ColumnInfo> Vector_t;
48
49 public:
50 ColumnInfo()
51 : m_type(0)
52 {
53 }
54
55 ColumnInfo(int type, const wxString& name)
56 : m_type(type)
57 , m_name(name)
58 {
59 }
60
61 virtual ~ColumnInfo() {}
62
63 void SetName(const wxString& name) { this->m_name = name; }
64 void SetType(int type) { this->m_type = type; }
65 const wxString& GetName() const { return m_name; }
66 int GetType() const { return m_type; }
67 };
68
69 // ----------------------------------------------------------------
70 class SQLCommandPanel : public _SqlCommandPanel
71 {
72
73 int m_OperatorStyle;
74 int m_CommentStyle;
75
76 protected:
77 virtual void OnHistoryToolClicked(wxAuiToolBarEvent& event);
78 IDbAdapter* m_pDbAdapter;
79 wxString m_dbName;
80 wxString m_dbTable;
81 wxString m_cellValue;
82 std::map<std::pair<int, int>, wxString> m_gridValues;
83 ColumnInfo::Vector_t m_colsMetaData;
84 clEditEventsHandler::Ptr_t m_editHelper;
85 clToolBarGeneric* m_toolbar;
86
87 protected:
88 bool IsBlobColumn(const wxString& str);
89 wxArrayString ParseSql() const;
90 void SaveSqlHistory(wxArrayString sqls);
91
92 public:
93 SQLCommandPanel(wxWindow* parent, IDbAdapter* dbAdapter, const wxString& dbName, const wxString& dbTable);
94 virtual ~SQLCommandPanel();
95 virtual void OnExecuteClick(wxCommandEvent& event);
96 virtual void OnScintilaKeyDown(wxKeyEvent& event);
97
98 virtual void OnLoadClick(wxCommandEvent& event);
99 virtual void OnSaveClick(wxCommandEvent& event);
100 virtual void OnTeplatesLeftDown(wxMouseEvent& event);
101 virtual void OnTemplatesBtnClick(wxAuiToolBarEvent& event);
102
103 void OnPopupClick(wxCommandEvent& evt);
104 void ExecuteSql();
105 void SetDefaultSelect();
106 void OnCopyCellValue(wxCommandEvent& e);
107 DECLARE_EVENT_TABLE()
108 void OnExecuteSQL(wxCommandEvent& e);
109 };
110
111 #endif // SQLCOMMANDPANEL_H