Reverting patch for RM #3269.

We observed that sometimes the browser is getting hanged and sometimes
the ViewData grid is getting disappear. We suspect its due to the number
of rows to update on the slick grid after fetching next of rows.
This commit is contained in:
Nagesh Dhope
2020-04-24 11:13:13 +05:30
committed by Akshay Joshi
parent dfb74904ed
commit 17129b259b
3 changed files with 22 additions and 52 deletions

View File

@@ -97,7 +97,6 @@ class SqlEditorModule(PgAdminModule):
'sqleditor.query_tool_start',
'sqleditor.poll',
'sqleditor.fetch',
'sqleditor.fetch_till',
'sqleditor.fetch_all',
'sqleditor.save',
'sqleditor.inclusive_filter',
@@ -534,24 +533,18 @@ def poll(trans_id):
'/fetch/<int:trans_id>/<int:fetch_all>', methods=["GET"],
endpoint='fetch_all'
)
@blueprint.route(
'/fetch/<int:trans_id>/<int:fetch_till>', methods=["GET"],
endpoint='fetch_till'
)
@login_required
def fetch(trans_id, fetch_all=None, fetch_till=None):
def fetch(trans_id, fetch_all=None):
result = None
has_more_rows = False
rows_fetched_from = 0
rows_fetched_to = 0
fetch_row_cnt = -1 if fetch_all == 1 else ON_DEMAND_RECORD_COUNT
# Check the transaction and connection status
status, error_msg, conn, trans_obj, session_obj = \
check_transaction_status(trans_id)
fetch_row_cnt = -1 if fetch_all == 1 else ON_DEMAND_RECORD_COUNT \
if fetch_till is None else fetch_till - trans_obj.get_fetched_row_cnt()
if error_msg == gettext('Transaction ID not found in the session.'):
return make_json_response(success=0, errormsg=error_msg,
info='DATAGRID_TRANSACTION_REQUIRED',
@@ -564,6 +557,8 @@ def fetch(trans_id, fetch_all=None, fetch_till=None):
else:
status = 'Success'
res_len = len(result)
if fetch_row_cnt != -1 and res_len == ON_DEMAND_RECORD_COUNT:
has_more_rows = True
if res_len:
rows_fetched_from = trans_obj.get_fetched_row_cnt()
@@ -572,9 +567,6 @@ def fetch(trans_id, fetch_all=None, fetch_till=None):
rows_fetched_to = trans_obj.get_fetched_row_cnt()
session_obj['command_obj'] = pickle.dumps(trans_obj, -1)
update_session_grid_transaction(trans_id, session_obj)
if fetch_row_cnt != -1 and rows_fetched_to < conn.rows_affected():
has_more_rows = True
else:
status = 'NotConnected'
result = error_msg