Skip to content

Commit

Permalink
#4005 The limit of rows number applied for results with lots of colum…
Browse files Browse the repository at this point in the history
…ns can now be disabled in options.
  • Loading branch information
pawelsalawa committed Mar 4, 2021
1 parent b7bc3b1 commit 3cb43b3
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 40 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# ChangeLog

### 3.3.1
- CHANGE: #4005 The limit of rows number applied for results with lots of columns can now be disabled in options.
- BUGFIX: #3996 Fixed SQL formatter to not remove the ' from strings.
- BUGFIX: #3998 Foreign Key dropdown behavior fixed to allow custom values.
- BUGFIX: #3987 Further enhancements to HighDPI scaling support.
Expand Down
4 changes: 2 additions & 2 deletions SQLiteStudio3/guiSQLiteStudio/datagrid/sqlquerymodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,7 @@ bool SqlQueryModel::readColumns()
// Rows limit to avoid out of memory problems
columnRatioBasedRowLimit = -1;
int rowsPerPage = getRowsPerPage();
if (!columns.isEmpty())
if (!columns.isEmpty() && CFG_UI.General.LimitRowsForManyColumns.get())
columnRatioBasedRowLimit = 50000 / columns.size();

bool rowsLimited = (columnRatioBasedRowLimit > -1 && columnRatioBasedRowLimit < rowsPerPage);
Expand Down Expand Up @@ -1770,7 +1770,7 @@ int SqlQueryModel::getRowsPerPage() const
if (hardRowLimit > -1)
rowsPerPage = hardRowLimit;

if (columnRatioBasedRowLimit > -1 && columnRatioBasedRowLimit < rowsPerPage)
if (CFG_UI.General.LimitRowsForManyColumns.get() && columnRatioBasedRowLimit > -1 && columnRatioBasedRowLimit < rowsPerPage)
rowsPerPage = columnRatioBasedRowLimit;

return rowsPerPage;
Expand Down
89 changes: 51 additions & 38 deletions SQLiteStudio3/guiSQLiteStudio/dialogs/configdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
</sizepolicy>
</property>
<property name="currentIndex">
<number>3</number>
<number>1</number>
</property>
<widget class="QWidget" name="databaseListPage">
<layout class="QVBoxLayout" name="verticalLayout_36">
Expand Down Expand Up @@ -395,8 +395,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>366</width>
<height>515</height>
<width>564</width>
<height>540</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_34">
Expand All @@ -406,29 +406,6 @@
<string>Data browsing and editing</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="toolTip">
<string>&lt;p&gt;Maximum number of configurations of Populate Table dialog stored in configuration. Value of 100 should be sufficient.&lt;/p&gt;</string>
</property>
<property name="text">
<string>Number of memorized table populating configurations</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QSpinBox" name="spinBox">
<property name="toolTip">
<string>&lt;p&gt;Maximum number of configurations of Populate Table dialog stored in configuration. Value of 100 should be sufficient.&lt;/p&gt;</string>
</property>
<property name="maximum">
<number>999999</number>
</property>
<property name="cfg" stdset="0">
<string notr="true">General.PopulateHistorySize</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QSpinBox" name="rowsPerPageSpin">
<property name="maximumSize">
Expand All @@ -448,7 +425,7 @@
</property>
</widget>
</item>
<item row="1" column="2">
<item row="2" column="2">
<widget class="QSpinBox" name="initColWidthLimitSpin">
<property name="toolTip">
<string>&lt;p&gt;When the data is read into grid view columns width is automatically adjusted. This value limits the initial width for the adjustment, but user can still resize the column manually over this limit.&lt;/p&gt;</string>
Expand All @@ -467,7 +444,14 @@
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="rowsPerPageLabel">
<property name="text">
<string>Number of data rows per page:</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="initColWidthLimitLabel">
<property name="toolTip">
<string>&lt;p&gt;When the data is read into grid view columns width is automatically adjusted. This value limits the initial width for the adjustment, but user can still resize the column manually over this limit.&lt;/p&gt;</string>
Expand All @@ -477,14 +461,43 @@
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="rowsPerPageLabel">
<item row="6" column="0" colspan="3">
<widget class="QCheckBox" name="useDefaultForNullCheck">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enable this to always enforce DEFAULT value when committing a NULL value for a column that has DEFAULT value defined, even though the column is allowed to contain NULL values.&lt;/p&gt;&lt;p&gt;Disable this option to use DEFAULT value exclusively when NULL value is committed for column with NOT NULL constraint.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Number of data rows per page:</string>
<string>Use DEFAULT value (if defined), when committing NULL value</string>
</property>
<property name="cfg" stdset="0">
<string notr="true">General.UseDefaultValueForNull</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QSpinBox" name="spinBox">
<property name="toolTip">
<string>&lt;p&gt;Maximum number of configurations of Populate Table dialog stored in configuration. Value of 100 should be sufficient.&lt;/p&gt;</string>
</property>
<property name="maximum">
<number>999999</number>
</property>
<property name="cfg" stdset="0">
<string notr="true">General.PopulateHistorySize</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="toolTip">
<string>&lt;p&gt;Maximum number of configurations of Populate Table dialog stored in configuration. Value of 100 should be sufficient.&lt;/p&gt;</string>
</property>
<property name="text">
<string>Number of memorized table populating configurations</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="tolltipInDataViewCheck">
<property name="toolTip">
<string>&lt;p&gt;When this is enabled and user holds mouse pointer over a cell in any data view (query results, a table data, a view data) a tooltip will appear with details about the cell - it includes details like column data type, constraints, ROWID and others.&lt;/p&gt;</string>
Expand All @@ -497,7 +510,7 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<item row="5" column="0" colspan="3">
<widget class="QCheckBox" name="keepNullWhenEmptyCheck">
<property name="toolTip">
<string>&lt;p&gt;When editing a cell which used to have NULL value and entering empty string as new value, then this option determinates whether the new value should remain NULL (have this option enabled), or should it be overwritten with empty string value (have this option disabled).&lt;/p&gt;</string>
Expand All @@ -510,16 +523,16 @@
</property>
</widget>
</item>
<item row="5" column="0" colspan="3">
<widget class="QCheckBox" name="useDefaultForNullCheck">
<item row="1" column="0" colspan="3">
<widget class="QCheckBox" name="checkBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enable this to always enforce DEFAULT value when committing a NULL value for a column that has DEFAULT value defined, even though the column is allowed to contain NULL values.&lt;/p&gt;&lt;p&gt;Disable this option to use DEFAULT value exclusively when NULL value is committed for column with NOT NULL constraint.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If query results contain dozens (or hundreds) of columns, it is more likely that it will exhaust free memory of your computer by loading several gigabytes of data at once. SQLiteStudio may try to limit number of results displayed on one page in such cases to protect your computer. If you know that you don't work with big values in database, you can disable this limit and you will always see as many rows as defined per page.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Use DEFAULT value (if defined), when committing NULL value</string>
<string>Limit number of rows for in case of dozens of columns</string>
</property>
<property name="cfg" stdset="0">
<string notr="true">General.UseDefaultValueForNull</string>
<string>General.LimitRowsForManyColumns</string>
</property>
</widget>
</item>
Expand Down
1 change: 1 addition & 0 deletions SQLiteStudio3/guiSQLiteStudio/uiconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ CFG_CATEGORIES(Ui,
CFG_ENTRY(bool, ShowRegularTableLabels, false)
CFG_ENTRY(bool, ShowVirtualTableLabels, true)
CFG_ENTRY(int, NumberOfRowsPerPage, 1000)
CFG_ENTRY(bool, LimitRowsForManyColumns, true)
CFG_ENTRY(QString, Style, &Cfg::getStyleDefaultValue)
CFG_ENTRY(Cfg::Session, Session, Cfg::Session())
CFG_ENTRY(bool, AllowMultipleSessions, false)
Expand Down

0 comments on commit 3cb43b3

Please sign in to comment.