From 533e74f37480ddeae016b6f463384063143a4fe3 Mon Sep 17 00:00:00 2001
From: John Obaterspok <john.obaterspok@gmail.com>
Date: Mon, 15 Jun 2015 22:29:48 +0200
Subject: [PATCH] Add Commit/Rollback toolbar action

Signed-off-by: John Obaterspok <john.obaterspok@gmail.com>
---
 pgadmin/frm/frmQuery.cpp                  |  20 ++++++++++++++++++++
 pgadmin/include/frm/frmQuery.h            |  11 ++++++-----
 pgadmin/include/frm/menu.h                |   2 ++
 pgadmin/include/images/module.mk          |   2 ++
 pgadmin/include/images/query_commit.png   | Bin 0 -> 602 bytes
 pgadmin/include/images/query_rollback.png | Bin 0 -> 403 bytes
 pgadmin/pgAdmin3.vcxproj                  |   3 ++-
 pgadmin/pgAdmin3.vcxproj.filters          |   6 ++++++
 8 files changed, 38 insertions(+), 6 deletions(-)
 create mode 100644 pgadmin/include/images/query_commit.png
 create mode 100644 pgadmin/include/images/query_rollback.png

diff --git a/pgadmin/frm/frmQuery.cpp b/pgadmin/frm/frmQuery.cpp
index b5a2f56..d5bf2e4 100644
--- a/pgadmin/frm/frmQuery.cpp
+++ b/pgadmin/frm/frmQuery.cpp
@@ -76,6 +76,8 @@
 #include "images/query_execfile.pngc"
 #include "images/query_explain.pngc"
 #include "images/query_cancel.pngc"
+#include "images/query_commit.pngc"
+#include "images/query_rollback.pngc"
 #include "images/help.pngc"
 #include "images/gqbJoin.pngc"
 
@@ -119,6 +121,8 @@ BEGIN_EVENT_TABLE(frmQuery, pgFrame)
 	EVT_MENU(MNU_EXECFILE,          frmQuery::OnExecFile)
 	EVT_MENU(MNU_EXPLAIN,           frmQuery::OnExplain)
 	EVT_MENU(MNU_EXPLAINANALYZE,    frmQuery::OnExplain)
+	EVT_MENU(MNU_DOCOMMIT,			frmQuery::OnCommit)
+	EVT_MENU(MNU_DOROLLBACK,		frmQuery::OnRollback)
 	EVT_MENU(MNU_CANCEL,            frmQuery::OnCancel)
 	EVT_MENU(MNU_AUTOROLLBACK,      frmQuery::OnAutoRollback)
 	EVT_MENU(MNU_AUTOCOMMIT,        frmQuery::OnAutoCommit)
@@ -432,6 +436,10 @@ frmQuery::frmQuery(frmMain *form, const wxString &_title, pgConn *_conn, const w
 	toolBar->AddTool(MNU_CANCEL, wxEmptyString, *query_cancel_png_bmp, _("Cancel query"), wxITEM_NORMAL);
 	toolBar->AddSeparator();
 
+	toolBar->AddTool(MNU_DOCOMMIT, wxEmptyString, *query_commit_png_bmp, _("Commit"), wxITEM_NORMAL);
+	toolBar->AddTool(MNU_DOROLLBACK, wxEmptyString, *query_rollback_png_bmp, _("Rollback"), wxITEM_NORMAL);
+	toolBar->AddSeparator();
+
 	toolBar->AddTool(MNU_HELP, wxEmptyString, *help_png_bmp, _("Display help on SQL commands."), wxITEM_NORMAL);
 	toolBar->Realize();
 
@@ -2197,6 +2205,16 @@ void frmQuery::OnExplain(wxCommandEvent &event)
 	execQuery(sql, resultToRetrieve, true, offset, false, true, verbose);
 }
 
+void frmQuery::OnCommit(wxCommandEvent &event)
+{
+	execQuery(wxT("COMMIT;"));
+}
+
+void frmQuery::OnRollback(wxCommandEvent &event)
+{
+	execQuery(wxT("ROLLBACK;"));
+}
+
 // Update the main SQL query from the GQB if desired
 bool frmQuery::updateFromGqb(bool executing)
 {
@@ -2419,6 +2437,8 @@ void frmQuery::setTools(const bool running)
 	toolBar->EnableTool(MNU_EXECFILE, !running);
 	toolBar->EnableTool(MNU_EXPLAIN, !running);
 	toolBar->EnableTool(MNU_CANCEL, running);
+	toolBar->EnableTool(MNU_DOCOMMIT, !running);
+	toolBar->EnableTool(MNU_DOROLLBACK, !running);
 	queryMenu->Enable(MNU_EXECUTE, !running);
 	queryMenu->Enable(MNU_EXECPGS, !running);
 	queryMenu->Enable(MNU_EXECFILE, !running);
diff --git a/pgadmin/include/frm/frmQuery.h b/pgadmin/include/frm/frmQuery.h
index d53931b..43caf5e 100644
--- a/pgadmin/include/frm/frmQuery.h
+++ b/pgadmin/include/frm/frmQuery.h
@@ -35,15 +35,14 @@
 //
 // This number MUST be incremented if changing any of the default perspectives
 //
-#define FRMQUERY_PERSPECTIVE_VER wxT("8317")
-
+#define FRMQUERY_PERSPECTIVE_VER wxT("8320")
 #ifdef __WXMAC__
-#define FRMQUERY_DEFAULT_PERSPECTIVE wxT("layout2|name=toolBar;caption=Tool bar;state=16788208;dir=1;layer=10;row=0;pos=0;prop=100000;bestw=415;besth=23;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=databaseBar;caption=Database bar;state=16788208;dir=1;layer=10;row=0;pos=396;prop=100000;bestw=300;besth=21;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=sqlQuery;caption=SQL query;state=17404;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=350;besth=200;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=outputPane;caption=Output pane;state=16779260;dir=3;layer=0;row=0;pos=0;prop=100000;bestw=550;besth=300;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=scratchPad;caption=Scratch pad;state=16779260;dir=2;layer=0;row=0;pos=0;prop=100000;bestw=250;besth=200;minw=100;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|dock_size(1,10,0)=25|dock_size(5,0,0)=200|dock_size(3,0,0)=290|dock_size(2,0,0)=255|")
+#define FRMQUERY_DEFAULT_PERSPECTIVE wxT("layout2|name=toolBar;caption=Tool bar;state=16788208;dir=1;layer=10;row=0;pos=0;prop=100000;bestw=465;besth=23;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=databaseBar;caption=Database bar;state=16788208;dir=1;layer=10;row=0;pos=396;prop=100000;bestw=300;besth=21;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=sqlQuery;caption=SQL query;state=17404;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=350;besth=200;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=outputPane;caption=Output pane;state=16779260;dir=3;layer=0;row=0;pos=0;prop=100000;bestw=550;besth=300;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=scratchPad;caption=Scratch pad;state=16779260;dir=2;layer=0;row=0;pos=0;prop=100000;bestw=250;besth=200;minw=100;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|dock_size(1,10,0)=25|dock_size(5,0,0)=200|dock_size(3,0,0)=290|dock_size(2,0,0)=255|")
 #else
 #ifdef __WXGTK__
-#define FRMQUERY_DEFAULT_PERSPECTIVE wxT("layout2|name=toolBar;caption=Tool bar;state=16788208;dir=1;layer=10;row=0;pos=0;prop=100000;bestw=525;besth=30;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=databaseBar;caption=Database bar;state=16788208;dir=1;layer=10;row=0;pos=396;prop=100000;bestw=300;besth=30;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=sqlQuery;caption=SQL query;state=17404;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=350;besth=200;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=outputPane;caption=Output pane;state=16779260;dir=3;layer=0;row=0;pos=0;prop=100000;bestw=550;besth=300;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=scratchPad;caption=Scratch pad;state=16779260;dir=2;layer=0;row=0;pos=0;prop=100000;bestw=250;besth=200;minw=100;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|dock_size(1,10,0)=25|dock_size(5,0,0)=200|dock_size(3,0,0)=290|dock_size(2,0,0)=255|")
+#define FRMQUERY_DEFAULT_PERSPECTIVE wxT("layout2|name=toolBar;caption=Tool bar;state=16788208;dir=1;layer=10;row=0;pos=0;prop=100000;bestw=590;besth=30;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=databaseBar;caption=Database bar;state=16788208;dir=1;layer=10;row=0;pos=396;prop=100000;bestw=300;besth=30;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=sqlQuery;caption=SQL query;state=17404;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=350;besth=200;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=outputPane;caption=Output pane;state=16779260;dir=3;layer=0;row=0;pos=0;prop=100000;bestw=550;besth=300;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=scratchPad;caption=Scratch pad;state=16779260;dir=2;layer=0;row=0;pos=0;prop=100000;bestw=250;besth=200;minw=100;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|dock_size(1,10,0)=25|dock_size(5,0,0)=200|dock_size(3,0,0)=290|dock_size(2,0,0)=255|")
 #else
-#define FRMQUERY_DEFAULT_PERSPECTIVE wxT("layout2|name=toolBar;caption=Tool bar;state=16788208;dir=1;layer=10;row=0;pos=0;prop=100000;bestw=415;besth=23;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=databaseBar;caption=Database bar;state=16788208;dir=1;layer=10;row=0;pos=396;prop=100000;bestw=300;besth=21;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=sqlQuery;caption=SQL query;state=17404;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=350;besth=200;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=outputPane;caption=Output pane;state=16779260;dir=3;layer=0;row=0;pos=0;prop=100000;bestw=550;besth=300;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=scratchPad;caption=Scratch pad;state=16779260;dir=2;layer=0;row=0;pos=0;prop=100000;bestw=250;besth=200;minw=100;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|dock_size(1,10,0)=25|dock_size(5,0,0)=200|dock_size(3,0,0)=290|dock_size(2,0,0)=255|")
+#define FRMQUERY_DEFAULT_PERSPECTIVE wxT("layout2|name=toolBar;caption=Tool bar;state=16788208;dir=1;layer=10;row=0;pos=0;prop=100000;bestw=465;besth=23;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=databaseBar;caption=Database bar;state=16788208;dir=1;layer=10;row=0;pos=396;prop=100000;bestw=300;besth=21;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=sqlQuery;caption=SQL query;state=17404;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=350;besth=200;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=outputPane;caption=Output pane;state=16779260;dir=3;layer=0;row=0;pos=0;prop=100000;bestw=550;besth=300;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=scratchPad;caption=Scratch pad;state=16779260;dir=2;layer=0;row=0;pos=0;prop=100000;bestw=250;besth=200;minw=100;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|dock_size(1,10,0)=25|dock_size(5,0,0)=200|dock_size(3,0,0)=290|dock_size(2,0,0)=255|")
 #endif
 #endif
 
@@ -181,6 +180,8 @@ private:
 	void OnExecScript(wxCommandEvent &event);
 	void OnExecFile(wxCommandEvent &event);
 	void OnExplain(wxCommandEvent &event);
+	void OnCommit(wxCommandEvent &event);
+	void OnRollback(wxCommandEvent &event);
 	void OnBuffers(wxCommandEvent &event);
 	void OnTiming(wxCommandEvent &event);
 	void OnNew(wxCommandEvent &event);
diff --git a/pgadmin/include/frm/menu.h b/pgadmin/include/frm/menu.h
index 4d0f757..7627cd5 100644
--- a/pgadmin/include/frm/menu.h
+++ b/pgadmin/include/frm/menu.h
@@ -66,6 +66,8 @@ enum
 	MNU_EXPLAIN,
 	MNU_EXPLAINANALYZE,
 	MNU_EXPLAINOPTIONS,
+	MNU_DOCOMMIT,
+	MNU_DOROLLBACK,
 	MNU_VERBOSE,
 	MNU_COSTS,
 	MNU_BUFFERS,
diff --git a/pgadmin/include/images/module.mk b/pgadmin/include/images/module.mk
index 0d5bd97..613146f 100644
--- a/pgadmin/include/images/module.mk
+++ b/pgadmin/include/images/module.mk
@@ -227,6 +227,8 @@ pgadmin3_SOURCES += \
 	include/images/query_execfile.png \
 	include/images/query_execute.png \
 	include/images/query_explain.png \
+	include/images/query_commit.png \
+	include/images/query_rollback.png \
 	include/images/query_pgscript.png \
 	include/images/readdata.png \
 	include/images/refresh.png \
diff --git a/pgadmin/include/images/query_commit.png b/pgadmin/include/images/query_commit.png
new file mode 100644
index 0000000000000000000000000000000000000000..476f0422ea9273e625265858a12388905c1597d7
GIT binary patch
literal 602
zcmV-g0;T<lP)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00004XF*Lt006O%
z3;baP00009a7bBm000id000id0mpBsWB>pF7<5HgbW?9;ba!ELWdLwtX>N2bZe?^J
zG%heMHD!e|WdHyH*hxe|R5(wil37nvK^TTv%aTG!3#FtLAyPzWJ8iKCDotE2B=Lfn
z_yhc1DshXrrPe@g3_`Fm>Wzt4M$x3fCeR+1#Gml+&Cx?TSQCvGPv(5f`^`IZrV02j
z8YXWwH*>$eot2&*3cbBN_j+0C=-{T)ZuT01%VJ9lFJr@$FQnL>xA=ZF!`JIs9(Q(1
z+3Ym}7wzCpAb>qJ#Sf*9Soiy-Z1x&~iylx+gxShO*<4V3yP~LO|6#ywIYMbT$W9`P
zJ+0VJ#@S29+34?=ve|0{E{o!z6bVzEj$xlw*p`q{toeLWHhYggZg@Rt>l*Fg{iWnj
z;f&ayll6R>51|mR`ud#u9Y<O>;I1U|0Y9Z+fRCq6vLnKME6Mg{i>-wj>}-nKtm5;;
z7|+IroQ;eDFC=lVt&P>80m|bM_T=2VX~nMG!9gO<fr?Q%Gr?=Qhez@zR*nzQ<R!V}
z@vs&eWb>lp%e55MbBdZ3r;?at<HR7jt}d2aTOF~+7@#Rg@rgW`cjF_J=VH|4A}g~|
zN~0kj$m?AGwX=&Mc3BmRx$bV(!$CexMtFOAgoolRcTB7?f_jQ#Ri8CK;B&-J8;CW(
oCF&`PQ2(;RAH<r5$-jrDL%Mi~)7~5*{r~^~07*qoM6N<$g1t8r_W%F@

literal 0
HcmV?d00001

diff --git a/pgadmin/include/images/query_rollback.png b/pgadmin/include/images/query_rollback.png
new file mode 100644
index 0000000000000000000000000000000000000000..ae48349ecaa20c56c1bdb5ba1476f3898efa02b3
GIT binary patch
literal 403
zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl
z_H+M9WCij$3p^r=85sBugD~Uq{1qucL5ULAh?3y^w370~qEv>0#LT=By}Z;C1rt33
zJ=4@yqg0@wES@foAr}70KmPx>ca`AT;8~LI^GDt^`iFgo+jQq+5xfnVcE$CEj?M-=
z4Vm}KHa_})X>s8H^4Pp1*&JN#%PLR*Z2G_XyY>J1+m3(xzsLEXgY&FHsiuXMk8hs&
zfBAdFpZQxZfA~M;uGs(OZ@2!o{~z$+e{A>$>83@Me`ks;Q2YD8_V(3({x=qWuD_)B
z_<wMD^uPK0u0Q<$=kP%X=O{xSMq!16i?>%bvZ?%!uT*;Tf0c0H|M2-ezxRJDx%9tu
z`Q`ul7PCLsU*73dP%)=^gG>%b7o&mr0fTi04T(JB3ds|gauOMY+{3vKNiZq2-Z<2t
v!pwG$^+r;o3UfhX$yS9PMF**W=NTBB_U`grZ@MZP7-kHfu6{1-oD!M<SOBWI

literal 0
HcmV?d00001

diff --git a/pgadmin/pgAdmin3.vcxproj b/pgadmin/pgAdmin3.vcxproj
index 319f0c5..703043e 100644
--- a/pgadmin/pgAdmin3.vcxproj
+++ b/pgadmin/pgAdmin3.vcxproj
@@ -55,7 +55,6 @@
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v120_xp</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
@@ -3464,10 +3463,12 @@
     <png2c Include="include\images\properties.png" />
     <png2c Include="include\images\property.png" />
     <png2c Include="include\images\query_cancel.png" />
+    <png2c Include="include\images\query_commit.png" />
     <png2c Include="include\images\query_execfile.png" />
     <png2c Include="include\images\query_execute.png" />
     <png2c Include="include\images\query_explain.png" />
     <png2c Include="include\images\query_pgscript.png" />
+    <png2c Include="include\images\query_rollback.png" />
     <png2c Include="include\images\readdata.png" />
     <png2c Include="include\images\refresh.png" />
     <png2c Include="include\images\reload.png" />
diff --git a/pgadmin/pgAdmin3.vcxproj.filters b/pgadmin/pgAdmin3.vcxproj.filters
index 04def5f..c21104b 100644
--- a/pgadmin/pgAdmin3.vcxproj.filters
+++ b/pgadmin/pgAdmin3.vcxproj.filters
@@ -4505,6 +4505,12 @@
     <png2c Include="include\images\views.png">
       <Filter>include\images</Filter>
     </png2c>
+    <png2c Include="include\images\query_commit.png">
+      <Filter>include\images</Filter>
+    </png2c>
+    <png2c Include="include\images\query_rollback.png">
+      <Filter>include\images</Filter>
+    </png2c>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="pgAdmin3.rc" />
-- 
1.9.5.msysgit.1

