mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-10 23:45:58 -06:00
Fixed rollback and commit button activation on execute button click. #7248
This commit is contained in:
parent
8ab78dc40d
commit
a02ebe192b
@ -950,6 +950,14 @@ def poll(trans_id):
|
|||||||
is_thread_alive = True
|
is_thread_alive = True
|
||||||
break
|
break
|
||||||
|
|
||||||
|
# if transaction object is instance of QueryToolCommand
|
||||||
|
# and transaction aborted for some reason then issue a
|
||||||
|
# rollback to cleanup
|
||||||
|
if isinstance(trans_obj, QueryToolCommand):
|
||||||
|
trans_status = conn.transaction_status()
|
||||||
|
if trans_status == TX_STATUS_INERROR and trans_obj.auto_rollback:
|
||||||
|
conn.execute_void("ROLLBACK;")
|
||||||
|
|
||||||
if is_thread_alive:
|
if is_thread_alive:
|
||||||
status = 'Busy'
|
status = 'Busy'
|
||||||
messages = conn.messages()
|
messages = conn.messages()
|
||||||
@ -973,7 +981,10 @@ def poll(trans_id):
|
|||||||
gettext('******* Error *******'),
|
gettext('******* Error *******'),
|
||||||
result
|
result
|
||||||
)
|
)
|
||||||
|
|
||||||
|
transaction_status = conn.transaction_status() if conn else 0
|
||||||
query_len_data = {
|
query_len_data = {
|
||||||
|
'transaction_status': transaction_status,
|
||||||
'explain_query_length':
|
'explain_query_length':
|
||||||
get_explain_query_length(
|
get_explain_query_length(
|
||||||
conn._Connection__async_cursor._query)
|
conn._Connection__async_cursor._query)
|
||||||
@ -983,15 +994,6 @@ def poll(trans_id):
|
|||||||
status = 'Success'
|
status = 'Success'
|
||||||
rows_affected = conn.rows_affected()
|
rows_affected = conn.rows_affected()
|
||||||
|
|
||||||
# if transaction object is instance of QueryToolCommand
|
|
||||||
# and transaction aborted for some reason then issue a
|
|
||||||
# rollback to cleanup
|
|
||||||
if isinstance(trans_obj, QueryToolCommand):
|
|
||||||
trans_status = conn.transaction_status()
|
|
||||||
if trans_status == TX_STATUS_INERROR and \
|
|
||||||
trans_obj.auto_rollback:
|
|
||||||
conn.execute_void("ROLLBACK;")
|
|
||||||
|
|
||||||
st, result = conn.async_fetchmany_2darray(on_demand_record_count)
|
st, result = conn.async_fetchmany_2darray(on_demand_record_count)
|
||||||
|
|
||||||
# There may be additional messages even if result is present
|
# There may be additional messages even if result is present
|
||||||
|
@ -202,7 +202,6 @@ export class ResultSetUtils {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
let {data: httpMessageData} = await this.postExecutionApi(query, explainObject, flags.isQueryTool, flags.reconnect);
|
let {data: httpMessageData} = await this.postExecutionApi(query, explainObject, flags.isQueryTool, flags.reconnect);
|
||||||
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.SET_CONNECTION_STATUS, httpMessageData.data.transaction_status);
|
|
||||||
|
|
||||||
if (ResultSetUtils.isSqlCorrect(httpMessageData)) {
|
if (ResultSetUtils.isSqlCorrect(httpMessageData)) {
|
||||||
this.setStartData(httpMessageData.data);
|
this.setStartData(httpMessageData.data);
|
||||||
@ -281,7 +280,7 @@ export class ResultSetUtils {
|
|||||||
handlePollError(error, explainObject, flags) {
|
handlePollError(error, explainObject, flags) {
|
||||||
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.EXECUTION_END);
|
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.EXECUTION_END);
|
||||||
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.FOCUS_PANEL, PANELS.MESSAGES);
|
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.FOCUS_PANEL, PANELS.MESSAGES);
|
||||||
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.SET_CONNECTION_STATUS, CONNECTION_STATUS.TRANSACTION_STATUS_INERROR);
|
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.SET_CONNECTION_STATUS, error.response.data.data.transaction_status);
|
||||||
if (!flags.external) {
|
if (!flags.external) {
|
||||||
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.HIGHLIGHT_ERROR, parseApiError(error, true));
|
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.HIGHLIGHT_ERROR, parseApiError(error, true));
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,6 @@ class StartRunningQuery:
|
|||||||
'status': status, 'result': result,
|
'status': status, 'result': result,
|
||||||
'can_edit': can_edit, 'can_filter': can_filter,
|
'can_edit': can_edit, 'can_filter': can_filter,
|
||||||
'notifies': notifies,
|
'notifies': notifies,
|
||||||
'transaction_status': trans_status,
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -112,8 +112,7 @@ class StartRunningQueryTest(BaseTestGenerator):
|
|||||||
'not found.',
|
'not found.',
|
||||||
can_edit=False,
|
can_edit=False,
|
||||||
can_filter=False,
|
can_filter=False,
|
||||||
notifies=None,
|
notifies=None
|
||||||
transaction_status=None
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
expect_internal_server_error_called_with=None,
|
expect_internal_server_error_called_with=None,
|
||||||
|
Loading…
Reference in New Issue
Block a user