Le vendredi 21 août 2009 à 09:51:32, Guillaume Lelarge a écrit :
> Le vendredi 21 août 2009 à 09:14:22, Dave Page a écrit :
> > On Thu, Aug 20, 2009 at 10:09 PM, Guillaume
> >
> > Lelarge<guilla...@lelarge.info> wrote:
> > > // If the transaction aborted for some reason, issue a rollback to
> > > cleanup. if (conn->GetTxStatus() == PGCONN_TXSTATUS_INERROR)
> > >    conn->ExecuteVoid(wxT("ROLLBACK;"));
> > >
> > > We should perhaps have an option to enable/disable this behaviour.
> > > Dave, what do you think about this? should I add a ticket on this
> > > issue?
> >
> > Yes, I *think* it'd be appropriate to make that optional. If memory
> > serves, it is only there to cleanup for the user. I'm not in a
> > position to check at the moment though I'm afraid.
>
> Thanks. Logged in as http://code.pgadmin.org/trac/ticket/47 .

Here is a patch to add this feature. It adds a new setting ("Disable Auto 
ROOLBACK") in the Query tag of the Options Dialog. This is of course for 1.11.

Comments?


-- 
Guillaume.
 http://www.postgresqlfr.org
 http://dalibo.com
Index: pgadmin/include/utils/sysSettings.h
===================================================================
--- pgadmin/include/utils/sysSettings.h	(révision 8016)
+++ pgadmin/include/utils/sysSettings.h	(copie de travail)
@@ -110,6 +110,8 @@
 	void SetIndentSpaces(const long newval) { Write(wxT("IndentSpaces"), newval); }
     bool GetIndicateNull() const { bool b; Read(wxT("frmQuery/IndicateNull"), &b, false); return b; }
 	void SetIndicateNull(const bool newval) { Write(wxT("frmQuery/IndicateNull"), newval); }
+    bool GetDisableAutoRollback() const { bool b; Read(wxT("frmQuery/DisableAutoRollback"), &b, false); return b; }
+	void SetDisableAutoRollback(const bool newval) { Write(wxT("frmQuery/DisableAutoRollback"), newval); }
     bool GetUnicodeFile() const { bool b; Read(wxT("WriteUnicodeFile"), &b, true); return b; }
 	void SetUnicodeFile(const bool newval) { Write(wxT("WriteUnicodeFile"), newval); }
     wxFont GetSystemFont();
Index: pgadmin/frm/frmOptions.cpp
===================================================================
--- pgadmin/frm/frmOptions.cpp	(révision 8016)
+++ pgadmin/frm/frmOptions.cpp	(copie de travail)
@@ -56,6 +56,7 @@
 #define cbCopySeparator				CTRL_COMBOBOX("cbCopySeparator")
 #define chkStickySql                CTRL_CHECKBOX("chkStickySql")
 #define chkIndicateNull             CTRL_CHECKBOX("chkIndicateNull")
+#define chkDisableAutoRollback      CTRL_CHECKBOX("chkDisableAutoRollback")
 #define chkDoubleClickProperties    CTRL_CHECKBOX("chkDoubleClickProperties")
 #define cbLanguage                  CTRL_COMBOBOX("cbLanguage")
 #define txtSqlFont                  CTRL_TEXT("txtSqlFont")
@@ -126,6 +127,7 @@
 
     chkStickySql->SetValue(settings->GetStickySql());
     chkIndicateNull->SetValue(settings->GetIndicateNull());
+    chkDisableAutoRollback->SetValue(settings->GetDisableAutoRollback());
     chkDoubleClickProperties->SetValue(settings->GetDoubleClickProperties());
 
     txtPgHelpPath->SetValue(settings->GetPgHelpPath());
@@ -391,6 +393,7 @@
 
     settings->SetStickySql(chkStickySql->GetValue());
     settings->SetIndicateNull(chkIndicateNull->GetValue());
+    settings->SetDisableAutoRollback(chkDisableAutoRollback->GetValue());
     settings->SetDoubleClickProperties(chkDoubleClickProperties->GetValue());
     settings->SetUnicodeFile(chkUnicodeFile->GetValue());
     settings->SetSystemFont(currentFont);
Index: pgadmin/frm/frmQuery.cpp
===================================================================
--- pgadmin/frm/frmQuery.cpp	(révision 8016)
+++ pgadmin/frm/frmQuery.cpp	(copie de travail)
@@ -47,6 +47,7 @@
 #include "schema/pgServer.h"
 #include "utils/favourites.h"
 #include "utils/sysLogger.h"
+#include "utils/sysSettings.h"
 #include "utils/utffile.h"
 #include "pgscript/pgsApplication.h"
 
@@ -2352,7 +2353,7 @@
     msgHistory->ShowPosition(0);
 
     // If the transaction aborted for some reason, issue a rollback to cleanup.
-    if (conn->GetTxStatus() == PGCONN_TXSTATUS_INERROR)
+    if (!settings->GetDisableAutoRollback() && conn->GetTxStatus() == PGCONN_TXSTATUS_INERROR)
         conn->ExecuteVoid(wxT("ROLLBACK;"));
 
     setTools(false);
Index: pgadmin/ui/frmOptions.xrc
===================================================================
--- pgadmin/ui/frmOptions.xrc	(révision 8016)
+++ pgadmin/ui/frmOptions.xrc	(copie de travail)
@@ -308,6 +308,16 @@
             <pos>175,157d</pos>
             <size>226,12d</size>
           </object>
+          <object class="wxStaticText" name="stDisableAutoRollback">
+            <label>Disable Auto ROLLBACK</label>
+            <pos>5,172d</pos>
+          </object>
+          <object class="wxCheckBox" name="chkDisableAutoRollback">
+            <label></label>
+            <checked>0</checked>
+            <pos>175,172d</pos>
+            <size>226,12d</size>
+          </object>
         </object>
       </object>
       <object class="notebookpage">
@@ -390,4 +400,4 @@
       <tooltip>Cancel any changes and close the dialogue.</tooltip>
     </object>
   </object>
-</resource>
\ No newline at end of file
+</resource>
-- 
Sent via pgadmin-support mailing list (pgadmin-support@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-support

Reply via email to