In the Edit Table dialog we had two separate tabs, one for table fields
and one for table constraints. The table constraints tab showed primary
keys, unique constraint, foreign keys, and some check constraints and at
least to some extent allows editing them.
This commit moves the foreign keys to a new third tab. Even though this
adds extra UI elements I feel like this might simplify finding and
editing exactly the items you are looking for and leads to a clearer UI.
This also adds support for fully editing foreign keys in the new tab.
Previously the references table and columns could not be edited in the
constraints tab. The only feature these changes remove is converting
other constraints to or from foreign keys which again simplifies the UI
and makes it less error-prone because this is not really a meaningful
thing to do.
SQLite 3.39.0 introduced expressions of these forms:
expr IS DISTINCT FROM expr
expr IS NOT DISTINCT FROM expr
Since these can be used in indexes and check expression, we need need to
add support for these expressions to the SQL parser.
- Do not hide the title bar if the dock is floating when the second one is
closed.
- Fix the number of docs for hiding the title bar when it is opened.
Related to issue #2283.
This saves space and avoids redundancy in the different places where the
table name appears.
A new toolbar button for adding a new dock is included, so the
functionality is still visible (it might be more discoverable now, indeed).
Related to issue #2283.
See comment in:
https://github.com/sqlitebrowser/sqlitebrowser/issues/2918#issuecomment-1003108299
New check option in the contextual menu of the DB schema dock to allow
drag & drop of SELECT queries, provided that only a table or fields of
the same table are dragged from the DB Schema tree.
If there is no SQL tab in the project (cannot reproduce that any longer,
only after manual editing of the project file), the first query and
selection of a column index greater than the number of columns in the
default table browsed in the Data Browser will cause a crash, because
m_currentTabTableModel will still be associated to the table in the
Data Browser main tab.
Remaining detected case for a potential data loss in the cell editor have
been fixed:
- Switching to another main tab.
- Start a filter.
In both cases a dialog for saving or discarding is open.
Additionally, the cell editor shows the cell coordinates currently open.
And the NULL text in margin is reset when the user types in the editor.
See issue #2488
This happened only for the custom dark/light styles.
The new connects fixes the issue for me. This was discovered by trial and
error, because I don't know what is really causing the problem (seems
some bug relating with event ordering and maybe a race condition).
Second change is irrelevant for the issue, just for optimization of the
loop.
See comment:
https://github.com/sqlitebrowser/sqlitebrowser/issues/2558#issuecomment-1003773910
Also use this option in the AppImage workflow to make sure to actually
include the intended version of SQLite.
Note this probably only works fine on Unix-like systems.
Updated the required package list to build successfully on recent Ubuntu / Debian versions - `qt5-default` was removed in the `qtbase-opensource-src` source package in Debian's version `5.15.1+dfsg-2`.
This downloads and build SQLite from source, currently using version
3.38.5, for building the AppImage file. This way we can include a more
recent version of SQLite instead of shipping the version from Ubuntu
20.04.
See issue #3064.
If there is a record in the sqlite_sequence table for a table we want to
insert into, use that sequence value to generate the next primary key
instead of using the maximum value plus one.
See issue #3026.
This fixes indexed columns as e.g. used in primary key constraints which
are quoted using single quotes. Because you would never index a string
literal it is safe to assume that text in single quotes actually is a
column identifier.
See issue #3047.
This adds a enum of table constraint types to the Edit Table dialog
instead of reusing the enum provided by the sqlb::Constraint class. This
way changes to the sqlb namespace do not affect the Edit Table dialog as
much and in the long term I would like to get rid of the enum in the
sqlb::Constraint class anyway.
* Include CMAKE_CURRENT_BINARY_DIR for version.h file in winapp.rc.
Because version.h is now generated by cmake and put in build dir.
* Quote default BUILD_VERSION value, else windres shows syntax error.
This is a long overdue continuation of some previous refactoring effort.
Before this we used to store the columns a table constraint belongs to
within the constraint object itself. So for example, a foreign key
constraint object would store the referencing as well as the referenced
column names. While initially simple, this approach has the downside of
duplicating certain data, thus breaking ownership and complicating
matters later on. This becomes obvious when renaming the referencing
column. The column name clearly is a feature of the table but in the
previous approach it also needs to be changed in the foreign key object
as well as in any other constraint for this field even though the
constraint itself has not been touched. This illustrates how a
constraint is not only a property of a table but the field names (a
property of the table) are also a property of the constraint, creating a
circular ownership. This makes the code hard to maintain. It also
invalidates references to constraints in the program needlessly, e.g.
when only changing a column name.
With this commit the column names are removed from the constraint types.
Instead they are now solely a property of the table. This, however,
raised another issue. For unique constraints and primary keys it is
possible to use expressions and/or sorted keys whereas for foreign keys
this is not possible. Additionally check constraints have no columns at
all. So when not storing the used columns inside the constraint objects
we need to have different storage types for each of them. So in a second
step this commit moves the code from a single data structure for storing
all table constraints to three data structures, one for PK and unique,
one for foreign keys, and one for check constraints.
By doing all this, this commit also changes the interface for handling
quite a bit. The new interface tends to use more explicit types which
makes the usage code easier to read.
Please note that this is still far from finished. But future development
on this should be a lot easier now.
Clean some bad (deprecated) SVG properties, so Qt stop complaints
:/icons/foreground_color:1:1594: Could not parse node: radialGradient
:/icons/foreground_color:1:2684: Could not resolve property: #h
:/icons/background_color:61:31: Could not parse node: radialGradient
:/icons/background_color:86:6: Could not resolve property: #white
Now SqliteTableModel::finishedFetch is active only for row count.
SqlExecutionArea should display proper value for "row count", not
"Prefetch Block Size" when "actual row count" > "Prefetch Block Size"
This should fix#2595
Because the header of the rowid column would be "Field1,Field2" in the
case of a table with multiple foreign key columns and there is no field
with that name in the table, the application crashed when not checking
for unknown field names.
This restores the original state of each of the SQL "tabs". If the tab was
opened without a file, the content is saved in the project file itself
(unmodified); when the tab was opened from a file, the reference to the
file is stored in the project file and the contents are restored from
that disk file when loading the project.
See issues #2834, #2972, #2959