Commit Graph

3589 Commits

Author SHA1 Message Date
oldlaptop 6b03a33eae Fix #2583: quote identifiers, not expressions
94023a5 switched to storing OrderBy terms by column
 name and/or expression instead of by column index, and
 includes a test to ensure that identifiers are quoted
 and raw expressions are not; unfortunately it seems to
 have gotten the logic backwards.
2021-06-21 15:26:34 -04:00
mgrojo 5097760fe6 CSV Import: use file before it is removed by destructor
The reading of a QTemporaryFile must be done before the object it's destroyed,
otherwise the file is removed.

This was broken since 09aaaccace

Reported in issue #2749.
2021-06-20 18:39:50 +02:00
mgrojo 6510bb104e Improve support for BLOB columns as primary key
Working cases tables without rowid and BLOB as primary key:
- Inserted value is actually TEXT, for example, from the text editor in the
  GUI.
- Inserted value is really BLOB, for example, from the binary editor or
  from SQL and the data is fully binary.

Not yet working case:
- Inserted value is of type BLOB, but the actual data is recognized by
  DB Browser as text. In this case, no type affinity is applied by
  SQLite and the row is not properly selected.

See issue #2738
2021-06-19 00:07:35 +02:00
mgrojo 0f8b3cc092 Merge pull request #2741
Workaround for WindowsVista style (qwindowsvistastyle plugin)

There is some strange bug on windows with the system styles (windows
and windowsvista).  When styleproxy is used and QDockWidget has a
custom stylesheet applied to the widget title, close-button and
float-button are rendered huge.

See #2485
2021-06-18 23:11:13 +02:00
mgrojo 3bb0b96ed2 Avoid warning in DB4SProxyStyle 2021-06-18 23:09:27 +02:00
Nikolay Zlatev ee6a5046da Application: Move DB4SProxyStyle before MainWindow is created.
DB4SProxyStyle is set before any Widget is created.
QGuiApplication::primaryScreen() is used as a screen.
Now custom QPalette can be set before MainWindows is created,
for example exported palette from KDE (Breeze, Breeze Dark, etc).
2021-06-15 14:10:40 +03:00
Nikolay Zlatev 591c566c65 Application: PM_SmallIconSize (QDockWidgets with custom stylesheet) workaround is applied for windows only.
Screen detection now use QDesktopWidget::screenNumber(const QWidget *widget = nullptr)

toolBarIconSize is set to 18
2021-06-14 13:23:41 +03:00
Nikolay Zlatev c0a75294e2 Application: styleproxy now uses screen->logicalDotsPerInch() 2021-06-13 01:29:55 +03:00
Nikolay Zlatev aada909f03 TableBrowserDock: Change title style 2021-06-12 22:28:06 +03:00
Nikolay Zlatev a39ea9d0a6 Application: Move DB4SProxyStyle to the Application unit.
Set default maximum icon size for QToolBar to 20px, and for MenuItem to 16px,
before that MenuItem icon was bigger than QToolBar icon.

Pixel metric for SmallIconSize is set to 12px to avoid strange
render behaviour for QDockWidget with custom stylesheet.
2021-06-12 22:15:11 +03:00
mgr 36054cd767 Replace all remaining PNG icons by scalable ones and license details
edit_cut.svg: released under public domain by The Tango Desktop Project.
 https://commons.wikimedia.org/wiki/File:Edit-cut.svg

hourglass.svg: from Noto project, released under Apache license. See:
 https://commons.wikimedia.org/wiki/File:Noto_Emoji_Pie_23f3.svg

Remaining ones are from https://codefisher.org/pastel-svg/
see details in `LICENSE-PLUGINS`

package_rename.svg, package_save.svg, clear_sorting.svg and script_copy.svg
are own work based on Pastel SVG and released under the same license.
2021-06-11 22:04:54 +02:00
Manuel 5b89c2c1e4 Merge pull request #2485 from sandman7920/SVG
HiDPI on all platforms and new vectorial icon-set.
2021-06-11 20:51:46 +02:00
Justin Clift 5737b7ad38 Merge pull request #2736 from pgp/master
Fix typo in italian translation
2021-06-10 22:53:46 +10:00
pgp be07d48cdd Fix typo in italian translation
replace 'modifca' with 'modifica'
2021-06-10 10:41:16 +02:00
Nikolay Zlatev bb44fc158b fix indentation (4 spaces) 2021-05-31 23:25:09 +03:00
Martin Kleusberg 6f6113c257 Add basic support for new RETURNING keyword
This adds support for the RETURNING keyword which was introduced in
SQLite 3.35.0 by adding it to the syntax highlighter and the auto
completion as well as adding it to the lexer and parser (though it is
not used by the latter in any significant way).
2021-05-25 22:16:13 +02:00
Martin Kleusberg 6cde3f51ad When modifying a view use DROP VIEW IF EXISTS instead of just DROP VIEW
Clicking on Edit View in the database structure tab opens a new SQL tab
with a DROP VIEW statement to delete the existing view and a copy of the
CREATE VIEW statement used for the current view. When the user modifies
the CREATE VIEW statement introduces an error in it, and then executes
the statements, the view is deleted and an error reported. Fixing that
error and re-running the script then fails at the DROP VIEW statement.
This means it makes more sense to make it a DROP VIEW IF EXISTS
statement.

See issue #2661.
2021-05-23 11:08:46 +02:00
Martin Kleusberg bbfaca2e06 Use LIMIT + OFFSET when generating SELECT statements instead
Instead of constructing queries using the LIMIT offset,limit notation
use the LIMIT limit OFFSET offset style.

See https://www.sqlite.org/lang_select.html#limitoffset.
2021-05-22 10:35:07 +02:00
Martin Kleusberg 3be5969bca Do not always refresh the table browser dock when opening a database
It does not seem like there is a good reason to always refresh the table
browser dock (there is always exactly one at this point) when opening a
database file, even when it is not visible. This only generates
unnecessary queries to the database.
2021-05-22 10:28:49 +02:00
Martin Kleusberg f56288023b dbhub: Avoid ambiguous F5 shortcut
Remove the F5 shortcut for refreshing the DBHub.io remote databases
because it is ambiguous and can make the main view not work as expected.
Since the refresh action is not super important in the DBHub.io dock any
way it is probably best to just remove the shortcut there.

See issue #2695.
2021-05-22 10:10:01 +02:00
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