From 57a523f65415a3adce23cec063f80c3ea3a3682b 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 1/2] 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 -> 707 bytes
 pgadmin/include/images/query_rollback.png | Bin 0 -> 583 bytes
 pgadmin/pgAdmin3.vcxproj                  |   2 ++
 pgadmin/pgAdmin3.vcxproj.filters          |   6 ++++++
 8 files changed, 38 insertions(+), 5 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 03f81e8..f855e88 100644
--- a/pgadmin/frm/frmQuery.cpp
+++ b/pgadmin/frm/frmQuery.cpp
@@ -77,6 +77,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"
 
@@ -120,6 +122,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)
@@ -436,6 +440,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();
 
@@ -2201,6 +2209,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)
 {
@@ -2423,6 +2441,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 7120240..06baa0c 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 69a45c7..7024aea 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..500ef88c58b4fc812e4693177001b69fc0f55ed9
GIT binary patch
literal 707
zcmV;!0zCbRP)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00004XF*Lt006O%
z3;baP00009a7bBm000ic000ic0Tn1pfB*mh7<5HgbW?9;ba!ELWdLwtX>N2bZe?^J
zG%heMHD!e|WdHyIK}keGR5(w4ky}WUVI0P%;1LxWmcp!zvO;v9hn%woQ5W3=5_Q{M
z6eM)nRd>;K(19^CN+b*OFtM!EDa&*nqzH^!>R4;%Ltf~h4D#3e&iUEbsy{q@@Av+n
z=Xsy^|LOn@I<vCq&dFi8xR{3}CD@CK=*i3DrcSoCT#1a0+u7MTw^tCXuO-r?5N|LN
zYc?`jRwmk7u0+PhEs?-kT}h~^j>vw6h)JMTVO*~lZ7o+qU33)XBIC;ht|JZW!WM;)
zMSKr6Gixv~R$9uPKdz!Kx@7c<t-Rf}gP;(`O$`K&n((%@5INXL*sSnj-|o~Q8yX39
zA<>hY%ebK&_hE&PCmRVJPzalh`08tz+*VG1L4lxc@+CAiH*=NV{CsBiRN=AI5f*ds
znQL+GG;mkEOq!;a#$dS9g6q*a=4Y?aUs#BvvV!+D)lBcL;+{zMdg45effLwmCRL>x
zJR3NT=UoT<ToUlJw(91-c>BRE`jj{r>?7do!t3qig`*wGmpav8$Y$Zy=qcu2p5?1&
zgq6_bI^uSszUwMvU-F)Iw`mRfuhrvUm>{}1%JZRio^&0<Zf#K^|K)xnI!)}$7?Lk_
z8iSx`ie$_U-&f$<5^Kphl8F)GJ{zCsFXElQEUsZC;_v&n!E)>q{7Ay;y1`2HF^RA>
zW#C&B23{-Cz=OXV%sMWm6D+F+sRaJt5_oOAabCzYkTulN%GBT)7F;(r2bmt?#_%S3
pkBetCt16AbM*VMyX^L8a?iVsPVn?ss%Xk0)002ovPDHLkV1ly(N`3$U

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..b78ce614bbff77a80aae4e32e4aa1adc71ce4642
GIT binary patch
literal 583
zcmV-N0=WH&P)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00004XF*Lt006O%
z3;baP00009a7bBm000ic000ic0Tn1pfB*mh7<5HgbW?9;ba!ELWdLwtX>N2bZe?^J
zG%heMHD!e|WdHyH#Ysd#R5(wCk=;vEaTv$_ANn7>5>f)4h!J$B;7i>N@xrJ`y68e7
z@Jj1iY}s*RkYRYCHaEhz&9ln+lCq>?H>Hl_oG+a@y>J6fs89PHcYf`(Gkf66;rBe>
z?}vxylmWJKdauysX+V7cofXQqX@);(um1}vYM9}fua6mBb`py9UJ9{1%<$CbM|j`g
zL{aN`8EMWzo|J?Xg$L)a(mz|yz+45c&^2Dn*D@5o!SLd3TZjc<%5H<gxtS5NRBZW~
zVHi>!xPn!=Z5$}!>kLO)jeg!H%K~`otz%{Cfngk9buzKmjxXB5Wb{6P^@m1Z_1(hn
zu9hhYSn%B;{>1~ojtyfeX_}XhYA3=kauN`5*Rd9CBer^vqxdwL{dX5S^rI)9ONqJg
z&5bl!0dHKDBsat8TR|2Boy@*!#IMvyiMQyd^(9g}A%tJ#EP%augly^?oMqtjnBUnL
z+4MAr2{+ptJ!l(G*-a??NKTXnoTR?Pc@}<N05bXv=>x?8B(`z@O+nusw+BSkzWfF!
z5@2kQEZ9JEv;LvG7$7R(sU<Rbm(7*IzlY2p(L7#wtR?pw9WrGBn046^^A=e^*&qC)
Vd9JZq;cWl_002ovPDHLkV1m0-19<=d

literal 0
HcmV?d00001

diff --git a/pgadmin/pgAdmin3.vcxproj b/pgadmin/pgAdmin3.vcxproj
index 534bf78..9328a9c 100644
--- a/pgadmin/pgAdmin3.vcxproj
+++ b/pgadmin/pgAdmin3.vcxproj
@@ -3464,10 +3464,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

