Commit Graph

2044 Commits

Author SHA1 Message Date
Martin Kleusberg
eff92c2818 dbhub: Better validation in push dialog
This makes it more obvious to the user where the error in the input is
by just now allowing invalid characters.

It also prevents an annoying error message from popping up when entering
invalid database names and changing focus to another field afterwards.

See issue #1136.
2017-10-06 11:39:00 +02:00
Martin Kleusberg
8a7b662435 Fix crash when editing table after changing its schema
Fix a crash which happened when opening a table in the Edit Table dialog
for modification and changing its schema and then (without reopening the
dialog) change the schema again or doing some other modifications to the
table.

See issue #1131.
2017-10-06 00:04:06 +02:00
Martin Kleusberg
3e02420256 Escape new schema name when altering a table
When moving a table to another schema with a name which needs to be
escaped, this would have generated an error prior to this commit.
2017-10-05 23:50:47 +02:00
Martin Kleusberg
3d26c1154c Don't allow attaching the same database twice
See issue #1133.
2017-10-05 23:45:22 +02:00
Martin Kleusberg
59b39bbb95 Don't query foreign key settings repeatedly in Edit Table dialog
When changing the table name in the Edit Table dialog, don't query the
foreign key pragma for every key stroke.

See issue #1130.
2017-10-05 23:32:06 +02:00
Martin Kleusberg
b24894f4c3 Allow empty names for attached databases
An empty database name is not the same as pressing the cancel button
when attaching a database.

See issue #1132.
2017-10-05 23:23:36 +02:00
Martin Kleusberg
1cd93ed045 Suggest a schema name when attaching a database
See issue #1132.
2017-10-05 23:21:37 +02:00
Martin Kleusberg
a5ebcbb55c Also remember databases with no objects
When attaching a database that is empty, i.e. has no objects in it,
include it in the schema map, too.

See issue #1132.
2017-10-05 23:17:19 +02:00
Martin Kleusberg
a1855d8f75 dbhub: Don't allow invalid file or branch names in push dialog
See issue #1136.
2017-10-05 23:10:11 +02:00
Martin Kleusberg
5de8f73723 Use a more sophisticated method for detecting image data in Edit dialog
In the Edit Data dialog we check if the data contained in a cell is an
image. This check returned some false positives, so this commit adds
another more sophisticated check to work around that.

See issue #1138 and #1159.
2017-10-05 22:47:02 +02:00
Martin Kleusberg
24ee209bef dbhub: Use URL returned by server 2017-10-05 22:38:01 +02:00
Justin Clift
d73859736d dbhub: Use a fixed format string when transmitting last modified dates 2017-10-02 12:58:30 +01:00
Justin Clift
64b33413fb dbhub: Include TZ with lastmodified date sent to server 2017-10-02 00:05:12 +01:00
Martin Kleusberg
c692ae0de5 dbhub: When pushing a database, save the new commit id and/or the file
When pushing a local database to the remote server, the new commit id is
returned. Grab that id and insert it into the database of local
checkouts. If there already is an entry for the given file, update that
record. When doing an initial push of a database, also copy the source
database file to our checkout directory to avoid redownloading the file
upon first use.

This should eliminate all unnecessary database downloads, both after
doing the initial push and after committing a modified database.
2017-09-30 16:05:01 +02:00
Martin Kleusberg
8c0e4bfdaa dbhub: Send last modified date when pushing database
Also add some code for receiving the last modified data when fetching
but we're not yet able to set it.
2017-09-30 14:47:19 +02:00
Martin Kleusberg
f926a67dba dbhub: Add foce push option to push dialog 2017-09-30 14:07:18 +02:00
Martin Kleusberg
b2ddcdd470 dbhub: Only keep one record per checked out file
Instead of just adding and adding records to the local checkout
database, search for a previous checkout and update its record. This
avoids all sorts of problems in the rest of the code which always
assumed that there is only one record per file.
2017-09-30 13:35:40 +02:00
Martin Kleusberg
f18064f0ae dbhub: Change schema of local database
Also delete the upgrade mechanism that was put in place because it won't
be that easy anyway later on.
2017-09-30 13:02:18 +02:00
Martin Kleusberg
fef884a4e1 dbhub: Send last known commit id along with the database when pushing 2017-09-30 12:57:46 +02:00
Martin Kleusberg
8a540a2745 dbhub: Add column for branches to local database 2017-09-30 12:43:50 +02:00
Martin Kleusberg
34df190729 Silence some cmake warnings
See issues #635 and #1143.
2017-09-30 12:19:55 +02:00
Martin Kleusberg
1666bb5606 Improve speed of preview table for large fields in Import CSV dialog
See issue #720.
2017-09-29 23:21:39 +02:00
Martin Kleusberg
bbc4ad5b19 Don't reset the table name as easily in the Import CSV dialog
See issue #1072.
2017-09-29 23:08:39 +02:00
Martin Kleusberg
263f075d8d Add splitter to the Import CSV dialog
This adds a splitter between the CSV file list and the file preview in
the Import CSV dialog.

See issue #1072.
2017-09-27 21:27:34 +02:00
Martin Kleusberg
cbd5d15cf5 Add a way to cancel the entire CSV import
See issue #1121.
2017-09-27 20:59:30 +02:00
Martin Kleusberg
425bfa1e75 Improve 'Yes for all' button in CSV import dialog
See issue #1121.
2017-09-27 15:52:34 +02:00
Martin Kleusberg
d2185d234b csv: Don't ask whether to import into existing table every time
Add a 'Yes for all' button to the "There is already a table of
that name..." message box in the Import CSV dialog.

See issue #1121.
2017-09-27 14:18:38 +02:00
Martin Kleusberg
4dc5286596 dbhub: Fix possible crash
This fixes a crash that occurs if there is an error while fetching
something other than a database and no database has been downloaded
before, e.g. when getting the root directory listing fails.
2017-09-25 14:36:31 +02:00
Jiří Techet
18bcbf138f Fix extra spaces in type definitions with parentheses
At the moment space is inserted between all tokens from which a type
consists. This adds extra spaces to types like VARCHAR(5) which become
"VARCHAR ( 5 )" which causes problems in some applications.

This patch modifies the way tokens are concatenated for a type. It makes
sure that the extra space isn't inserted before "(" and ")" and also
after "(".
2017-09-22 20:10:09 +02:00
Justin Clift
c5e91976c8 Update currentrelease to 3.10.1 2017-09-20 18:54:48 +01:00
Justin Clift
efd8514107 Added 3.10.1 to README.md release history 2017-09-20 17:07:39 +01:00
Justin Clift
1723ba10b9 Add 3.10.1 to the issue reporting template 2017-09-20 16:59:32 +01:00
Martin Kleusberg
e3b9027bd0 Add missing include
See issue #1148.
2017-09-20 16:54:46 +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
Jiří Techet
969d3e470a Fix custom type saving when only focus changes for user-entered type
At the moment when user types a custom type into the type combo box and
doesn't press enter, the entered type isn't used. This patch tries to fix
the problem by installing an event filter for the combo box and checking
when it loses focus - when it does, it performs type updates too.

On the way the patch also changes the signal used inside moveCurrentField()
from activated() to currentIndexChanged() to make it consistent with the
rest of the file.
2017-09-19 21:10:03 +02:00
Martin Kleusberg
2f304e0957 Add automatic data type detection to the CSV import
When importing a CSV file into a table that doesn't exist yet (i.e. that
is created during the import), try to guess the data type of each column
based on the first couple of rows. If it is all floats or mixed floats
and integers, set the data type to REAL; if it is all integers, set the
data type to INTEGER; if it is anything else, set the data type to TEXT.

See issue #1003.
2017-09-18 21:44:34 +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
Martin Kleusberg
659f38ebef Increase CSV parser performance 2017-09-18 15:10:43 +02:00
Martin Kleusberg
28446a4f0c Fix memory leak 2017-09-17 18:23:04 +02:00
Martin Kleusberg
677d36074a grammar: Add support for parsing multiple FKs in column constraints
This adds support for multiple foreign keys in a column constraint.
Example:

CREATE TABLE t1(a int, b int);
CREATE TABLE t2(a int, b int);
CREATE TABLE test(
    x int REFERENCES t1(a) REFERENCES t2(a),	-- This is now supported
    y int
);

Multiple foreign keys if they are a table constraint were already
supported before.
2017-09-15 11:00:25 +02:00
Martin Kleusberg
d73fbfc156 Don't leak memory for multiple PK constraints per field (Coverity)
This should really never happen because SQLite doesn't allow statements
like

CREATE TABLE test(
    a int PRIMARY KEY PRIMARY KEY,
    b int
);
2017-09-15 10:54:08 +02:00
Martin Kleusberg
f20f996767 Fix uninitialised member problems (Coverity)
None of them seem to be critical though.
2017-09-15 10:39:38 +02:00
Martin Kleusberg
0eb1f65798 Optimise the CSV import performance
This commit bundles a number of smaller optimisations in the CSV parser
and import code. They do add up to a noticible speed gain though (at
least on some systems and configurations).
2017-09-13 15:03:13 +02:00
Martin Kleusberg
6ed8080fdb Don't parse entire CSV file before inserting the first row
We were separating the CSV import into two steps: parsing the CSV file
and inserting the parsed data. This had the advantages that it keeps the
parsing code and the database code nicely separated and that we have
full knowledge of the CSV file when we start inserting the data into the
database. However, this made it necessary to keep the entire parser
results in RAM. For large CSV files this uses enormous amounts of
memory.

This commit changes the import to parse the first 20 lines and analyse
them. This should give us a good impression of what to expect from the
rest of the file. Based on that information we then parse the file row
by row and insert each row into the database as soon as it is parsed.
This means we only have to keep one row at a time in memory while more
or less keeping the possibility to analyse the file before inserting
data.

On my system this does seem to change the runtime for small files which
take a little longer now (<5%), though these measurements aren't
conclusive. For large files it, however, it changes memory consumption
from using all memory and starting to swap within seconds to almost no
memory consumption at all. And not having to swap speeds things up a
lot.
2017-09-12 10:37:28 +02:00
Justin Clift
e0ced4a0fa Rearranged display format list alphabetically
Was starting to look a bit weird otherwise. :)
2017-09-11 13:04:23 +01:00
Grif392
46ec019719 Add Java Epoch format conversion
Java epoch is measured in milliseconds from unix 0; conversion is a
(roundabout, best I could find) way to convert milliseconds into a
SQLite datetime while keeping millisecond resolution.

Easier alternative would be column_name / 1000, but loses _some_
theoretical resolution.
2017-09-11 00:30:23 +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
f28bb151b3 Regenerate some .ui files
This shouldn't change anything at all. It's just that Qt Designer keeps
insisting to do these changes and I have finally given in.
2017-09-10 15:06:20 +02:00