Index: pgadmin/include/frm/menu.h
===================================================================
--- pgadmin/include/frm/menu.h	(révision 8028)
+++ pgadmin/include/frm/menu.h	(copie de travail)
@@ -65,6 +65,7 @@
     MNU_EXPLAINOPTIONS,
     MNU_VERBOSE,
     MNU_ANALYZE,
+    MNU_AUTOROLLBACK,
     MNU_CLEARHISTORY,
     MNU_SAVEHISTORY,
     MNU_CHECKALIVE,
Index: pgadmin/include/frm/frmQuery.h
===================================================================
--- pgadmin/include/frm/frmQuery.h	(révision 8028)
+++ pgadmin/include/frm/frmQuery.h	(copie de travail)
@@ -134,6 +134,7 @@
     void OnUndo(wxCommandEvent& event);
     void OnRedo(wxCommandEvent& event);
     void OnSaveHistory(wxCommandEvent& event);
+    void OnAutoRollback(wxCommandEvent& event);
     void OnChangeConnection(wxCommandEvent &ev);
     void OnClearHistory(wxCommandEvent& event);
     void OnActivate(wxActivateEvent& event);
Index: pgadmin/include/utils/sysSettings.h
===================================================================
--- pgadmin/include/utils/sysSettings.h	(révision 8028)
+++ 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 GetAutoRollback() const { bool b; Read(wxT("frmQuery/AutoRollback"), &b, true); return b; }
+	void SetAutoRollback(const bool newval) { Write(wxT("frmQuery/AutoRollback"), 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 8028)
+++ 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 chkAutoRollback             CTRL_CHECKBOX("chkAutoRollback")
 #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());
+    chkAutoRollback->SetValue(settings->GetAutoRollback());
     chkDoubleClickProperties->SetValue(settings->GetDoubleClickProperties());
 
     txtPgHelpPath->SetValue(settings->GetPgHelpPath());
@@ -391,6 +393,7 @@
 
     settings->SetStickySql(chkStickySql->GetValue());
     settings->SetIndicateNull(chkIndicateNull->GetValue());
+    settings->SetAutoRollback(chkAutoRollback->GetValue());
     settings->SetDoubleClickProperties(chkDoubleClickProperties->GetValue());
     settings->SetUnicodeFile(chkUnicodeFile->GetValue());
     settings->SetSystemFont(currentFont);
Index: pgadmin/frm/frmQuery.cpp
===================================================================
--- pgadmin/frm/frmQuery.cpp	(révision 8028)
+++ 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"
 
@@ -105,6 +106,7 @@
 EVT_MENU(MNU_EXECFILE,          frmQuery::OnExecFile)
 EVT_MENU(MNU_EXPLAIN,           frmQuery::OnExplain)
 EVT_MENU(MNU_CANCEL,            frmQuery::OnCancel)
+EVT_MENU(MNU_AUTOROLLBACK,      frmQuery::OnAutoRollback)
 EVT_MENU(MNU_CONTENTS,          frmQuery::OnContents)
 EVT_MENU(MNU_HELP,              frmQuery::OnHelp)
 EVT_MENU(MNU_CLEARHISTORY,      frmQuery::OnClearHistory)
@@ -240,6 +242,8 @@
     queryMenu->Append(MNU_SAVEHISTORY, _("Save history"), _("Save history of executed commands."));
     queryMenu->Append(MNU_CLEARHISTORY, _("Clear history"), _("Clear history window."));
     queryMenu->AppendSeparator();
+    queryMenu->Append(MNU_AUTOROLLBACK, _("&Auto-Rollback"), _("Rollback the current transaction if an error is detected"), wxITEM_CHECK);
+    queryMenu->AppendSeparator();
     queryMenu->Append(MNU_CANCEL, _("&Cancel\tAlt-Break"), _("Cancel query"));
     menuBar->Append(queryMenu, _("&Query"));
 
@@ -422,6 +426,10 @@
 
     bool bVal;
 
+    // Auto-rollback
+    settings->Read(wxT("frmQuery/AutoRollback"), &bVal, false);
+    queryMenu->Check(MNU_AUTOROLLBACK, bVal);
+
     // Auto indent
     settings->Read(wxT("frmQuery/AutoIndent"), &bVal, true);
     editMenu->Check(MNU_AUTOINDENT, bVal);
@@ -659,6 +667,14 @@
 }
 
 
+void frmQuery::OnAutoRollback(wxCommandEvent& event)
+{
+    queryMenu->Check(MNU_AUTOROLLBACK, event.IsChecked());
+
+    settings->Write(wxT("frmQuery/AutoRollback"), queryMenu->IsChecked(MNU_AUTOROLLBACK));
+}
+
+
 void frmQuery::OnAutoIndent(wxCommandEvent &event)
 {
     editMenu->Check(MNU_AUTOINDENT, event.IsChecked());
@@ -2352,7 +2368,7 @@
     msgHistory->ShowPosition(0);
 
     // If the transaction aborted for some reason, issue a rollback to cleanup.
-    if (conn->GetTxStatus() == PGCONN_TXSTATUS_INERROR)
+    if (settings->GetAutoRollback() && conn->GetTxStatus() == PGCONN_TXSTATUS_INERROR)
         conn->ExecuteVoid(wxT("ROLLBACK;"));
 
     setTools(false);
Index: pgadmin/ui/frmOptions.xrc
===================================================================
--- pgadmin/ui/frmOptions.xrc	(révision 8028)
+++ pgadmin/ui/frmOptions.xrc	(copie de travail)
@@ -308,6 +308,16 @@
             <pos>175,157d</pos>
             <size>226,12d</size>
           </object>
+          <object class="wxStaticText" name="stAutoRollback">
+            <label>Enable Auto ROLLBACK</label>
+            <pos>5,172d</pos>
+          </object>
+          <object class="wxCheckBox" name="chkAutoRollback">
+            <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>
