Commit Graph

1698 Commits

Author SHA1 Message Date
Vladyslav Tronko
4ecb50277c Set adjustment rules for combobox within foreign key editor 2017-01-16 04:16:17 +02:00
Martin Kleusberg
0584d0380d Don't try opening database for writing when not necessary 2017-01-15 21:23:05 +01:00
Martin Kleusberg
1a6c34951b Fix error handling in open database procedure
When opening a database fails a proper error message is now shown which
hopefully tells the user what the source of the problem is. Note: this
will only work for newer versions of SQLite.

This requires a bug fix which is included in this commit. The error
message wasn't taken from the correct database handle, so it had nothing
to do with the actual error source. This is fixed by this commit as
well.
2017-01-15 21:22:03 +01:00
Martin Kleusberg
fa81c0b1e3 Fix possible warning 2017-01-15 20:29:45 +01:00
Martin Kleusberg
50ef6cd7c3 Allow opening databases in read only mode
See issue #325.
2017-01-15 20:22:01 +01:00
Vladyslav Tronko
d3dde35f90 Use references for iterating through object map 2017-01-15 03:08:00 +02:00
Martin Kleusberg
59bf2aeecc tests: Fix tests
This is an easy fix for the failing test case after commit
64fdd78105.
2017-01-14 15:13:19 +01:00
Martin Kleusberg
64fdd78105 grammar: Fix parsing of exotic column data types
This fixes two issues with unusual but valid data types for columns:

1) When having a data type that consists of more than one word these
wouldn't be separated anymore after parsing. This is fixed now. Example:
CREATE TABLE test(a long int);
would have become
CREATE TABLE test(a longint);

2) Some keywords are allowed to be used as data types. Parsing these
tables would have failed entire prior to this. This is fixed, too.
Example:
CREATE TABLE test(a no);
would fail.
2017-01-14 14:46:04 +01:00
Martin Kleusberg
09b679252e grammar: Fix using unquoted keywords as DEFAULT values in constraints
This fixes tables like these where a keyword (in this case NO) is used
as an unquoted default value for a column:

CREATE TABLE test(a DEFAULT NO);

See issue #877.
2017-01-14 14:34:24 +01:00
Martin Kleusberg
ec9e05ee7f grammar: Add support for columns named 'no'
Fix parsing of tables with columns named 'no' and no quoting, like this one:

CREATE TABLE test(no int);
2017-01-14 14:11:16 +01:00
Martin Kleusberg
396589d3d4 grammar: Add support for tables named 'no'
This fixes parsing for tables named 'no', like this one:

CREATE TABLE NO(a int);
2017-01-14 14:07:50 +01:00
Martin Kleusberg
7822a2058f grammar: Fix some warnings caused by the antlr file
This shouldn't change anything for the end user.
2017-01-14 13:51:40 +01:00
Martin Kleusberg
95c1781fa8 Remove unnecessary include 2017-01-14 13:12:50 +01:00
Martin Kleusberg
ebc18f20d6 Use our settings class more often instead of using QSettings directly
This keeps the defaults in one place (the foreign keys defaults weren't
even the same in sqlitedb.cpp as in Settings.cpp!), makes the code a bit
easier to read, and makes use of the settings cache for better performance.
2017-01-14 13:12:50 +01:00
Vladyslav
46a55bdc78 Support foreign key constraints referring to the same table (#933) 2017-01-13 20:12:02 +02:00
Martin Kleusberg
11ca36ef9d Fix editing table name and table columns at once
Renaming a table always happens *after* editing all table columns (at
least that's the order we're doing it currently). So for all
renameColumn() names we'll need to use the table name as it is in the
database, *not* as it is in the table name widget because that might
have been changed in the meantime.
2017-01-13 17:08:29 +01:00
Justin Clift
1ae753740a Merge pull request #921 from innermous/master
Enhanced UI for creating and editing foreign keys
2017-01-13 12:50:20 +00:00
Justin Clift
b06cc42700 Updated translation files (.ts)
Thanks @lulol :)
2017-01-13 12:46:37 +00:00
Vladislav Tronko
4f7473fbed Enhanced UI for creating and editing foreign keys 2017-01-13 12:59:31 +02:00
Martin Kleusberg
d4921841ef Update BUILDING.md
Sorry.
2017-01-12 21:01:51 +01:00
Martin Kleusberg
a5033aa03e Update BUILDING.md 2017-01-12 21:01:34 +01:00
Justin Clift
5e519f52e8 Merge pull request #928 from lulol/master
Updated translation of rebuilt .ts
2017-01-12 10:12:02 +00:00
lulol
e215378476 Updated translation of rebuilt .ts 2017-01-12 00:41:10 +01:00
Justin Clift
e4fdb8f05d lupdate run on sqlb_es_ES.ts
If this works as intended, we can do it for the other translations too
2017-01-11 21:53:52 +00:00
lulol
bd0b8637e0 Corrects some typos and tildes (#924) 2017-01-10 12:33:13 +00:00
Martin Kleusberg
22b87847c0 grammar: Parse named primary keys in column constraints
Parse named primary keys correctly when they are in a column constraint,
not in a table constraint. E.g.

CREATE TABLE `a` (
	`x`	INTEGER CONSTRAINT c PRIMARY KEY,	-- Name 'c' here
	`y`	INTEGER,
);

See issue #741.
2017-01-08 20:42:34 +01:00
Martin Kleusberg
6740fc4d03 grammar: Fix parsing virtual tables 2017-01-08 16:32:41 +01:00
Martin Kleusberg
72b1d8f47e Clear edit dock after closing database
See issue #469.
2017-01-06 19:18:29 +01:00
Martin Kleusberg
35725b05e1 Replace ASCII art in pagination controls in Browse Data tab by icons 2017-01-06 19:00:15 +01:00
Martin Kleusberg
d8983cb066 grammar: Support named foreign key constraints in the column definition
Previously the grammar parser would fail to extract and store the name
of a foreign key constraint in statements like these:

CREATE TABLE test(
    a int,
    b int CONSTRAINT this REFERENCES xy(id)	-- See the 'this' name
);

See issue #741.
2017-01-05 22:56:12 +01:00
Martin Kleusberg
94849fccf2 grammar: Parse columns with explicit NULL (un-)constraint correctly
Table definitions like these wouldn't work before:
CREATE TABLE test(
    a int NOT NULL,    -- This worked fine
    b int NULL         -- This didn't but does now.
);

See issue #741.
2017-01-05 22:41:51 +01:00
Martin Kleusberg
99a5d02925 Fix 'modifying table not supported' message
When our grammar parser doesn't fully understand a create table
statement yet, it'll set a flag to indicate the modifying this table
will result in errors: the nonunderstood parts will be removed from the
table while editing it.

The code for this feature, however, had a bug that was triggered by some
compilers (gcc in my case) because of an ambiguous function call. That
ambiguity and thus the resulting bug are fixed by this commit, making
sure the warning appears on all systems.

This was fun to debug...
2017-01-05 21:51:16 +01:00
Martin Kleusberg
01e68f0821 grammar: Add very, very basic support for virtual tables to the parser
This adds basic support for parsing CREATE VIRTUAL TABLE statements to
the grammar parser.

This doesn't mean that those tables are handled correctly at all.
Especially editing them and browsing them isn't working. But it didn't
work before this either.

See issue #917.
2017-01-05 21:42:02 +01:00
Martin Kleusberg
95a3f5cacf Allow (un)setting the WITHOUT ROWID flag for existing tables
When editing an existing table and changing the WITHOUT ROWID flag, this
modification is now actually applied to the table and saved.

See issue #51.
2017-01-05 19:24:14 +01:00
Martin Kleusberg
d3ac0bdb81 Fix editing of foreign keys in Edit Table dialog
Fix a bug when removing a foreign key from a table.

Fix a bug when editing an existing foreign key on a table.

See issue #918.
2017-01-04 19:32:06 +01:00
Martin Kleusberg
63ba2c5059 Show message box when editing a table column fails
When editing a column of an existing table, this process might fail for
all sorts of reasons. Instead of printing an error message to stdout
this commit changes it to show a message box, so the user knows the
editing failed.
2017-01-04 19:21:32 +01:00
Martin Kleusberg
a40fe0b0ed Fix adding primary keys to tables in the Edit Table dialog
Adding a primary key to a table that didn't had a primary key before
would have added the column to the sqlb::Table::primaryKey::emptyFieldVector
variable (which is static!) instead of actually creating a new primary
key.

This way the primary key wouldn't be created as a new table constraint.

See issue #918.
2017-01-04 18:26:34 +01:00
Martin Kleusberg
31f73df721 Fix removal of primary keys when editing tables
Suppose you have this table:

CREATE TABLE `test` (
	`a`	INTEGER PRIMARY KEY AUTOINCREMENT,
	`b`	INTEGER
);

Editing this and removing the primary key would lead to this table
statement:

CREATE TABLE `test` (
        `a`     INTEGER,
        `b`     INTEGER,
        PRIMARY KEY()
);

This is fixed by this commit, the invalid empty primary key line isn't
outputted anymore.
2017-01-04 18:13:47 +01:00
Martin Kleusberg
f7a29ff541 Fix editing of primary and foreign keys for existing tables
See issues #872 and #918.
2017-01-04 17:54:59 +01:00
Martin Kleusberg
e3cd04618e Fix typo in comment 2017-01-04 17:15:30 +01:00
Martin Kleusberg
c782ab665f plot: Don't generate colours randomly
This adds a basic table of 12 colours which DB4S chooses from when new
plot graphs are added. This also introduces a pointer to this table of
colours which if moved forward each time a graph is added. This it's
less likely that two graphs have the same colour in one plot.

A better but more complex approach would be to find an algorithm to
generate new colours dynamicalls. See issue #816 for details.
2017-01-03 21:00:29 +01:00
Martin Kleusberg
876f25d341 Remove dead code
Please correct me if I'm wrong but I don't see how this if statement
would ever execute the else part.
2017-01-03 20:49:21 +01:00
Martin Kleusberg
3be39f2135 Show more items in tables combobox in Browse Data tab
See issue #867.
2017-01-03 20:31:58 +01:00
Vladislav Tronko
c677872ba5 Make it possible to remove table constraints of specific type 2016-12-30 04:56:11 +02:00
Vladyslav
4bd899c54c Update TestRegex.cpp to fix Travis build 2016-12-29 21:06:02 +02:00
Vladislav Tronko
210916cfeb Use references instead of pointers where it's possible
In our case DDBrowserDB shares lifetime scope with MainWindow, so
there's no need to pass pointers back and forth.
2016-12-29 20:38:24 +02:00
Martin Kleusberg
5697e475b5 Add keyboard shortcut for browse table combo box
See issue #908.
2016-12-28 13:23:41 +01:00
Vladislav Tronko
70ff691f1a Fix bugged pagination (close #912) 2016-12-23 21:01:33 +02:00
Oleg Prutz
c34cd22f43 Fix identaton (replace tabs with spaces)
This commit replaces tabs which were introduced in 17369b6 with spaces
2016-12-23 00:12:09 +03:00
Justin Clift
fbbd8304bc Merge pull request #910 from prutz1311/master
Fix identaton (replace tabs with spaces)
2016-12-22 11:58:18 +00:00