Commit Graph

500 Commits

Author SHA1 Message Date
Martin Kleusberg
973f97c1eb Move row count query into a separate thread
In the SqliteTableModel class we need to know the total number of rows
in the table or returned by the query. This takes a considerable amount
of time and can be moved into a separate thread. I haven't done any
performance measurements with this but it might speed up switching
between large tables a bit.
2017-10-15 11:46:47 +02:00
kehugter
c4c4cf62a2 Remove activateWindow() when EditDock is toggled
There's no need to set sqlitebrowser as active window when updating
the main application window. The `activateWindow()` call prevents
switching workspaces in GNOME and Cinnamon desktops.

Fixes #934
2017-10-11 22:54:06 +02:00
Martin Kleusberg
5ea6b1a76d Fix recordset label in Browse Data tab 2017-10-11 09:21:41 +02:00
Martin Kleusberg
8f82f26d4f Visual optimisation for the CSV import process
When importing multiple CSV files at once, remove each entry from the
list of CSV files as its import completes. This way people can see the
list shrink visibly onscreen.

Also don't close the window if there are still files left to be
imported. This allows the user to import unchecked files, too, probably
using different settings.

See issue #1072.
2017-09-19 21:43:30 +02:00
Martin Kleusberg
d4e228d4b5 Make hidden columns persistent
With this commit the main window keeps track of the hidden columns and
re-hides them when the table is selected again. It also saves the hidden
status to the project file and restores it from there.
2017-09-18 20:41:27 +02:00
Peter Hyatt
c5c3d2366e Added hide selected columns and show all columns to tableview context menu.
Added a fix for building with MingW on Windows.
2017-09-18 19:47:27 +02:00
Oleg Prutz
ae8df56d9e Clear column filters after table modification
Fixes #1020. Clear values in the filter boxes
on the `Data` tab every time the table structure
changes.
2017-09-10 23:58:31 +02:00
Martin Kleusberg
fb6ea5ac60 Make text selectable in Edit dock even if db is opened as read only
Instead of disabling the entire edit dock when the database is opened in
read only mode, only disable all buttons for making changes to the
field. This way the data can still be read using the edit dock.

See issue #1123.
2017-09-10 15:19:03 +02:00
Martin Kleusberg
e9d4b3912a Move button for saving Execute SQL results to the toolbar
In the Execute SQL tab, move the button for saving the results of a
query as either a CSV file or a view from the bottom of the results view
to the toolbar at the top.

See issue #1122.
2017-09-10 15:00:31 +02:00
Martin Kleusberg
ea1659e1d0 Support schemata other than main in the Browse Data tab
Similar to commit 44eb2d4f99 this commit
makes use of the backend code improvements introduced in commit
532fcd3f6b.

It adds support for database schemata other than "main" to the Browse
Data tab. With this it's possible again to browse and edit data of
temporary tables using the Browse Data tab. This time, however, they are
separated logically from "main" tables. So handling temporary tables
should be a lot less error prone now, plus it's easier to tell for the
user what tables goes in what schema.

This commit changes the project file format. There is some code included
which allows loading of project files in the old format. However,
project files generated using versions after this commit can't be loaded
by older versions of DB4S.
2017-09-04 12:27:52 +02:00
Martin Kleusberg
1a3e3d3c40 Support SQL auto-completion for tables from different schemata
This improves commit 44eb2d4f99 by adding
support for auto completion in the SQL editors for all tables that are
not in the "main" schema.
2017-09-04 10:25:05 +02:00
Martin Kleusberg
44eb2d4f99 Add better handling of multiple schemata in the Database Structure tab
Commit 532fcd3f6b added support for
multiple database schemata to the backend code. While doing this, it
removed support for showing temporary database objects in the user
interface.

This functionally is partially reimplemented by this commit. With this
commit temporary database objects are shown in the Database Structure
tab and in the Db Structure dock. Unlike before however, they are
visually separated from 'normal' database objects. Also this commit
tries to make use of the new schema handling code wherever possible to
also separate temporary objects programatically from the normal ones.
This wasn't done in earlier versions and effectively was a source of
all sorts of errors.

This commit still lacks support for temporary tables in the foreign key
editor and in the Browse Data tab. Also a substantial amount of testing
is still required.
2017-09-03 21:36:06 +02:00
Martin Kleusberg
532fcd3f6b Add initial support for multiple database schemata
This adds initial basic support for handling different database schemata
at once to the backend code. This is still far from working properly but
shouldn't break much either - mostly because it's not really used yet in
the user interface code.
2017-09-03 13:22:21 +02:00
Martin Kleusberg
c3ab20b6b5 Fix indentation 2017-08-15 11:13:30 +02:00
Martin Kleusberg
d1f90994fb Activate attach menu item right after opening a database
The 'attach database' menu item was only activated after making changes
to the database and saving them. With this commit it's activated right
after opening a database, too.
2017-08-15 11:13:29 +02:00
Martin Kleusberg
b0c3d973ce Improve detection of PRAGMA and VACUUM statements in Execute SQL tab
In the Execute SQL tab we need to detect PRAGMA and VACUUM statements
before executing them in order to now execute them inside a transaction
which isn't supported by SQLite. If such a statement followed any other
statement however, the detection would fail, e.g.
pragma user_version=1;	-- this works
pragma app_version=2;	-- this fails

This should be fixed by this commit.
2017-08-11 18:18:55 +02:00
Martin Kleusberg
c636a505c8 Allow VACUUM command in Execute SQL tab
This allows the user to execute VACUUM commands in the Execute SQL by
detecting them and not creating a transaction for them.

See issue #1021.
2017-08-11 18:17:55 +02:00
Martin Kleusberg
5ae5241b95 Don't allow query execution when no database is opened
Some time ago we changed the Execute SQL tab to allow open SQL files
even if no database is loaded in order to provide an SQL editor without
needing a database.

If no database file is opened the Execute buttons were greyed out but
the F5/Ctrl+R shortcut would still work, causing an "out of memory"
error. That error doesn't cause any harm but is a bit confusing. So this
commit disables the keyboard shortcuts too.
2017-08-11 17:19:42 +02:00
Jonathan Oakley
e3a7d9aa75 Fix for comment problems in Execute Query tab
See issue #1004.
2017-08-10 20:51:30 +02:00
Martin Kleusberg
d14fb1fbb1 dbhub: Remove remote menu, add push button to remote dock
This commit removes the File -> Remote menu entirely. The only menu item
that was left was the Save to Remote item which is replaces by a button
in the remote dock.

The button is only enabled when a database file is opened and the user
has logged in using a certificate.

Clicking the button opens the same dialog and performs the same actions
as before. The only difference is that we don't use the first client
certificate - no matter which one it is - but instead use the client
certificate that was used for logging in.
2017-08-03 17:35:36 +02:00
Martin Kleusberg
26ddcf2c04 Allow setting PRAGMAs from the Execute SQL tab
As per popular request, this adds support for setting PRAGMAs from the
Execute SQL tab. Since most PRAGMAs won't work inside a transaction we
make sure that we're not in one while the PRAGMA statement is executed.
If this means we need to commit any pending changes, the user get a
message box.

See issues #1021, #980, #966.
2017-06-30 21:59:47 +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
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
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
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
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
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
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
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
478ddc6da4 Simplify code 2017-05-04 19:21:17 +02:00
Martin Kleusberg
b5651d8b4d Keep the UI responsive when executing many statements in Execute SQL tab 2017-05-04 19:08:38 +02:00
Martin Kleusberg
3ff686d96f Show consistent slashes in recent files menu actions
See issue #735.
2017-05-03 21:11:29 +02:00
Martin Kleusberg
f7421a9d62 Fix messed up table browser
This is to work around a Qt bug which is present in at least version
5.7.1. The problem is this: when you browse a table/view with n
colums, then switch to a table/view with less than n columns, you'll be
able to resize the first (hidden!) column by resizing the section to the
left of the first visible column. By doing so the table view gets messed
up. But even when not resizing the first hidden column, tab-ing through
the fields will stop at the not-so-much-hidden rowid column, too. All
this an be fixed by this line. I haven't managed to find another
workaround or way to fix this yet.

If anybody knows more about this issue please let me know.
2017-05-03 20:43:31 +02:00
Martin Kleusberg
760ef092cd Try setting a saner default row height in the data browser
Maybe this helps with issue #419.
2017-04-10 15:07:51 +02:00
Justin Clift
8b2e93d547 Ensure 'File → Export → Table(s) to JSON' is enabled/disabled along with its siblings 2017-04-04 14:07:44 +01:00
Martin Kleusberg
43a5175af1 dbhub: Keep track of the cloned databases
This adds a local database to keep track of all the cloned databases.
For now we only use this information to prevent exactly the same
database being downloaded twice.
2017-03-23 19:08:26 +01:00
Martin Kleusberg
f1194d845e Rename all the settings accessor functions
Rename the settings accessor functions from Settings::getSettingsValue()
(and similar) to Settings::getValue() (and similar). The 'Settings' bit
seems a bit redundant and costs a lot of screen space.
2017-03-20 23:16:52 +01:00
Martin Kleusberg
1e9fec270b Merge automatic update check into dbhub.io code
Move the network part of the automatic version check code into the
dbhub.io parts. While semantically this doesn't make a lot of sense it
simplifies the code a bit, reduces the size of the main window class,
and avoids duplication of code e.g. when introducing proxy support.
2017-03-19 17:29:20 +01:00
Martin Kleusberg
3e4f3fc3d2 dbhub: Add remote dock with directory browsing support
This adds a new dock to the main window that contains all the remote
functionality (or is supposed to contain it all in the future).

It also adds a directory browsing feature which allows you to browse
through the folders and files on the dbhub server.

By double clicking a database you can download and open it. The Open
Remote menu action isn't needed anymore and has been removed.

This also fixes an issue with pushing databases where, after sending the
file is completed, the save dialog was opened.

Note that this is still WIP and is far from polished.
2017-03-18 20:40:59 +01:00
Martin Kleusberg
f67817ee68 Simplify code for reloading settings
This simplifies the code for reloading the settings in the Execute SQL
area.

It might also fix a bug where setting a new font for the success/error
message at the bottom of each Execute SQL tab would be overwritten to
Monospace immediately after setting it.
2017-03-16 16:59:23 +01:00
sacha schutz
8ac4c0342a Add absolutePath to the recent Menu. Fix #965 (#967) 2017-02-28 15:44:39 +01:00
Martin Kleusberg
c62d291042 Add keyboard shortcuts for switching the currently browsed table
Add two new keyboard shortcuts for switching the currently selected
table in the Browse Data tab. These work as long as the table widget is
active. For now I have set them to Ctrl+PageUp and Ctrl+PageDown.

See issue #536.
2017-02-02 22:07:49 +01:00
Martin Kleusberg
4794b0d231 Try to fix all 'not an error' errors in the Execute SQL tab
See issue #478.
2017-02-01 18:59:56 +01:00
Martin Kleusberg
bf1c90a896 Fix crash when browsing views
See issue #953.
2017-01-30 21:19:36 +01:00
Martin Kleusberg
38144bbcad Finish main part of the recent refactoring effort
This finally gets rid of the DBBrowserObject class entirely and moves
all its functionality to the newer classes in the sqlb namespace.

I'm still not entirely happy with this but at least things should be a
little more consistent now.
2017-01-23 20:59:12 +01:00
Martin Kleusberg
d236f6df9f grammar: Introduce basic View class stub
Parsing views or generating a CREATE VIEW statement isn't implemented
yet.

Also unify the process by which it's possible to retrieve information on
the fields of a database object.
2017-01-23 17:06:41 +01:00
Martin Kleusberg
ebc3869627 Rename sqlb::Object::ObjectTypes enum to sqlb::Object::Types
The 'Object' parts seemed a little redundant before.
2017-01-23 13:44:36 +01:00