Commit Graph

771 Commits

Author SHA1 Message Date
Martin Kleusberg
373bd5db5b Remove \r characters from table definitions while reading DB layout
Remove all \r characters from a table defintion when reading it. This
makes sure it doesn't appear as a invalid character in the UI.

This commit improves the displaying of EoD's database from issue #63.
2014-07-26 21:41:12 +02:00
Martin Kleusberg
2dd0e9516f Grammar: Allow multiple table keys which are not separated by commas
Fix table definitions like this...
CREATE TABLE [player_tech_branches]
(
	[from_id] INTEGER NOT NULL REFERENCES [techs](id),
	[to_id] INTEGER NOT NULL REFERENCES [techs](id),

	UNIQUE ([from_id], [to_id]) PRIMARY KEY ([from_id], [to_id])
)
...where there are multiple keys which are not separated by commas.

This partially fixed EoD's database in issue #63.
2014-07-26 21:41:12 +02:00
Martin Kleusberg
8d23c77578 Grammar: Fix multiple primary keys with conflict clause
Fix handling of multiple primary keys followed by a conflict clause like
in thix table definition:
CREATE TABLE [explore_records]
(
	[system_id] INTEGER NOT NULL REFERENCES [star_systems](id),
	[player_id] INTEGER NOT NULL REFERENCES [players](id),
	PRIMARY KEY ([player_id], [system_id]) ON CONFLICT ABORT
)

This partially fixes EoD's problem in issue #63.
2014-07-26 21:41:12 +02:00
Martin Kleusberg
7f007824fa Grammar: Support ON INSERT in foreign key clauses
Allow ON INSERT in foreign key clauses like this:
CREATE TABLE x
(
	y INTEGER REFERENCES ref(id) ON INSERT CASCADE
)
Note that ON INSERT is allowed by SQLite but missing in the SQLite
documentation.

This partially fixes EoD's problem in issue #63.
2014-07-26 21:41:12 +02:00
Justin Clift
4cafe43525 Trivial typo fix 2014-07-21 22:36:50 +01:00
Justin Clift
815dae90e2 Removed readline dependancy of SQLite on OSX
Readline isn't needed the way we use things, and it's just an unneccesary dependency
2014-07-21 22:30:07 +01:00
Martin Kleusberg
64bcc42241 Grammar: Add 'NO' identifier
See issue #56.
2014-07-21 21:24:53 +02:00
Martin Kleusberg
b921fe58f3 Fix treatment of spaces when importing CSV files without quotes
When importing a CSV file without no quote characters no spaces were
imported. So this...
a,b b,c
...would become...
a,bb,c

Fix this by not checking for being in quote mode when not having
configured a quote char anyway.
2014-07-20 18:12:46 +02:00
Martin Kleusberg
cd9a563568 i18n: Also build qm files when compiling using cmake and Qt5
Disclaimer: This is untested but looks plausible to me...
2014-07-20 17:37:31 +02:00
Martin Kleusberg
e07067e8bb Merge pull request #57 from VanDerSam/master
I18N was improved. Translation GUI to Russian was made.
2014-07-20 17:32:07 +02:00
Sergey Muratov
87bda982c1 I18N was improved. Translation GUI to Russian was made. 2014-07-15 22:33:17 +04:00
Martin Kleusberg
13464f41d3 Fix spelling. 2014-07-12 16:26:53 +02:00
Martin Kleusberg
42a2faf411 Tests: Simplify the cmake file
Now that the dependeny to the main window is removed from the
DBBrowserDB class we can get rid of all the dialogs and widget related
stuff in the cmake file used for the unit test project. Because our
Application class depends on the main window, too, the code for the CSV
tests is changed to use Qt's standard QApplication class.
2014-07-12 16:21:08 +02:00
Martin Kleusberg
17cf2018ca Remove dependency to main window from DBBrowserDB class
Get rid of the dependency to the MainWindow class in the DBBrowserDB
class. It was only used for calling the log SQL and set database state
functions anyway. The same result can be achieved emitting Qt slots.
2014-07-12 16:13:32 +02:00
Martin Kleusberg
bc705b61f1 Fix stupid spelling mistake in the default gen_version.h file
Fix a spelling error in the include guard of the default gen_version.h
file. It didn't really matter even though this exact file is used when
building with qmake because it never gets included multiple times... but
it just looked odd to me and was a bit annoying since I noticed it :)
2014-07-11 21:35:32 +02:00
Martin Kleusberg
e7924f3739 Tests: Add unit tests for CSV import
Add a new test class for testing the import functionality. Currently
it's only covers some test cases for the CSV import.

Since the function to test here (DBBrowserDB::decodeCSV) is part of the
DBBrowserDB class, that class has a reference to the main window and the
main window basically depends on the entire rest of the project the
makefile grew quite a bit unfortunately.
2014-07-11 21:31:34 +02:00
Martin Kleusberg
ceb74a8cd4 Tests: Make sure the TestTable::parseSQLdefaultexpr() passes
Fix some issues in the parseSQLdefaultexpr unit test to make it actuall
pass.
2014-07-10 21:38:35 +02:00
Martin Kleusberg
ad392fa662 Merge pull request #47 from TheVanDoom/master
Fixed a problem with the import of .csv-files

This fixes the import of CSV files with multi-byte UTF-8 characters in them. Also handle CSV files without a trailing line break better.
2014-07-10 17:32:08 +02:00
Peinthor Rene
0df6148afe unittest: add test for literalvalue in default constraint 2014-07-10 07:30:25 +02:00
Peinthor Rene
f3a2a74953 grammar: fix missing literalvalues in default constraint 2014-07-10 07:30:05 +02:00
Peinthor Rene
6705e8c9f2 show real insert data after insert a new row
After the insert statement the inserted row
will be fetched and shown in the browse table.
2014-07-10 00:33:41 +02:00
Peinthor Rene
00ae461dff add a getRow function to retrieve rowdata by rowid 2014-07-10 00:31:45 +02:00
moritzhader
37e195ad6f Fixed a problem with the csv-import.
During the import, the parser used to append blanks between quotes and separators as part of the cell-content.
Now blanks are detected and ignored, iff they are not used as separator or in between quotes.
2014-07-09 20:29:11 +02:00
moritzhader
e86e648124 Changed the read-line command
Previously, the read-line was performed using the stream-operator. Unfortunately, this approach limited the possible reading range to a word, causing problems when parsing files with blanks between the quotes and separators.
Instead, the readline is performed using the readLine() method of the QTextStream class.
2014-07-09 19:56:22 +02:00
Moritz Hader
d8bc658df7 Fixed a problem with the import of .csv-files
Up until now, the DBBrowserDB:decodeCSV used to load the csv-file character by character using the getChar() method of the QFile-class.
Unfortunatelly, this approach caused multibyte-chars as used for UTF-8 encoding to be split and displayed incorrectly.

The fix uses the QTextStream-class to load the file line by line.
Every line is then again iterated character by character, before the old algorithm is applied. Using this approach, the characters are loaded and encoded properly. Splitting multibyte-chars is thus prevented.
2014-07-08 16:08:12 +02:00
Martin Kleusberg
a6a735ed24 Remove link to old website from Readme file
Remove the link to the old project website from the Readme file since that page just redirects to our new one anyway.
2014-07-07 18:35:51 +02:00
Martin Kleusberg
bee4320236 Add 3.2 release to readme file 2014-07-06 23:44:03 +02:00
Martin Kleusberg
a00e2b184d Announce new release 2014-07-06 23:42:41 +02:00
Peinthor Rene
14757544b7 Merge pull request #44 from justinclift/master
Added unit test compile and run instructions to BUILDING.md
2014-07-06 10:11:48 +02:00
Justin Clift
72ee0ce192 Added unit test compile and run instructions to BUILDING.md 2014-07-06 09:07:02 +01:00
Peinthor Rene
968c12ae7c cmake/unit: fix incorrect antlr include path 2014-07-06 09:45:11 +02:00
Peinthor Rene
517fc1182e cmake: avoid long lines in cmake file 2014-07-06 09:34:54 +02:00
Peinthor Rene
f2658958ce unittest: add a check for not exists 2014-07-05 15:16:16 +02:00
Martin Kleusberg
88a4caedba Fix crash when sorting one table in the Browse Tab and changing to another
Fix a crash when sorting the n-th column of a table in the Browse Tab
and then changing to a table with less than n columns.
2014-07-03 22:40:03 +02:00
Peinthor Rene
e1ea78fdda grammar: add tests for like operator and between 2014-06-25 19:20:58 +02:00
Peinthor Rene
dd85b16660 grammar: cleanup expr and fix between suffix expression 2014-06-25 19:20:40 +02:00
Martin Kleusberg
d85672511c Grammar: Fix parsing of NOT IN/GLOB/MATCH/REGEXP constraints
See issue #40.
2014-06-23 12:37:09 +02:00
Justin Clift
9fb75d181f Ensure the Homebrew version of SQLite3 is found 2014-06-23 01:05:00 +01:00
Martin Kleusberg
dca664270f MainWindow: Make it possible to cancel closing of database file
When closing the database, either by using the menu item or by closing
the window, the user is asked whether the changes he made shall be
saved or not. Add a third button to this message box which makes it
possible to cancel the action.
2014-06-20 13:03:23 +02:00
Martin Kleusberg
3da0d36463 Tests: Make sure all unit tests pass
Two unit tests where failing because of missing spaces in the expected
result string.
2014-06-20 12:51:56 +02:00
Martin Kleusberg
980f42d200 Tests: Add unit test for CHECK NOT LIKE constraint
Add a unit test for the grammar fix in
9cb0614ecf.
2014-06-20 12:50:30 +02:00
Martin Kleusberg
9cb0614ecf Grammar: Parse NOT LIKE constraints correctly
Parse column constraints with a 'NOT LIKE' expression correctly. For
example in a table definition like this:
CREATE TABLE not_working(
    value TEXT CONSTRAINT "value" CHECK(value NOT LIKE "prefix%")
);

This fixes issue #40.
2014-06-20 12:47:20 +02:00
Peinthor Rene
682561fbb9 editdialog: accept shortcut for CTRL+Enter 2014-06-19 16:08:44 +02:00
Martin Kleusberg
2136813bd6 MainWindow: Add Ctrl+Return shortcut for executing SQL and add tooltips
Add the Ctrl+Return shortcut for executing the current SQL again. This
needs to be done using C++ code instead of setting it in Qt Designer
because setting multiple shortcuts in the latter means defining a key
sequence row.

Also add the keyboard shortcuts to the tooltips of the buttons as they
didn't appear anywhere in the program.
2014-06-14 13:51:12 +02:00
Peinthor Rene
651e3bf146 edittable dialog: add splitter and better default size
I added a splitter and set better expanding properties
2014-06-13 18:14:09 +02:00
Peinthor Rene
25fe80f5f9 remove Ctrl+Return shortcut from executing sql
somehow neither F5 nor Ctrl+Return would work in that combination
2014-06-13 18:02:17 +02:00
Martin Kleusberg
f1e5502d50 Fix bug in filter function when havin multiple filters
Since commit 707323067d there has been a
bug in the SqliteTableModel::setQuery method which rendered the filters
useless when using them on multiple columns: Because this method is
called whenever a filter value is changed and because it deleted the
internal representation of the filters all filters except the one last
modified were deleted but still shown in the UI.
2014-06-12 19:54:09 +02:00
Martin Kleusberg
2b65bbcea2 EditDialog: Fix text editor when NULL chars are typed in hex editor
When using the hex editor widget of the Edit Dialog to insert a NULL
character and then changing to the text editor without saving and
reopening the window first lead to the text being truncated at the NULL
character.
2014-06-12 18:53:53 +02:00
Martin Kleusberg
b407704959 EditDialog: Use Monospace font in text editor 2014-06-12 18:51:23 +02:00
Peinthor Rene
f246ddde1e correctly extract check expression from AST 2014-06-11 22:48:51 +02:00