~mapopa/flamerobin/master

« back to all changes in this revision

Viewing changes to src/ExecuteSqlFrame.h

  • Committer: Michael Hieke
  • Date: 2004-11-22 11:34:42 UTC
  • Revision ID: git-v1:8153b493d66ee7aae55e7b34e0d7bddacf4999ef
Initial revision

svn path=/trunk/flamerobin/; revision=13

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  The contents of this file are subject to the Initial Developer's Public
 
3
  License Version 1.0 (the "License"); you may not use this file except in
 
4
  compliance with the License. You may obtain a copy of the License here:
 
5
  http://www.flamerobin.org/license.html.
 
6
 
 
7
  Software distributed under the License is distributed on an "AS IS"
 
8
  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 
9
  License for the specific language governing rights and limitations under
 
10
  the License.
 
11
 
 
12
  The Original Code is FlameRobin (TM).
 
13
 
 
14
  The Initial Developer of the Original Code is Milan Babuskov.
 
15
 
 
16
  Portions created by the original developer
 
17
  are Copyright (C) 2004 Milan Babuskov.
 
18
 
 
19
  All Rights Reserved.
 
20
 
 
21
  Contributor(s): Nando Dessena
 
22
*/
 
23
 
 
24
// -*- C++ -*- generated by wxGlade 0.2.2 on Fri Jun 04 12:31:56 2004
 
25
 
 
26
#include <wx/wx.h>
 
27
#include <wx/image.h>
 
28
#include <wx/stc/stc.h>
 
29
 
 
30
#ifndef EXECUTESQLFRAME_H
 
31
#define EXECUTESQLFRAME_H
 
32
 
 
33
// begin wxGlade: dependencies
 
34
#include <wx/splitter.h>
 
35
#include <wx/notebook.h>
 
36
#include <wx/grid.h>
 
37
// end wxGlade
 
38
 
 
39
#include "ibpp.h"
 
40
#include "metadata/database.h"
 
41
#include "observer.h"
 
42
#include "myDataGrid.h"
 
43
#include "BaseFrame.h"
 
44
 
 
45
class ExecuteSqlFrame: public BaseFrame, public YxObserver {
 
46
public:
 
47
        void setDatabase(YDatabase *db);
 
48
 
 
49
    // begin wxGlade: ExecuteSqlFrame::ids
 
50
    enum {
 
51
        ID_button_new = 101,
 
52
        ID_button_load = 102,
 
53
        ID_button_save = 103,
 
54
        ID_button_execute = 104,
 
55
        ID_button_commit = 105,
 
56
        ID_button_rollback = 106,
 
57
                ID_button_toggle = 107,
 
58
                ID_button_wrap = 108,
 
59
        ID_my_data_grid = 200,
 
60
                ID_sql_edit = 201
 
61
    };
 
62
    // end wxGlade
 
63
 
 
64
        void executeAllStatements(bool autoExecute = false);
 
65
        void setSql(wxString sql);
 
66
 
 
67
    ExecuteSqlFrame(wxWindow* parent, int id, wxString title, const wxPoint& pos=wxDefaultPosition,
 
68
                const wxSize& size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE);
 
69
 
 
70
private:
 
71
        std::vector<std::string> executedStatementsM;
 
72
 
 
73
        typedef enum { ttNormal, ttSql, ttError } TextType;
 
74
        void log(wxString s, TextType type = ttNormal);         // write messages to textbox
 
75
        void SplitScreen();
 
76
        YDatabase *databaseM;
 
77
 
 
78
        bool execute(std::string sql);
 
79
        bool inTransactionM;
 
80
        IBPP::Transaction transactionM;
 
81
        IBPP::Statement statementM;
 
82
        void InTransaction(bool started);               // changes controls (enable/disable)
 
83
        void commitTransaction();
 
84
 
 
85
        void setupEditor();             // Setup the Scintilla editor
 
86
        void OnSqlEditUpdateUI(wxStyledTextEvent &event);
 
87
 
 
88
        void OnSqlEditCharAdded(wxStyledTextEvent &event);              // autocomplete stuff
 
89
        wxString keywordsM;             // text used for autocomplete
 
90
        void setKeywords();
 
91
 
 
92
        // events
 
93
        void OnClose(wxCloseEvent& event);
 
94
    void OnKeyDown(wxKeyEvent &event);
 
95
    void OnButtonNewClick(wxCommandEvent &event);
 
96
    void OnButtonLoadClick(wxCommandEvent &event);
 
97
    void OnButtonSaveClick(wxCommandEvent &event);
 
98
    void OnButtonExecuteClick(wxCommandEvent &event);
 
99
    void OnButtonCommitClick(wxCommandEvent &event);
 
100
    void OnButtonRollbackClick(wxCommandEvent &event);
 
101
    void OnButtonToggleClick(wxCommandEvent &event);
 
102
    void OnButtonWrapClick(wxCommandEvent &event);
 
103
 
 
104
    // begin wxGlade: ExecuteSqlFrame::methods
 
105
    void set_properties();
 
106
    void do_layout();
 
107
    // end wxGlade
 
108
 
 
109
protected:
 
110
        void removeObservedObject(YxSubject *object);
 
111
        void update();
 
112
        bool closeWhenTransactionDoneM;
 
113
 
 
114
    // begin wxGlade: ExecuteSqlFrame::attributes
 
115
    wxStatusBar* execute_sql_frame_statusbar;
 
116
    wxBitmapButton* button_new;
 
117
    wxBitmapButton* button_load;
 
118
    wxBitmapButton* button_save;
 
119
 
 
120
    wxButton* button_execute;
 
121
    wxButton* button_commit;
 
122
    wxButton* button_rollback;
 
123
    wxButton* button_toggle;
 
124
    wxButton* button_wrap;
 
125
    wxStyledTextCtrl* sql_edit;
 
126
    wxPanel* window_1_pane_1;
 
127
        wxStyledTextCtrl* stats_text_ctrl;
 
128
    wxPanel* notebook_pane_1;
 
129
    myDataGrid* data_grid;
 
130
    wxPanel* notebook_1_pane_2;
 
131
    wxNotebook* notebook_1;
 
132
    wxPanel* window_1_pane_2;
 
133
    wxSplitterWindow* window_1;
 
134
    wxPanel* panel_1;
 
135
    // end wxGlade
 
136
 
 
137
    DECLARE_EVENT_TABLE()
 
138
        virtual const std::string getName() const;
 
139
        virtual void doReadConfigSettings(const std::string& prefix);
 
140
        virtual void doWriteConfigSettings(const std::string& prefix) const;
 
141
        virtual const wxRect getDefaultRect() const;
 
142
};
 
143
 
 
144
 
 
145
#endif // EXECUTESQLFRAME_H