Hi Dave,
Please find the updated patch.
I have realized that parallel execution of the queries is possible,
which I had disabled in the previous patch. :(
Please find the updated patches (v2.1 - with message-box & v2.2 -
without message box).
(Though I prefer the patch with the message box, I don't like the to add
last moment translation messages. :( )
Thoughts...
Magnus Hagander wrote:
Dave Page wrote:
That was my thought Ashesh - plus we could push out 1.10.1 pretty soon
with a long-term solution.
I still think it's better with a message. Even if it's not translated
for everybody. (And yes, I realize the issue for translators)
But I'll defer to you if you think it's better to just block. I'm
worried about the length of the block leading to UI freezes though...
--
Thanks & Regards,
Ashesh Vashi
EnterpriseDB INDIA: http://www.enterprisedb.com
Index: include/frm/frmQuery.h
===================================================================
--- include/frm/frmQuery.h (revision 7943)
+++ include/frm/frmQuery.h (working copy)
@@ -197,6 +197,8 @@
bool aborted;
bool lastFileFormat;
+ static wxMutex ms_exeMutex;
+
DECLARE_EVENT_TABLE()
};
Index: frm/frmQuery.cpp
===================================================================
--- frm/frmQuery.cpp (revision 7943)
+++ frm/frmQuery.cpp (working copy)
@@ -75,6 +75,9 @@
#define CTRLID_CONNECTION 4200
#define CTRLID_DATABASELABEL 4201
+// Initialize execution mutex
+wxMutex frmQuery::ms_exeMutex;
+
BEGIN_EVENT_TABLE(frmQuery, pgFrame)
EVT_ERASE_BACKGROUND( frmQuery::OnEraseBackground)
EVT_SIZE( frmQuery::OnSize)
@@ -1863,6 +1866,12 @@
if (query.IsNull())
return;
+ if (ms_exeMutex.TryLock() == wxMUTEX_BUSY)
+ {
+ wxMessageBox(_("Parallel script execution is in process."), _("Can not countinue executing the pgScript!"), wxICON_WARNING);
+ return;
+ }
+
// Clear markers and indicators
sqlQuery->MarkerDeleteAll(0);
sqlQuery->StartStyling(0, wxSTC_INDICS_MASK);
@@ -2235,6 +2244,9 @@
// Reset tools
setTools(false);
+ // Unlock mutex
+ ms_exeMutex.Unlock();
+
// Manage timer
elapsedQuery = wxGetLocalTimeMillis() - startTimeQuery;
SetStatusText(elapsedQuery.ToString() + wxT(" ms"), STATUSPOS_SECS);
@@ -2317,6 +2329,7 @@
conn->ExecuteVoid(wxT("ROLLBACK;"));
setTools(false);
+
fileMenu->Enable(MNU_EXPORT, sqlResult->CanExport());
if (!IsActive())
Index: include/frm/frmQuery.h
===================================================================
--- include/frm/frmQuery.h (revision 7943)
+++ include/frm/frmQuery.h (working copy)
@@ -197,6 +197,8 @@
bool aborted;
bool lastFileFormat;
+ static wxMutex ms_exeMutex;
+
DECLARE_EVENT_TABLE()
};
Index: frm/frmQuery.cpp
===================================================================
--- frm/frmQuery.cpp (revision 7943)
+++ frm/frmQuery.cpp (working copy)
@@ -75,6 +75,9 @@
#define CTRLID_CONNECTION 4200
#define CTRLID_DATABASELABEL 4201
+// Initialize execution mutex
+wxMutex frmQuery::ms_exeMutex;
+
BEGIN_EVENT_TABLE(frmQuery, pgFrame)
EVT_ERASE_BACKGROUND( frmQuery::OnEraseBackground)
EVT_SIZE( frmQuery::OnSize)
@@ -1863,6 +1866,9 @@
if (query.IsNull())
return;
+ if (ms_exeMutex.TryLock() == wxMUTEX_BUSY)
+ return;
+
// Clear markers and indicators
sqlQuery->MarkerDeleteAll(0);
sqlQuery->StartStyling(0, wxSTC_INDICS_MASK);
@@ -2235,6 +2241,9 @@
// Reset tools
setTools(false);
+ // Unlock mutex
+ ms_exeMutex.Unlock();
+
// Manage timer
elapsedQuery = wxGetLocalTimeMillis() - startTimeQuery;
SetStatusText(elapsedQuery.ToString() + wxT(" ms"), STATUSPOS_SECS);
@@ -2317,6 +2326,7 @@
conn->ExecuteVoid(wxT("ROLLBACK;"));
setTools(false);
+
fileMenu->Enable(MNU_EXPORT, sqlResult->CanExport());
if (!IsActive())
--
Sent via pgadmin-support mailing list (pgadmin-support@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-support