Commit Graph

639 Commits

Author SHA1 Message Date
Sandro Mani 6b4d079e6a Fix syntax issues 2014-08-27 19:04:35 +02:00
Martin Kleusberg ba9931ac7f EditTableDialog: Add without rowid checkbox
Add a checkbox for setting the 'WITHOUT rowid' flag in the
EditTableDialog. All functionality concerning the checkbox is
implemented by this commit with one exception: Setting/unsetting the
flag on an existing table won't perform any changes yet.

See issue #51.
2014-08-27 18:50:55 +02:00
Martin Kleusberg c7de94cb77 Make it possible to add rows to a WITHOUT rowid table
This commit allows you to add new rows to a table without rowid column.
The main problem here is that SQLite won't create the next value for the
primary key column itself, so we have to do that instead.

See issue #51.
2014-08-26 18:38:04 +02:00
Martin Kleusberg e37df8658c Improve support for 'WITHOUT rowid' tables
This adds support for editing and deleting rows from tables without
rowid. It also fixes a check in the EditTableDialog when activating the
not null constraint as well as making some progress when it comes to
adding new rows.

Also see issue #51.
2014-08-26 17:58:33 +02:00
Martin Kleusberg 7d4248ecb4 Keep field information in sqlb::Table object rather than DBBrowserObject
Keep all the table and field information in a sqlb::Table object (which
itself is stored in DBBrowserObject) rather than storing field
information in DBBrowserObject and sqlb::Table objects at the same time.
2014-08-26 17:52:15 +02:00
Justin Clift a4c8209808 Update the internal OSX .app package number to 3.3.99 2014-08-24 18:38:00 +01:00
Peinthor Rene 63c338c359 plot: add another shortcut to plot CTRL+D
if we maybe have print support in the future,
we can assign CTRL+P to print than
2014-08-24 16:58:13 +02:00
Peinthor Rene 681b143649 dbschema: shortcut for schema pane 2014-08-24 16:50:41 +02:00
Martin Kleusberg 44ce30dacc Fix last commit
Fix missing rowid->_rowid_ in commit55678bb9450a0546835b2d86f5124e7efb0a1109
2014-08-23 12:11:48 +02:00
Peinthor Rene 55678bb945 sql: use _rowid_ instead of rowid
This doesn't really solve the problem, but reduces the chance
to have a nameclash with rowid, until we come up with something better
we can't fully support tables with a column name _rowid_ but that should
be very seldom
2014-08-22 23:21:44 +02:00
Peinthor Rene 3b907df8e3 tablemodel: fix crash if rowdata couldn't be fetched 2014-08-22 23:13:39 +02:00
Martin Kleusberg beae69296c MainWindow: Add new dock showing the DB schema
See issue #75.
2014-08-22 15:05:23 +02:00
Martin Kleusberg 547a4d87a7 MainWindow: Change window title of toolbar from "toolBar" to "DB Toolbar"
Change the window title of the toolbar to the same name it has in the
View menu as the window title actually is visible in the UI when right
clicking on the toolbar or menu.
2014-08-22 14:45:14 +02:00
Martin Kleusberg a3affde782 Make sure columns in the Execute SQL area don't get too big by default
When running a SQL statement the column widths of the result table view
are set to fit their contents automatically. However, for very long
values this makes the table hard to navigate. This is why this commit
introduces a maximum column width while still trying to fit each column
to its contents.

See issue #79, point 2.
2014-08-22 14:27:54 +02:00
Martin Kleusberg cbc324b205 Grammar: Allow rowid as column name
This fixes #80.
2014-08-22 14:10:19 +02:00
Martin Kleusberg 51014a7ddc Grammar: Allow key as column name 2014-08-22 14:07:05 +02:00
Peinthor Rene 9aa73915c3 sqliteparsing: add a flag to indicate if we support modifying in our dlg
This flag should indicate if we can fully handle this table definition
in our edit table dialog. if not we should do one of these things:
* disable the edit table dialog to modify the table
* display a warning message that modifying this table may remove constraints
* ??
2014-08-18 19:41:49 +02:00
Peinthor Rene aff96bf709 grammar: remove trailing WS 2014-08-18 19:17:24 +02:00
Peinthor Rene 6d47c749f8 grammar: proper support the index_column rule 2014-08-18 19:16:45 +02:00
Peinthor Rene 2cadb38719 tablemodel: if our sql parser failed get column names from sqlite
This makes browsing more robust if our sqlite parser fails
we will fallback to a sqlite query to retrieve the column names
2014-08-18 18:53:16 +02:00
Peinthor Rene e9fc2229c2 grammar: disable antlr's default error handling
We(I) did not count on that behavior anyway and this should have never
been in place
2014-08-18 18:47:35 +02:00
Peinthor Rene bd11193235 sqlitetypes: avoid copy of member 2014-08-18 18:40:10 +02:00
Peinthor Rene 32ef063d11 sqlite3: workaround to prevent creating 0 byte sqlite3 database files 2014-08-17 13:05:49 +02:00
Peinthor Rene 9fdc71be2c grammar: fix crash and autoincrement in primary key table_constraints 2014-08-17 12:55:22 +02:00
Martin Kleusberg abe622ebf4 EditTableDialog: Reload the current DB schema when cancelling
All the editing in the EditTableDialog, that is the DBBrowserDB class to
be specific, messes up the current representation of the DB schema. This
is fine when the changes are actually committed by clicking the OK
button but causes confusion when the dialog is cancelled. None of the
changes are actually written to the database but the UI looks like they
are.

This closes issue #74.
2014-08-15 22:54:36 +02:00
Martin Kleusberg b754284073 Grammar: Show antlr error message where possible
When catching an exception thrown by antlr print all the information
which has been provided.
2014-08-15 12:23:51 +02:00
Peinthor Rene cf0213cd7e sqlitemodel: fix endless loop if offset is used in LIMIT 2014-08-13 12:11:03 +02:00
Peinthor Rene 58867aa181 edittable: update comment 2014-08-07 23:17:42 +02:00
Peinthor Rene ff50a94eef edittable: add ability to set the unique constraint on a table 2014-08-07 23:15:38 +02:00
Peinthor Rene f291f89a93 sqlitetypes: extract unique information of columns 2014-08-07 23:14:21 +02:00
Martin Kleusberg ba75bd16fe Use common format for all include guards and avoid leading underscores
Use a common format for all include guards, make sure each header file
has one and make sure it's named after the file name.

And as a random extra in this commit: Make sure the gen_version.h file
generated by cmake ends with a line break.

Closes #59.
2014-07-31 21:32:58 +02:00
Martin Kleusberg 5f4066c351 MainWindow: Show line numbers in SQL log 2014-07-31 21:19:41 +02:00
mafagafogigante 262612928d some comments were corrected 2014-07-31 08:56:24 +01:00
Justin Clift 3b91636740 Update the internal OSX .app package number to 3.2.99 2014-07-27 21:11:54 +01:00
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
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
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