Add printing support for QScintilla widgets (SQL, JSON and XML). It can be
access through the contextual menu, shortcut (Ctrl+P) or (in the case of
the "Execute SQL" tab) from a button in the toolbar.
Ctrl+P was previously assigned to Plot Dock since
63c338c359 but, as it was foreseen in that
commit, it should be assign to print is ever supported. This change must
be mentioned in release notes.
First part of printing support. See issue #1525.
For binary data, the file save dialog allows to select text files. When
the user saves to a text file (*.txt) the visual representation of the
hex buffer is saved to the file (addresses, hexadecimal bytes and ASCII
view). In this dump, only US-ASCII seems to be considered printable, while
in screen, Latin-1 is also considered.
This was one of the enhancement suggestions in issue #1438.
This reorders the filters in the import file dialog of the Edit Cell dock
so the first entry is always in accordance to the currently selected mode.
This will also facilitate the translation of the filters, because the
translations can be reused and written without special syntax characters
(";;").
"%1 Image" is also used instead of a concatenation, because the word
order in translations will vary.
New entry under Help menu for requesting issues with the same template
used for a New Issue inside GitHub.
The "Bug Report..." entry has also been updated for adding the
corresponding template body.
Separators added in Help menu, since there are currently several different
options.
See related issue #1497
Two new options editable from a new context menu of the dock:
- Drag & Drop Qualified Names: add table name to fields and schema name
to other objects (except for "main" schema)
- Drag & Drop Enquoted Names: whether to surround the identifiers by the
configured quoting characters for identifiers.
Support for dragging & dropping of attached databases names.
Add "." as separator for multiple dropped objects other than fields (since
they are not usually used in SQL as a list). This allows to compose
qualified names by dropping the parent and the child items together. This
is only generally useful when the "Qualified Names" option is disabled.
See related issue #1433
The quotes around identifiers was hindering the automatic proposal of
fields when the table is completed or of tables when the schema name is
completed. By adding the dot surrounded by quotes (parent's end-quote and child's
begin-quote) as word separator, the child completion menu is activated
when the user presses the child's begin-quote.
See related issue #1433
According to Qt documentation:
When writing, the end-of-line terminators are translated to the local
encoding, for example '\r\n' for Win32.
Reported in issue #1502
This commit refactors vast parts of the sqlitetypes.h interface. Its
main goals are: less code, easier code, a more modern interface, reduced
likelihood for strange errors and more flexibility for future
extensions.
The main reason why the sqlitetypes.h functions were working so well in
DB4S was not because they were that stable but because they were
extremely interlinked with the rest of the code. This is fine because we
do not plan to ship them as a separate library. But it makes it hard to
find the obvious spot to fix an issue or to put a new function. It can
always be done in the sqlitetypes function or in the rest of the DB4S
code because it is just not clear what the interface between the two
should look like. This is supposed to be improved by this commit. One
main thing here is to make ownership of objects a bit clearer.
In theory the new code should be faster too but that difference will be
neglectable from a user POV.
This commit also fixes a hidden bug which caused all table constraints
to be removed in the Edit Table dialog when a single field was removed
from the table.
This is all still WIP and more work is needed to be done here.
In the Preferences dialog we allow the user to configure a list of
SQLite extensions which should be loaded whenever a new database file is
create or an existing database file is loaded. This commit changes the
order of actions after creating or opening a file so that the extensions
are loaded significantly earlier. This way they are already loaded for
most of the time during the process.
This fixes some subtle bugs. One of the more prominent ones was
triggered when there is a view which uses some function which is
defined in such an extension. After loading the file, parsing would fail
and you couldn't see the fields of the view. Browsing it would work but
trying to edit the display format crashed the application.
Ctrl+' is used by spreadsheets for copying formula/value from the cell
above.
Our shortcut copies the value inside the inline editor when it is text.
That mimics the behaviour of LibreOffice Calc. For binary data that cannot
be edited inline, the BLOB is just copied from the above cell to the
current one.
See discussion in PR #1516.
The temp_store, wal_autocheckpoint and synchronous PRAGMAs are only
stored for the current database connection but not saved in the database
file. So to fully restore the working environment after closing a
database, this commit adds these three PRAGMAs to the project file
format.
See issue #1518.
Changing the auto_vacuum PRAGMA requires us to run VACUUM most of the
time. So to be safe we just do that for every change to the PRAGMA now.
See issue #1518.
After editing a table we perform a foreign key check to see if the
modifications caused any problems. This check doesn't seem to work
because it expected that in case of a problem the PRAGMA would fail.
This however isn't the case - it just doesn't return any results but it
doesn't fail. This commit fixes the check and only shows rolls back if
the PRAGMA returned any data.
When importing an SQL file, defer foreign keys until the import is
finished. This is necessary if there are foreign key constraints in the
imported table and the order of the INSERT statements doesn't match the
hierarchy of the constraints.
Also perform an integrity check at the end of the import.
See issue #1519.
This commit fixed wrong error messages in the code we use whenever
multiple SQL statements are executed at once programmatically, most
noticeably in the SQL import. In the case of an error we would first
clean up and rollback and only then recover the error message which
usually would be lost by then. With the changes in this commit the first
thing we do is to recover the error message and only then clean up.
See issue #1519.
If the deletion of a record is rejected by the SQLite3, for example, due to
the presence of Foreign Key constraints, the corresponding rows must not
be deleted from the model.
* Issue #530: constraints on table prevents new record being added
This adds a new dialog for adding records to a table. The current approach
is broken for several cases where foreign keys and check constraints are
impeding the insertion of an empty record. With the dialog, the user can
inspect the constraints (tooltip) and type of fields and add values
consistent with the requirements. The data is only inserted when the user
presses the Save button.
The dialog is modelled after the Edit Table or Edit Index dialog. An upper
frame allows entering the data using widgets. The lower frame previews the
SQL statement that will be used.
The old approach for adding records is still accessible pressing Tab on
the last cell of the table.
* Fix build problem introduced in previous commit on this branch
* Dialog as fallback for failure after empty row insertion and read only text
The insertion of an empty row is always tried. When it fails due to
constraints and foreign keys, the Add Record Dialog is open so the user
can enter values for the new record considering the constraints.
When the table has not constraints, or the row insertion provides valid
values, the user is still able to insert rows using the simple approach.
SQL preview in dialog is now read-only.
* Visual improvements for the Add Record dialog
QLineEdit as item delegate for the value, so it is more visible that we
are supposed to edit the value.
Remove last end-of-line in tool-tip.
* Improvements in the "Add Record" dialog
Display of NULL values using DisplayRole (no focus) or place holder text
(when focus).
Set value to NULL through a context menu and shortcut in the value line
edit.
Take text type affinity into account for quoting or not entered numbers.
New isType and affinity functions in sqlitetypes.
Clarify wording of constraints in tooltip for value. Added the same tooltip
for the type.
Escape quotes inside string values.
Removed unused parameters warnings.
Other wording or code improvements based on the pull-request review: #1477.
* User access to the Add Record dialog
The Add Record dialog is now accessible for the user. The New Record button
is converted to a QToolButton and a new pop-up menu is added to it for
invoking the in-line table insertion (New Record) or the Add Record dialog
(Insert Values...). What's This information for the button updated.
The plot and all plot settings disappear when you click the Refresh
button in the Browse Data tab. This problem was introduced in the
multithreading patch.
Since PR #1436 we allow configuration of the identifier quotes instead
of always using backticks. But in the code for detecting a custom
display format on a column the assumption still was that normal columns
without a custom display format are always surrounded in backticks. The
result of this was that even if there is only a single display format
configured for a table, no field of no column can be edited anymore.
This commit restores the original state which would only disable editing
for the columns with a custom display format.
This is required for Qt version < 5.10. For Qt versions >= 5.10 the
unhiding of all columns before rehiding the desired ones does nothing
because there the table view doesn't store its state anymore. And when
it does nothing we don't change the state of our view settings which in
turn triggers the mentioned problem.
See issue #1475.
SQLCipher reports in its SQLITE_VERSION macro the version of the
underlying SQLite version. Because we cannot easily get any other
version from SQLCipher and because the reported version is not identical
to the SQLCipher version we need to rephrase the wording in the dialog a
bit to keep the two versions separated.
See issue #1474.
When exporting a database to an SQL file we need to query the row count
of each table to calculate the progress later in the actual export. This
commit replaces the SqliteTableModel class which was used for this
purpose by a simple query function. This might be slightly faster here
but more importantly avoids a progress window being shown for each table
before finally seeing the one for the actual export.
See issue #1476.
We have already fixed the rowid column from appearing after almost every
action in the Browse Data tab, for example in commit
39302f5b60.
This didn't fix every issue related to this problem though. Hidden
columns are shown too and modified column widths are reset. Also this
happens for different actions, for example the column widths are also
reset when sorting the view or when changing the filters. All these
problems are hopefully fixed by this commit.
See issue #1475.
Change the control of the page_size PRAGMA from a spin box to a combo
box in the Edit Pragma tab. This makes sure no values are entered which
aren't a power of two. The same change was done in the Cipher dialog a
while ago for the same reasons.
When loading a project file which changes the foreign_keys or the
case_sensitive_like PRAGMAs while being in the Edit Pragma tab didn't
update the UI accordingly. Only after changing the tab and returning to
the Edit Pragma tab updated the controls.
We allow the user to edit the case_senstive_like PRAGMA via the UI. But
because its state is not saved in the database - just like with the
foreign_key PRAGMA - we should save it in the project file for users who
want to restore the entire environment.
* Allow "getting" and setting case_sensitive_like pragma
In order to allow case insensitive filtering, the pragma
case_sensitive_like is added to the GUI. Given that this pragma cannot be
read, a special SELECT request is made in DBBrowserDB::getPragma for
inferring its value.
See issue #1489.
* Warning in the pragma case_sensitive_like
This pragma has some peculiarities, so it is convenient to warn the user
about it through a tool-tip in the value.
Our procedure for editing tables may involve a drop of the old table
definition. This will trigger the "ON DELETE CASCADE" clauses of the
child tables, leading to unexpected and silent data loss.
Following the procedure described in:
https://www.sqlite.org/lang_altertable.html
we can guarantee that no data is deleted, but at the cost of opening a
new transaction specific for the table modification. The possible pending
changes must be saved before. This is only done when the foreign_keys
pragma is enabled.
See issue #1481
Menu actions that take the user to a dialog, where the action is completed
with some interaction and that could be cancelled, now have ellipsis.
Actions that only open an informative window do no longer have ellipsis.
Title case used in all menu entries.
See issue #1434
- Some actions not directly related to file operations over databases or
projects have been moved from "File" to a new "Tools" top-level menu entry.
Future tools can be added here.
- Preferences moved from "View" to "Edit" (MacOS is supposed to still have
it in the application menu).
See issue #1434
This disables translation for PRAGMA names and values in the Edit Pragma
tab. The values must not be translated when using the current
implementation because they are used as shown for reading and writing
the PRAGMA values. The names could be translated but probably should not
be because they are more fixed name than description of their function.
See issue #1489.
The translation of key sequences must be empty or follow the official Qt
translated names, otherwise the key sequence is not recognised and it will
not work.
The official translation for Shift key is "May" (not "Mayús" or "Mayús.")
See possibly related issue #1491