When browsing a view we were constructing a query which looked like
this because the rowid column was empty:
SELECT "",* FROM "view_name";
This worked because there isn't really any rowid column for views anyway
and SQLite was interpreting the first bit as an empty string literal.
However using double quotes for string literals triggers a warning in
the error log. This commit aims to avoid this warning.
headerData() now returns column name plus sort indicator in the display
role and only the column name in the edit role. This allows to use the
edit role for the plot and the copy-with-headers features, so they do not
show the sort indicator as part of the column name.
See related issue #1409 and PR #1810
Flickering was produced in the table header, due to the fact that the
the filter boxes were displayed first at the rightmost side while the
table is reset and then they are repainted when the rows appear, in order
to leave space to the vertical header with the row numbers.
Setting the minimum width of the vertical header to the current width
before any filtering or sorting avoids the issue. The minimum width is
set to the default when changing the current table.
See issues #1763 and #1941
When modifying the value of a field in the Browse Data tab, we used to
always hand over the new value to SQLite as text. This works most of the
time but can cause problems e.g. when a CHECK constraint checks the data
type of the value and expects something other than text. It is also a
pretty lazy approach in general.
This commit checks if the new value matches the affinity data type of
the column, and if it does hands over the new value as the correct data
type.
See issue #1952.
Enable the combo box in the Edit Table dialog to change the type of a
table constraint and add the code to try to transform a constraint from
one type into another as best as possible.
This changes the way we store the constraints associated with a table
from using a map to using a set. The map was mapping from the list of
field names to the constraint applied on these fields. Now the field
list is stored inside the constraint and we can store the constraints in
a simple set. This turns out to simplify the code noticeably.
This adds support for modifying the columns a constraint is applied on
in the Constraints tab of the Edit Table dialog. This is a major step
towards full constraint editing capabilities (adding new constraints,
modifying constraint type, and editing constraint type-dependent
parameters are the other missing pieces).
The reasoning behind the popup dialog is to not introduce another full
dialog on top of the Edit Table dialog. After opening the Edit Table
dialog, then switching to the Constraints tab, then opening another
modal dialog, I felt like losing track of what I am currently editing.
The popup dialog is certainly not great but feels a bit less intrusive.
Any suggestions regarding this are appreciated.
This adds support for searching "this|that" to find either "this" or "that"
or using quantifiers like "{number}". The change applies to the
Find/Replace dialog and the search bar.
See https://en.cppreference.com/w/cpp/regex/ecmascript for details of the
syntax.
This raises the requirement for an external version of QScintilla to v2.11.
See issue #1625
This adds support for changing the names of existing constraints in the
Edit Table dialog. It should be possible to extend the code to allow
further modifications of the constraints.
As a minor change, this commit makes the SQL column of the constraints
table read only.
When opening a file in read-only mode, remember that read-only flag when
adding it to the list of recently opened files. The next time it is
opened it will be again in read-only mode.
The way this is implemented (by adding a "[ro]" to the start of the path
to indicate when to open in read-only mode) was chosen in order to be
fully backwards compatible with the previous data format for the file
list.
See issue #1913.
Fix a crash when using the "Browse Table" action in the right click menu
in the Database Structure tab. It crashed whenever the table name or the
schema name started or ended with a space character.
When detecting the data type in the Edit Cell dialog, don't treat
simple numbers as a JSON document. They should be handled as text
instead.
Thanks to @mgrojo for pointing this out here.
d344f396b2 (r34132706)
A second Ctrl+Click over an already added column changes the direction of
any column.
Before this change, the effect was only applied to the last selected column
and a second Ctrl+Click on the other columns triggered a requery without
having changed anything.
This was mentioned in PR #1810. See also issue #1761.
Qt's isRightToLeft() returns true only for all left-to-right characters
in the string. That prevents the automatic switch to LTR Text mode, when
the text contains one or more left-to-right characters.
See #1793 and #1929
This restores the Qt text widget that was replaced by a QScintilla one in
45c1e2abfd
QScintilla does not support right-to-left scripts like Arabic, so QTextEdit
is still needed for these languages. Since the QScintilla editor has other
advantages already explained, it is preserved for general text edition.
RTL texts are detected when data is loaded and the Qt editor is
automatically selected. This is done both when loading data from the cell
and when interactively typing RTL characters in the Cell Editor.
All these changes can be undone if a new QScintilla editor supports RTL
texts.
See comments in issue #1793
Always send the fetched() signal when a RowLoader thread has finished a
fetch task. Before this the signal was only sent when some data was
actually retrieved from the task. This fixes some rare problems in the
Execute SQL tab where the query for determining the row count of a
SELECT statement changes something, so the subsequent row loading task
does not return any rows after all.
The only case I know of is when loading an extension using the
'SELECT load_extension()' function. The load_extension function is
actually called twice when SQLite for some reason reports that rows
where returned from this statement. These calls are:
SELECT COUNT(*) FROM (SELECT load_extension('...'));
SELECT load_extension('...');
After the first call is executed, the extension is loaded. So the second
call does not return any rows and we indefinitely wait for the rows we
expect. Strangely enough this only happens for some extensions.
The change here should have no side effects becaue the signal is only
connected to one slot which skips most steps when no rows where fetched.
See issue #1932.
Instead of registering the error log callback function every time a
database file is opened, we now register it only once when the
application is first started. This way we can avoid calling
sqlite_shutdown which can have unintended side effects.
See issue #1932.
While testing the original database from issue #1892 which contains
hundreds of tables and fields, I noticed how long the loading of the
database structure takes. This is especially problematic since it needs
to be reloaded on various occasions, e.g. running most statements in the
Execute SQL tab, which stalls the application every time.
According to a profiler it is the QIcon constructor which requires most
of the time. By introducing this small icon cache class we can reduce
the time for loading icons to almost nothing.
While still not perfect the UI already feels much more responsive with
this patch.
Windows build script will now save, and check, the last build commit and
skip building if there are no new commits since the last automatic build.
See #1917.
Matter came up WRT #1880. In reviewing, several other instances
were found where same file filter as a string literal was repreated.
This commit centralizes these file filters to one location. Filters
are declared `static const` to prevent accidental modification.
Also applied is a fix to #1881. QMessage at end of Import CSV is removed.
From upstream source, QHexEdit is intended to be a modular widget
for Qt5. (README @ https://github.com/Simsys/qhexedit2)
Add ability for platforms that already have QHexEdit installed to
build DB4S against installed (external to DB4S) QHexEdit library.
Current version of library available is consistent with version
contained in DB4S project `libs` folder.
(see https://repology.org/project/qhexedit2/versions)
Default of CMake flag FORCE_INTERNAL_QHEXEDIT is ON (enabled) so
as to minimize impact to current development workflow and other
platforms. Using flag is left as an option to package managers.