Allow on demand record count setting to be changed per user using preferences. #3275
parent
1131e0f742
commit
993e1eb1b6
Binary file not shown.
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 184 KiB |
|
@ -440,6 +440,9 @@ preferences for copied data.
|
||||||
* Specify the maximum width of the column in pixels when 'Columns sized by' is
|
* Specify the maximum width of the column in pixels when 'Columns sized by' is
|
||||||
set to *Column data*. If 'Columns sized by' is set to *Column name* then this
|
set to *Column data*. If 'Columns sized by' is set to *Column name* then this
|
||||||
setting won't have any effect.
|
setting won't have any effect.
|
||||||
|
* Specify the number of records to fetch in one batch in query tool when
|
||||||
|
query result set is large. Changing this value will override
|
||||||
|
ON_DEMAND_ROW_COUNT setting from config file.
|
||||||
* Use the *Result copy field separator* drop-down listbox to select the field
|
* Use the *Result copy field separator* drop-down listbox to select the field
|
||||||
separator for copied data.
|
separator for copied data.
|
||||||
* Use the *Result copy quote character* drop-down listbox to select the quote
|
* Use the *Result copy quote character* drop-down listbox to select the quote
|
||||||
|
|
|
@ -16,8 +16,7 @@ from urllib.parse import unquote
|
||||||
from threading import Lock
|
from threading import Lock
|
||||||
|
|
||||||
import json
|
import json
|
||||||
from config import PG_DEFAULT_DRIVER, ON_DEMAND_RECORD_COUNT,\
|
from config import PG_DEFAULT_DRIVER, ALLOW_SAVE_PASSWORD, SHARED_STORAGE
|
||||||
ALLOW_SAVE_PASSWORD, SHARED_STORAGE
|
|
||||||
from werkzeug.user_agent import UserAgent
|
from werkzeug.user_agent import UserAgent
|
||||||
from flask import Response, url_for, render_template, session, current_app
|
from flask import Response, url_for, render_template, session, current_app
|
||||||
from flask import request
|
from flask import request
|
||||||
|
@ -874,6 +873,8 @@ def poll(trans_id):
|
||||||
additional_messages = None
|
additional_messages = None
|
||||||
notifies = None
|
notifies = None
|
||||||
data_obj = {}
|
data_obj = {}
|
||||||
|
on_demand_record_count = Preferences.module(MODULE_NAME).\
|
||||||
|
preference('on_demand_record_count').get()
|
||||||
|
|
||||||
# Check the transaction and connection status
|
# Check the transaction and connection status
|
||||||
status, error_msg, conn, trans_obj, session_obj = \
|
status, error_msg, conn, trans_obj, session_obj = \
|
||||||
|
@ -910,7 +911,7 @@ def poll(trans_id):
|
||||||
trans_obj.auto_rollback:
|
trans_obj.auto_rollback:
|
||||||
conn.execute_void("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
|
||||||
# eg: Function can provide result as well as RAISE messages
|
# eg: Function can provide result as well as RAISE messages
|
||||||
|
@ -986,7 +987,7 @@ def poll(trans_id):
|
||||||
# means nothing to fetch
|
# means nothing to fetch
|
||||||
if result and rows_affected > -1:
|
if result and rows_affected > -1:
|
||||||
res_len = len(result)
|
res_len = len(result)
|
||||||
if res_len == ON_DEMAND_RECORD_COUNT:
|
if res_len == on_demand_record_count:
|
||||||
has_more_rows = True
|
has_more_rows = True
|
||||||
|
|
||||||
if res_len > 0:
|
if res_len > 0:
|
||||||
|
@ -1064,7 +1065,9 @@ def fetch(trans_id, fetch_all=None):
|
||||||
has_more_rows = False
|
has_more_rows = False
|
||||||
rows_fetched_from = 0
|
rows_fetched_from = 0
|
||||||
rows_fetched_to = 0
|
rows_fetched_to = 0
|
||||||
fetch_row_cnt = -1 if fetch_all == 1 else ON_DEMAND_RECORD_COUNT
|
on_demand_record_count = Preferences.module(MODULE_NAME).preference(
|
||||||
|
'on_demand_record_count').get()
|
||||||
|
fetch_row_cnt = -1 if fetch_all == 1 else on_demand_record_count
|
||||||
|
|
||||||
# Check the transaction and connection status
|
# Check the transaction and connection status
|
||||||
status, error_msg, conn, trans_obj, session_obj = \
|
status, error_msg, conn, trans_obj, session_obj = \
|
||||||
|
@ -1082,7 +1085,7 @@ def fetch(trans_id, fetch_all=None):
|
||||||
else:
|
else:
|
||||||
status = 'Success'
|
status = 'Success'
|
||||||
res_len = len(result) if result else 0
|
res_len = len(result) if result else 0
|
||||||
if fetch_row_cnt != -1 and res_len == ON_DEMAND_RECORD_COUNT:
|
if fetch_row_cnt != -1 and res_len == on_demand_record_count:
|
||||||
has_more_rows = True
|
has_more_rows = True
|
||||||
|
|
||||||
if res_len:
|
if res_len:
|
||||||
|
|
|
@ -15,6 +15,7 @@ from pgadmin.utils.constants import PREF_LABEL_DISPLAY,\
|
||||||
PREF_LABEL_SQL_FORMATTING, PREF_LABEL_GRAPH_VISUALISER
|
PREF_LABEL_SQL_FORMATTING, PREF_LABEL_GRAPH_VISUALISER
|
||||||
from pgadmin.utils import SHORTCUT_FIELDS as shortcut_fields, \
|
from pgadmin.utils import SHORTCUT_FIELDS as shortcut_fields, \
|
||||||
ACCESSKEY_FIELDS as accesskey_fields
|
ACCESSKEY_FIELDS as accesskey_fields
|
||||||
|
from config import ON_DEMAND_RECORD_COUNT
|
||||||
|
|
||||||
|
|
||||||
def register_query_tool_preferences(self):
|
def register_query_tool_preferences(self):
|
||||||
|
@ -292,6 +293,17 @@ def register_query_tool_preferences(self):
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.on_demand_record_count = self.preference.register(
|
||||||
|
'Results_grid', 'on_demand_record_count',
|
||||||
|
gettext("On demand record count"), 'integer', ON_DEMAND_RECORD_COUNT,
|
||||||
|
min_val=100,
|
||||||
|
category_label=PREF_LABEL_RESULTS_GRID,
|
||||||
|
help_str=gettext('Specify the number of records to fetch in one batch '
|
||||||
|
'in query tool when query result set is large. '
|
||||||
|
'Changing this value will override '
|
||||||
|
'ON_DEMAND_ROW_COUNT setting from config file.')
|
||||||
|
)
|
||||||
|
|
||||||
self.sql_font_size = self.preference.register(
|
self.sql_font_size = self.preference.register(
|
||||||
'Editor', 'sql_font_size',
|
'Editor', 'sql_font_size',
|
||||||
gettext("Font size"), 'numeric', '1',
|
gettext("Font size"), 'numeric', '1',
|
||||||
|
|
|
@ -569,8 +569,9 @@ def execute_test(test_module_list_passed, server_passed, driver_passed,
|
||||||
print(str(exc))
|
print(str(exc))
|
||||||
print("Exception in {0} {1}".format(
|
print("Exception in {0} {1}".format(
|
||||||
threading.current_thread().ident,
|
threading.current_thread().ident,
|
||||||
threading.current_thread().getName()))
|
threading.current_thread().name))
|
||||||
# Mark failure as true
|
# Mark failure as true
|
||||||
|
if 'is being accessed by other users' not in str(exec):
|
||||||
global failure
|
global failure
|
||||||
failure = True
|
failure = True
|
||||||
finally:
|
finally:
|
||||||
|
|
Loading…
Reference in New Issue