Skip to content

Commit 4dd9334

Browse files
committed
Limit height of logged results table to 500 px and make it scrollable
1 parent 0291803 commit 4dd9334

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/DatabaseLibrary/query.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -869,13 +869,13 @@ def _log_query_results(self, col_names, result_rows, log_head: Optional[int] = N
869869
table_border = "2px solid rgb(140 140 140)"
870870
row_index_background_color = "#d6ecd4"
871871
row_index_text_color = "black"
872-
msg = '<div style="max-width: 100%; overflow-x: auto;">'
872+
msg = '<div style="max-width: 100%; overflow-x: auto; max-height: 500px; overflow-y: auto;">'
873873
msg += f'<table style="width: auto; border-collapse: collapse; border: {table_border}">'
874874
msg += f'<caption style="text-align: left; font-weight: bold; padding: 5px;">Query returned {len(result_rows)} rows</caption>'
875875
msg += "<tr>"
876-
msg += f'<th scope="col" style="color:{row_index_text_color}; background-color: {row_index_background_color}; {cell_border_and_align}">Row</th>'
876+
msg += f'<th scope="col" style="position: sticky; top: 0; color:{row_index_text_color}; background-color: {row_index_background_color}; {cell_border_and_align}">Row</th>'
877877
for col in col_names:
878-
msg += f'<th scope="col" style="background-color: #505050; color: #fff;{cell_border_and_align}">{col}</th>'
878+
msg += f'<th scope="col" style="position: sticky; top: 0; background-color: #505050; color: #fff;{cell_border_and_align}">{col}</th>'
879879
msg += "</tr>"
880880
table_truncated = False
881881
for i, row in enumerate(result_rows):

test/tests/common_tests/log_query_results.robot

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,10 @@ Test Teardown Drop Tables Person And Foobar
1212
Calling The Keyword Causes No Crash
1313
Set Logging Query Results enabled=False
1414
Set Logging Query Results enabled=True log_head=0
15-
Set Logging Query Results log_head=30
15+
Set Logging Query Results log_head=30
16+
17+
Check Max Height For Long Tables
18+
FOR ${id} IN RANGE 10 50
19+
Execute Sql String INSERT INTO person VALUES(${id}, 'Somebody that', 'I used to know');
20+
END
21+
Query SELECT * FROM person

0 commit comments

Comments
 (0)