Fixed rollback and commit button activation on execute button click. #7248

This commit is contained in:
Anil Sahoo 2024-03-27 16:38:42 +05:30 committed by GitHub
parent 8ab78dc40d
commit a02ebe192b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 16 deletions

View File

@ -950,6 +950,14 @@ def poll(trans_id):
is_thread_alive = True
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:
status = 'Busy'
messages = conn.messages()
@ -973,25 +981,19 @@ def poll(trans_id):
gettext('******* Error *******'),
result
)
transaction_status = conn.transaction_status() if conn else 0
query_len_data = {
'transaction_status': transaction_status,
'explain_query_length':
get_explain_query_length(
conn._Connection__async_cursor._query)
get_explain_query_length(
conn._Connection__async_cursor._query)
}
return internal_server_error(result, query_len_data)
elif status == ASYNC_OK:
status = 'Success'
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)
# There may be additional messages even if result is present

View File

@ -202,7 +202,6 @@ export class ResultSetUtils {
}
try {
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)) {
this.setStartData(httpMessageData.data);
@ -281,7 +280,7 @@ export class ResultSetUtils {
handlePollError(error, explainObject, flags) {
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.EXECUTION_END);
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) {
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.HIGHLIGHT_ERROR, parseApiError(error, true));
}

View File

@ -115,7 +115,6 @@ class StartRunningQuery:
'status': status, 'result': result,
'can_edit': can_edit, 'can_filter': can_filter,
'notifies': notifies,
'transaction_status': trans_status,
}
)

View File

@ -112,8 +112,7 @@ class StartRunningQueryTest(BaseTestGenerator):
'not found.',
can_edit=False,
can_filter=False,
notifies=None,
transaction_status=None
notifies=None
)
),
expect_internal_server_error_called_with=None,