Commit Graph

3565 Commits

Author SHA1 Message Date
Martin Kleusberg
50b48bc756 Avoid multiple error messages when deleting cell values
When multiple cells are selected pressing the Delete key tries to set
all of them to an empty string. In case of a unique constraint or
similar constraints this throws an error. This commit copies the
behaviour of the set to NULL menu action in that it aborts at the first
error to avoid multiple error messages.

See issue #2704.
2021-05-22 09:55:49 +02:00
Martin Kleusberg
8ffe641ae1 Fix d7074bb834
This fixes a bug introduced in d7074bb834.
It turns out we cannot treat the edited table as similar to the other
tables after all.
2021-05-22 09:44:00 +02:00
Juho Lee
4c40400001 Update Korean Translation file (#2624)
* Update Korean L10N Strings for translation

* Fix typo in Korean translation file

* Translate Korean Strings based on the latest master branch
2021-05-21 21:42:38 +02:00
Martin Kleusberg
7c1454e785 Fix possible crash when removing constraints from table definition
This fixes a possible crash when trying to remove a table constraint
from a table definition. The issue was introduced in commit
4e1d1ff49f.

See issue #2670.
2021-05-21 19:49:03 +02:00
Martin Kleusberg
d7074bb834 Show tables in foreign key editor in alphabetical order
Make sure to list the tables in the foreign key editor of the Edit Table
dialog in alphabetical order instead sorting them randomly.

See issue #2700.
2021-05-21 16:52:55 +02:00
Justin Clift
a55890f7d0 Updated currentrelease file to 3.12.2 2021-05-21 21:14:03 +10:00
Martin Kleusberg
d0f5ec5081 Remove obsolete code 2021-05-19 16:40:12 +02:00
Justin Clift
758a23e4aa Add missing Release History entries on the repo front page 2021-05-19 01:38:11 +10:00
Justin Clift
585a396285 Add a '3.12.2' option to the GitHub 'Issue: Bug Report' form 2021-05-18 10:17:24 +10:00
Justin Clift
00dd35b0e5 Updated public user app cert and docker certs 2021-05-02 23:36:04 +10:00
Manuel
f59bbf222a Merge pull request #2644 from anandsanto/master
update plotwindow's selection in tablebrowser
2021-04-27 21:28:15 +02:00
pgp
5fd2cea5da Fix typo in AboutDialog in italian translation 2021-04-24 12:05:53 +02:00
mgrojo
967780d00b Fix 'Set Encryption': don't reuse current file after closing
Otherwise db.currentFile() is empty.

See issue #2654 and discussion in #2579
2021-04-04 13:31:55 +02:00
mgrojo
2a830e5a3a Update QDarkStyleSheet to v3.0.rc and add new light style
Thanks to a new light style provided by QDarkStyleSheet in v3.0.rc
(9eea545) we can add a new light style option.

`qdarkstyle/dark/style.qrc` had to be renamed to
`qdarkstyle/dark/darkstyle.qrc` and `qdarkstyle/light/style.qrc` to
`qdarkstyle/light/lightstyle.qrc` in order to include both as resources.

See issues:
- https://github.com/ColinDuquesnoy/QDarkStyleSheet/issues/240
- https://github.com/ColinDuquesnoy/QDarkStyleSheet/issues/273
- #2558
2021-03-30 23:54:55 +02:00
mgrojo
c5199f559d Table Browser: Support extended selections
Support of extended selections (non-contiguous cell selections using
Control+Click). The following changes were necessary:

- Copy to clipboard iterates over rows and columns and leaves holes for
  non-rectangular selections as empty cells (HTML) or as NULL (SQL).
  Fix: Additionally the SQL copy uses NULL when the cell has NULL, not ''.
- Shortcuts for column and row selection take into account non-contiguous
  cells and only select those columns/rows.
- The legend in the status line counts correctly non-contiguous rows or
  columns.
- Delete Record has been adjusted so only contiguous selected cells are
  removed in a single step. Fix: selecting line after removing has been
  deleted since the standard behaviour is giving better result.
- ExtendedSelection has been enabled in TableBrowser, it was already
  enabled in Execute SQL table-widget.

Possible improvements: pasting from the internal clipboard does not keep
the layout of copied non-rectangular selections.

See issues #1104 and #2638
2021-03-26 18:40:38 +01:00
Anand N
a51d6c1074 update plotwindow's selection in tablebrowser
This is a feature that was already present but was
broken after 834e6508bf
2021-03-25 17:11:25 +05:30
mgrojo
93a5c2d0ca Import: don't assume an empty file is a text file
Since in any case, the empty file has nothing to import and it's admitted by
SQLite as a valid database, it's better to revert to the previous behaviour,
where an empty file dropped or opened by the file manager was treated as a DB
and indeed worked.

The behaviour was changed by cfa4dee3be

See issue #2636
2021-03-20 14:16:23 +01:00
mgrojo
78edc8f991 Table Browser: give hint of table sorted or filtered state in the toolbar
The Clear Filters button is enabled if and only if there is some filter
set for the browsed table.

The Clear Sorting button is enabled if and only if the table is sorted by
some column.

See issue #2616
2021-03-19 16:58:17 +01:00
mgrojo
580e86e2f9 Table Browser: "Clear Filters" button to clear the global filter
See issue #2616
2021-03-19 14:20:40 +01:00
mgrojo
035a541c5b Import: "Yes to All" to skip all further prompts
"Yes" to not be prompted next time for the same table, but yes for different
tables.

"Yes to All" to not be prompted again for any existent tables.

See issue #2633
2021-03-19 13:44:29 +01:00
mgrojo
a686b85c3a Translations: fix cmake build after Swedish inclusion
See issue #2621
2021-03-18 22:10:38 +01:00
Martin Kleusberg
f69f66cc46 Add Swedish translation
Thanks to Jan-Erik!

See issue #2621.
2021-03-16 17:25:40 +01:00
Martin Kleusberg
4e1d1ff49f Store table constraints in a vector instead of a set
This should make sure we keep the constraints in the order the parser
reads them so the output of the SQL export becomes more stable.

See issue #2627.
2021-03-16 15:19:07 +01:00
Juho Lee
fb80d3bcd1 Add auto completion for math functions (#2631)
* Add auto completion for math functions

Math functions are introduced from sqlite 3.35.
Refer https://www.sqlite.org/lang_mathfunc.html
FYI, it need to compile sqlite with -DSQLITE_ENABLE_MATH_FUNCTIONS

* Add auto completion for math function when it had been enabled

Math function can be used when sqlite is equal or higher than 3.35 and
compiled with SQLITE_ENABLE_MATH_FUNCTIONS. When sqlite is compiled with
SQLITE_OMIT_COMPILEOPTION_DIAGS, there is no way to check the compile
options. In this case, we'll check only the sqlite version. Otherwise,
it will check whether sqlite was built with SQLITE_ENABLE_MATH_FUNCTIONS.
2021-03-16 14:51:55 +01:00
Martin Kleusberg
ccb8c9ee97 Speed up removing of comments from SQL queries
This commit replaces the regular expressions for removing end of line
and block comments from SQL queries provided by the user by a hand
written state machine. This makes the code a lot faster, especially for
longer SQL scripts with many statements and many comments in them. It is
also not harder to read than the rather complex regular expressions from
before - possibly even easier to read.

See issue #2619.
2021-03-15 19:42:11 +01:00
mgrojo
a5cc259b45 Data Browser: export query results as JSON
In this case too, the corresponding menu entry for exporting the query
results to JSON was missing although it was straight forward to add it
with the same scheme as for CSV.

Renamed the CSV action for consistency.

Related to issue #2607
2021-03-12 20:51:53 +01:00
mgrojo
2826e7b989 Save as view: allow any state in the table
This check was supposed to help the user understand what this operation was for,
but it was actually preventing to save as view table states that had global
filter, display formats or custom order and not column filters. It's better to
give the user the freedom, even to create maybe useless vies as:

`CREATE VIEW "example_view" AS SELECT * FROM "main"."example"`

See issue #2615
2021-03-12 20:28:42 +01:00
Martin Kleusberg
5d80f9877d Fix running ALTER TABLE statements in Execute SQL tab
This fixes a bug introduced in 73efa11680.
Because SQLite reports ALTER TABLE statements to return one column worth
of data, DB4S assumed they are close to a SELECT statement and therefore
did not fully execute them.

See issues #2563 and #2622.
2021-03-12 19:11:52 +01:00
mgrojo
e225dc1e42 Export query results as JSON
The corresponding menu entry for exporting the query results to JSON was missing
although it was straight forward to add it with the same scheme as for CSV.

Related to issue #2607
2021-03-05 23:57:34 +01:00
mgrojo
36c5b1baf4 Import: allow CSV separator and quote to be passed from command line
Support these settings from the command line:
--option importcsv/separator=\, --option importcsv/quotecharacter=\'

Since they are stored as string, they cannot convert to QChar unless
manually converted.

See issue #2589
2021-02-28 22:05:43 +01:00
Justin Clift
d4d0c236e6 Merge pull request #2605 from Qwertie-/master
Update appdata to pass validation
2021-03-01 00:56:07 +11:00
Tobias Nießen
38cdd94e24 src: rename sqlb::Query::setColumNames 2021-02-28 09:19:42 +01:00
Luke Picciau
b553c088ef Update appdata to pass validation 2021-02-28 12:17:35 +10:30
mgrojo
248a630dd1 Import: do not remove characters from CSV header fields
This is as described in RFC-4180. See issue #2445.
2021-02-26 22:09:47 +01:00
mgrojo
efa1cdf273 Import: announce support for CSV files in Desktop file
See issue #2589
2021-02-26 22:04:16 +01:00
mgrojo
cfa4dee3be Import: support importing the single file argument as a CSV file
This will allow associating DB4S to CSV files and dropping a CSV file to be
importing into a new in-memory database, when there is no DB open yet.

See issue #2589
2021-02-21 15:12:02 +01:00
Justin Clift
d68c396f5d Update currentrelease for 3.12.1 release 2021-02-21 14:23:18 +11:00
mgrojo
09aaaccace Import: Add import-csv option to command line to import CSV files
The argument can be passed several times and all the CSV files are added to
the Import CSV dialog. When no database to open is passed in the command line,
the CSV files are imported into a new in-memory database, which could later
be saved as a file, if desired.

This option could be used as basis for adding a file association to CSV files
for DB4S.

See issue #2589.
2021-02-20 19:07:52 +01:00
mgrojo
3ad352467c Better formatting of the help messages so they are easier to translate
- Command line arguments are not given to translations, only descriptions
  and placeholders.
- Formatting is done programmatically, so developers and translators don't
  have to adjust that themselves.

This will affect translations but will be better in the long run.
2021-02-20 16:10:00 +01:00
Justin Clift
03297e769b Merge pull request #2585 from ismaelresp/patch-1
Fixed C++14 requirement in BUILDING.md
2021-02-13 02:59:47 +11:00
Ismael Rodriguez Espigares
8342f96d67 fixed C++14 requirement in BUILDING.md
fixed C++14 requirement from version 3.12.1 instead of 3.9.1
2021-02-12 15:16:13 +01:00
Martin Kleusberg
1c0cf443b5 Fix editing of tables without rowid
This fixes some severe bugs in the Browse Data tab with editing and
deleting rows in WITHOUT ROWID tables.

These were introduced in 02db68107a.

See issue #2582.
2021-02-08 18:45:00 +01:00
Martin Kleusberg
73efa11680 Speed up executing SQL statements in the Execute SQL tab
This improves the performance of executing multiple modifying SQL
statements, like INSERTs or UPDATEs, in the Execute SQL tab a lot by
not updating the plot dock after every single statement.

See issue #2572.
2021-02-03 19:16:50 +01:00
mgrojo
1e2853bfea 'Continuous build' is marked as 'Latest Release' and not as 'Pre-release'
The change in behaviour was due to
8142d461ab

See issue #2566
2021-02-01 23:08:56 +01:00
Martin Kleusberg
070bfd38cf Add extra border to make frozen table columns more obvious
This adds an extra border between frozen and ordinary table columns in
the Browse Data tab.

See issue #1888.
2021-01-31 20:33:27 +01:00
Martin Kleusberg
02db68107a Refactor the way we store a database schema
This commit does a lot of refactoring. But most noticeably it changes
two things:

1) Instead of saving all objects (tables, views, indices, triggers) of a
   schema in a common map, we now store tables/views, indices and
   triggers in three separate maps. This has a number of benefits:
   - It resembles more closely how SQLite stores its data internally and
     therefore achieves greater compatability e.g. for databases with a
     view and a trigger with the same name.
   - It reduces the need for runtime polymorphism. This makes the code
     run a bit faster.
   - By working with explicit types more often more error checking can
     be done at compile time, making the code less error prone.
   - The code becomes a lot clearer to read.

2) By making View inherit form Table, views are now a sort of tables.
   This has the following benefits:
   - This is a again how SQLite stores views internally which again
     should increase compatibility a bit.
   - We mostly treat views and tables the same anyway and with these
     changes we can unify the code for them even more.
2021-01-30 20:47:31 +01:00
Martin Kleusberg
13ab455d5c Unify handling of views and tables in SqliteTableModel a bit
This also avoids querying the column names another time when browsing a
view.
2021-01-28 22:42:39 +01:00
Martin Kleusberg
18c7e9c477 Change WHERE clauses of queries to use column names instead of indexes
For the same reasons we changed the ORDER BY part of query objects to
use their names instead of their indexes to address columns, this commit
changes the handling of the WHERE part of a query to use column names
too.
2021-01-28 20:06:49 +01:00
Martin Kleusberg
94023a55e8 For sorted column remember column name instead of column index
This changes the structures for representing SELECT statements to save
the names of sorted column instead of their indexes. This change has
several benefits:
- It prepares the Query class to store actual real-world SELECT
  statements in the future.
- It prepares us to sort by expressions instead of just columns.
- This way we do not need an extra list of column names to generate the
  ORDER BY part of the SELECT statement when building it.
2021-01-28 20:05:46 +01:00
Martin Kleusberg
f6ebc74131 Fix e54664dd03
Fix an error introduced in e54664dd03.
2021-01-26 19:21:22 +01:00