Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion web/pgadmin/tools/sqleditor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,11 @@ def check_transaction_status(trans_id, auto_comp=False):
return False, internal_server_error(errormsg=str(e)), None, None, None

if connect and conn and not conn.connected():
conn.connect()
status, errmsg = conn.connect()
if not status:
current_app.logger.error(errmsg)
return (False, internal_server_error(errormsg=str(errmsg)),
None, None, None)

return True, None, conn, trans_obj, session_obj

Expand Down Expand Up @@ -818,6 +822,9 @@ def start_view_data(trans_id):
info='DATAGRID_TRANSACTION_REQUIRED',
status=404)

if not status and error_msg and type(error_msg) is Response:
return error_msg

# get the default connection as current connection which is attached to
# trans id holds the cursor which has query result so we cannot use that
# connection to execute another query otherwise we'll lose query result.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def query_tool_connection_check(trans_id):
status, msg = conn.connect()
if not status:
current_app.logger.error(msg)
return internal_server_error(errormsg=str(msg))
return status, msg, None, None, None, None
return status, None, conn, transaction_object, session_obj, None
else:
status = False
Expand Down
5 changes: 4 additions & 1 deletion web/pgadmin/tools/sqleditor/utils/start_running_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,11 @@ def execute(self, sql, trans_id, http_session, connect=False):
from pgadmin.tools.sqleditor.utils import \
query_tool_connection_check

_, _, _, _, _, response = \
status, errmsg, _, _, _, response = \
query_tool_connection_check(trans_id)
# If database does not exist then show error msg
if not status:
result = errmsg
# This is required for asking user to enter password
# when password is not saved for the server
if response is not None:
Expand Down