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.
We're reading CSV files not all at once but in chunks. And when we're
encountering a \r char we're checking if it is followed by a \n char. So
far so good. But now it might happen that we're hitting a \r char that's
right at the end of the current buffer. In this case the lookahead check
isn't working as expected because there isn't more data available yet.
This commit fixes the issue by checking for these conditions and loading
an extra byte when needed.
See issue #1033.
When importing a CSV file into an existing table (i.e. a table where we
have a table schema), check the data type of a field before inserting
empty values. If it is an integer field, don't insert empty string like
we did before but 0 or NULL depending on the NOT NULL flag.
See issue #195.
Please note that this isn't perfect. The preview in the dialog doesn't
reflect these changes yet, it just show you the contents of the file as
is. It's a little tricky to change this and I somehow think it's better
the way it is now anyway. Also the import doesn't check for other
constraints like UNIQUE or CHECK which might cause trouble. But then
again it didn't do that before either.
When importing a CSV file and using the first row as the field names,
the row would be imported as the first data row again. It's now skipped
when the checkbox is set.
When importing a single CSV file the checkbox asking whether to import
into a single table or separate tables is hidden. However, the last set
values are loaded anyway when the dialog is opened. This means the
checkbox could be set, even though it's invisible. If it's set, however,
and we're importing a single CSV file this would mean that it's
impossible to manually set the table name to import into. This is fixed,
too.
Also this simplifies the code a bit and removed a large loop from the
import dialog code.
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.
Don't allow removing expression columns by double clicking as this it
too error-prone. Instead require a button click for removal and only
start editing the expression when double clicking.
See issue #1012.
Add a context menu to all table view widgets in the program (Browse Data
tab and Execute SQL tab) which opens when right clicking a table item.
Currently the menu only allows you to copy and paste the selected
item(s).
Only activate the paste action when the current view is writable.
Browsing WITHOUT ROWID tables was broken since a couple of commits. An
error message would be printed to the console and all cells would stay
empty. This is fixed by this commit.
When pasting data into a cell of a view the application would have
crashed because it treats the view as a table (which it isn't). This is
fixed by this.
- 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
Add a button for adding new expression columns to the Edit Index dialog.
Allow the user to edit the 'name' of existing expression columns in the
Edit Index dialog.
This adds a new field to the Edit Index dialog that allows the user to
change the partial index expression for an index.
Example:
CREATE INDEX i ON a(
col1 ASC,
col2 DESC
) WHERE id < 1000; -- This bit here
Change the layout of the dialog entirely. Instead of having checkboxes
that, if activated, move a column into the index, use two separate table
views, one for available columns and one for used columns. This makes it
easier to see the index structure on first sight. It also makes it
possible to see the order of the different index columns from the table
views. Additionally, now expression columns that are used in the index
are shown in the table views, even allowing them to be removed from the
index.
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.
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.
When possible, don't write 'CREATE TABLE/VIEW/... `name`' but 'CREATE
TABLE/VIEW/... IF NOT EXISTS `name`' to the file.
Add an option to add DROP TABLE statements before each create statement.
This needs to be enhanced to apply to views, indices, and triggers as
well. See issue #629.
Clean up code.
When creating a new database we execute a couple of SQL statements after
opening the new file. However, since none of them happen in a
transaction there's no need to commit them. This change gets rid of the
commit statement and avoids a warning being printed by doing so.
See issue #583.
In the plot code use the blockSignals() method instead of connecting and
disconnecting signals and slots every time. The disconnects didn't
really work using the new C++11 connection code, so this commit restored
the functionality as it was intended.
This means that *a ton* of calls to updatePlot() are eliminated which
improves the performance.
It also avoid messing up the graph selection table in the Plot Dock in
certain cases.
See issue #950.