Commit Graph

1400 Commits

Author SHA1 Message Date
Martin Kleusberg
e3764c920f Change wording of a message box 2017-06-28 22:45:16 +02:00
Martin Kleusberg
3c40a12103 Rework the Execute SQL tab handling
Allow opening new tabs, opening SQL files, and saving SQL files even
when no database is opened. Execution of SQL statements obviously is
still not allowed. But this should make it possible to use DB4S as a
simple SQL text editor if no better alternative is available on the
system.

Don't close SQL tabs when closing the databse.

When opening a database only close empty tabs, keep all non-empty tabs
opened. This should make sure that no SQL statements are accidentally
lost when opening a new database or simply closing the old one.

When opening a project file, close all tabs and load the new tabs from
the project file.

See issue #1035.
2017-06-28 22:17:38 +02:00
Martin Kleusberg
df8219de09 In Edit Index dialog don't remove expression columns by accident
Don't allow removing expression columns by double clicking as this it
too error-prone. Instead require a button click for removal and only
start editing the expression when double clicking.

See issue #1012.
2017-06-28 16:56:26 +02:00
Martin Kleusberg
803a1fa5cb Add 'Set to NULL' context menu action
Add a new action 'Set to NULL' to the table browser context menu for
setting all selected items to NULL.
2017-06-28 16:40:09 +02:00
Martin Kleusberg
2421fef219 Add context menu to all table views
Add a context menu to all table view widgets in the program (Browse Data
tab and Execute SQL tab) which opens when right clicking a table item.

Currently the menu only allows you to copy and paste the selected
item(s).

Only activate the paste action when the current view is writable.
2017-06-28 16:30:03 +02:00
Martin Kleusberg
4de01c1e73 Add helper function to make the code more self-explanatory 2017-06-28 16:29:28 +02:00
Martin Kleusberg
4f676ae206 Check for errors when reading or writing sQL files
See issue #1036.
2017-06-28 15:35:30 +02:00
Martin Kleusberg
f4fad4afcf Fix possible crash when loading project files
This fixes a crash when loading project files that haven't set the
current tab to the Browse Data tab.

See issue #1019.
2017-06-26 12:39:50 +02:00
Martin Kleusberg
f1f24be743 Make SQL auto completion case insensitive
See issue #1046.
2017-06-22 19:42:22 +02:00
Martin Kleusberg
6c9c56a2a9 Fix browsing of tables without rowid
Browsing WITHOUT ROWID tables was broken since a couple of commits. An
error message would be printed to the console and all cells would stay
empty. This is fixed by this commit.
2017-06-22 00:05:53 +02:00
Martin Kleusberg
61f385abba Don't crash when pasting data in a view
When pasting data into a cell of a view the application would have
crashed because it treats the view as a table (which it isn't). This is
fixed by this.
2017-06-21 23:25:53 +02:00
Martin Kleusberg
6984d451d6 Properly initialise table browser settings 2017-06-17 13:11:59 +02:00
Martin Kleusberg
157dadef50 Don't SQL export indices or triggers if their base table isn't exported
See issue #1013.
2017-06-17 12:14:57 +02:00
iKlsR
357faeed04 Allow specifying unique table names for separate imports 2017-06-16 17:35:36 +02:00
iKlsR
97b4261190 Cleanup logic, code reuse, faster header picking 2017-06-16 17:35:36 +02:00
iKlsR
a588fb83d1 Edit widget tab order 2017-06-16 17:35:36 +02:00
iKlsR
b5a2411eb6 Append Separate Tables state to import settings 2017-06-16 17:35:36 +02:00
iKlsR
225eb5ab5f Allow matching similar csv files for batch import 2017-06-16 17:35:36 +02:00
iKlsR
b0eb9acae2 Allow for interactive CSV file import
- Tweak input checker
- Preserve old file import as not to cause any unforeseen breaks
- Allow ignoring file name when importing multiple files to tables
- Mass toggle several files for import
2017-06-16 17:35:36 +02:00
iKlsR
7d02ea3a09 Extend FileDialog to accommodate multiple file selection 2017-06-16 17:35:36 +02:00
Martin Kleusberg
8332c39688 Allow changing the page size pragma using the UI
This fixes changing the page size pragma values using the UI editor. You
need to execute the VACUUM statement right after the pragma.

See issue #1021.
2017-06-03 00:50:03 +02:00
Martin Kleusberg
7ad8035261 Keep current sort order after refreshing in Browse Data tab
See issue #1016.
2017-05-19 15:34:53 +02:00
Martin Kleusberg
462c252656 Add selecting fields in Execute SQL tab for Edit Cell dock via keyboard
See issue #481.
2017-05-19 15:13:57 +02:00
Martin Kleusberg
b7cd1c7dbd Don't allow setting data for custom query model data
See issue #1015.
2017-05-19 15:04:47 +02:00
Martin Kleusberg
8cc3154c72 Add button for adding expression columns in Edit Index dialog
Add a button for adding new expression columns to the Edit Index dialog.

Allow the user to edit the 'name' of existing expression columns in the
Edit Index dialog.
2017-05-14 21:37:11 +02:00
Martin Kleusberg
6321d14dd6 Add buttons for changing the column order in Edit Index dialog
Add two buttons for moving index columns up or down in the Edit Index
dialog.
2017-05-14 20:48:43 +02:00
Martin Kleusberg
f06b63bc66 Use savepoint in Edit Index dialog
Create a save point when opening the Edit Index dialog. This allows us
to revert back to the last version when pressing the Cancel button.
2017-05-14 20:48:42 +02:00
Martin Kleusberg
e61d7d9fa7 Allow setting the partial index clause in the Edit Index dialog
This adds a new field to the Edit Index dialog that allows the user to
change the partial index expression for an index.

Example:
CREATE INDEX i ON a(
     col1 ASC,
     col2 DESC
) WHERE id < 1000;	-- This bit here
2017-05-14 20:48:42 +02:00
Justin Clift
d17b5454a1 Qmake now installs icon and metadata on *nix 2017-05-14 18:12:31 +01:00
Martin Kleusberg
58996f1345 Rework the Edit Index dialog
Change the layout of the dialog entirely. Instead of having checkboxes
that, if activated, move a column into the index, use two separate table
views, one for available columns and one for used columns. This makes it
easier to see the index structure on first sight. It also makes it
possible to see the order of the different index columns from the table
views. Additionally, now expression columns that are used in the index
are shown in the table views, even allowing them to be removed from the
index.
2017-05-14 17:01:00 +02:00
Martin Kleusberg
b953edc8eb grammar: Don't produce unnecessary separator char in index SQL 2017-05-14 14:26:13 +02:00
Martin Kleusberg
5d45636b9e export: Support dropping non-table objects in SQL export 2017-05-14 14:11:42 +02:00
Martin Kleusberg
57c4e582c7 Don't show "Show rowid" menu item for views
Don't show the "Show rowid column" context menu item for views because
views don't really have a rowid column (it's always NULL). So showing
the column doesn't really make a lot of sense and might even confuse
some users.

Also change the order of the menu items a little to be more consistent
for views and tables.
2017-05-12 18:31:58 +02:00
Martin Kleusberg
21ee1f2703 Allow updating views
This adds a new context menu option that allows unlocking views for
updating. This requires appropriate triggers to be in place and the user
to type in a column name that can be used as a 'primary key' for the
view. By default views are still locked from editing.

Inserting into and deleting from views isn't supported yet.

See issue #141.
2017-05-12 18:17:50 +02:00
Martin Kleusberg
e404b22205 Fix wording in encoding message box 2017-05-12 16:22:39 +02:00
Martin Kleusberg
037b3c0113 Some improvements to the Export SQL dialog
When possible, don't write 'CREATE TABLE/VIEW/... `name`' but 'CREATE
TABLE/VIEW/... IF NOT EXISTS `name`' to the file.

Add an option to add DROP TABLE statements before each create statement.
This needs to be enhanced to apply to views, indices, and triggers as
well. See issue #629.

Clean up code.
2017-05-12 15:38:46 +02:00
Martin Kleusberg
6e6f7cdc18 Add support for building with Qt 5.5 2017-05-12 10:40:24 +02:00
Martin Kleusberg
bee295da08 Avoid warning when creating new databases
When creating a new database we execute a couple of SQL statements after
opening the new file. However, since none of them happen in a
transaction there's no need to commit them. This change gets rid of the
commit statement and avoids a warning being printed by doing so.

See issue #583.
2017-05-08 14:15:21 +02:00
Martin Kleusberg
f07548dfb2 build: Add make install rule to qmake project file
See issue #833.
2017-05-08 13:51:40 +02:00
Martin Kleusberg
4f18de856d plot: Fix labels for 'Row #' columns
See issue #950.
2017-05-08 13:19:59 +02:00
Martin Kleusberg
4706dd7dd7 plot: Correctly disable signals when needed
In the plot code use the blockSignals() method instead of connecting and
disconnecting signals and slots every time. The disconnects didn't
really work using the new C++11 connection code, so this commit restored
the functionality as it was intended.

This means that *a ton* of calls to updatePlot() are eliminated which
improves the performance.

It also avoid messing up the graph selection table in the Plot Dock in
certain cases.

See issue #950.
2017-05-08 13:05:30 +02:00
Martin Kleusberg
e1fbc98ef2 Fix default path in Save file as dialog
Actually use the default path settings from the Preferences dialog when
showing a Save dialog.
2017-05-08 12:22:44 +02:00
Martin Kleusberg
ef0ae8d549 Implement page-wise scrolling in Browse Data tab
Don't scroll by 100 records when using the scroll buttons but scroll by
one screen page.

See issue #232.
2017-05-08 12:06:56 +02:00
Martin Kleusberg
715074e0c6 Revert "tests: Fix build"
This reverts commit a436901d12.
2017-05-05 15:12:33 +02:00
Martin Kleusberg
0c8cb4ec1d Revert "Move fetching data for data browsing to a separate thread"
This reverts commit 6da71b6788.

This was causing just too many problems for one. The ones I noticed
were:
- Messing up the table view when scrolling down very large table where
the prefetching code is triggered.
- Crashing when setting an auto increment PK in the Edit Table dialog
because the sqlitetablemodel is used for a check in there.
- Probably more crashed in other places but for the same reason.
- Easy to fix but an issue nonetheless: when doing plotting a number of
empty rows would be inserted into the data browser.
- It just feels a little laggy.
2017-05-05 15:08:51 +02:00
Martin Kleusberg
e205f77e6a Use platform specific path separators in window caption
For displaying the path to the currently opened database file use
platform specific path separators.

See issue #735.
2017-05-05 14:19:50 +02:00
Martin Kleusberg
8c5650a63f libs: Update qcustomplot to version 2.0-beta 2017-05-04 21:51:43 +02:00
Martin Kleusberg
9a171e0621 Avoid sorting twice in Browse Data tab
When browsing a table and changing the sort order, then switching to
another table, and then switching back, we would sort the table twice:
once using the default sort order and then again using the previously
used sort order. This results in four instead of two queries for those
tables (including the COUNT queries). This commit fixes this so that
only two queries are executed which should cut the run time for these
cases in half.

See issue #1007.
2017-05-04 19:54:03 +02:00
Martin Kleusberg
a436901d12 tests: Fix build 2017-05-04 19:26:44 +02:00
Martin Kleusberg
478ddc6da4 Simplify code 2017-05-04 19:21:17 +02:00