Set breaks in nested switch where missing.
Fix editModeChanged since it was overwriting the dataType for JSON and
SVG.
Additionally, removed unnecessary conversion in fromJson.
Isolated column names are added to the list of possible auto-completions,
so they can be completed without having to enter first the table followed
by dot. "Table.field" completion is still supported for completing only for
fields inside that context.
See issue #1242
The original Create statement formatting is preserved when the menu option
"Copy Create statement" is selected, regardless of the setting that removes
the line breaks in the schema view.
The Edit Role is requested to the model for getting the original text data.
See issue #1300
The original Create statement formatting is preserved when the menu option
"Copy Create statement" is selected, regardless of the setting that removes
the line breaks in the schema view.
The Edit Role is requested to the model for getting the original text data.
See issue #1300
Make use of signals to connect the selection in plot to the associated
table widget. Every time that the plot is updated from the Main Window
the table widget associated to the table or query is connected to the plot
and the previous widget is disconnected. This allows the selection of the
correct table widget.
Line selection methods moved to the Extended Table Widget to be used as
slots for this connection.
The destroyed signal is also connected for resetting the plot. This fixes
a crash that already existed before this PR, when closing a SQL tab while
the plot is still associated to the table results model.
Revert the savepoint in the Execute SQL whenever possible. We need to
do this after each statement because there are some rare cases where
the next statement might be affected by what is only a temporary and
unnecessary savepoint. For example in this case:
ATTACH 'xxx' AS 'db2'
SELECT * FROM db2.xy; -- Savepoint created here
DETACH db2; -- Savepoint makes this statement fail
See issue #1249.
When dragging and dropping a table from one instance of the application
to the other, the tree structure representing the database was broken.
We would show the 'Browsables' and 'All' nodes at the top level instead
of the child nodes of the 'All' node. This happened because after
dropping a table, we would reload the database structure and rebuild the
tree structure but didn't notify the tree view in the main window about
the update. This is fixed by this commit, so the main window's widgets
are always notified about the new tree structure.
See issue #1288.
The crash is avoided if the table model is not editable, since insertRows
checks that. A table model for a DB view should be not editable, so this
fix avoids the crash and possibly other possible misbehaviours.
Three different date/time data types are detected and appropriately
displayed in the axis:
- DateTime: "yyyy-MM-dd\nhh:mm:ss"
- Date: "yyyy-MM-dd"
- Time: "hh:mm:ss"
Now that the plot may contain graphs and curves, the plottableCount()
function must be used instead of graphCount() for checking whether the plot
has any plotted items.
This had the effect reported in issue #821 of breaking the enable check for
the fetch-all button.
The tables/queries sorted by X are drawn using QCPGraph as before.
Since QCPGraph does automatically sort by X, we change to QCPCurve that
requires a third data vector to reflect the order. We get that from the
current row order.
In the case of curves, only None and Line is supported as line style.
Since the order is now important for the plot, it is automatically updated
whenever the user sorts by another column in the browsed table.
This addresses issue #821 and indirectly fixes the problem of incorrect
point->row selection link when the table is not sorted by X, reported in
issue #838.
Added a new setting for completing the SQL keywords in upper case (default
being true).
Scintilla setAutoCompletionCaseSensitivity is set to false. Otherwise the
completion is only done in lowercase when both case versions are added,
or if only upper case version is added, writing lower case letters does
not use the upper case version of the word in the completion list. This
change doesn't have apparently any downside, since SQL is actually case
insensitive.
Consequently the list of keywords is only added in one of the two letter
case versions, depending on the new setting value.
The new preference check-box is only enabled when the auto-complete
check-box is checked.
See issues #1238 and #1287.
Before bbac655499 it was possible to delete
a set of selected rows. This makes it possible again by only selecting the
row if it is not already inside the selected rows. See issue #1283.
Additionally and for coherence, the "Duplicate record" from the context
menu is also made to apply to the list of selected rows. See issue #1090
This makes sense from the user point of view, since it remarks that the
options from the menu applies to that row. This change will also fix the
different behaviour of the "Delete record" and "Duplicate record" in the
context menu. See issue #1283
In the code for removing comments from SQL statements we have to make
sure to only match the '--' characters when they are not inside a quoted
string or identifier. This works fine and as expected for single quotes.
However, for double quotes it doesn't. This is fixed by this commit.
See issue #1270.
Don't set the modified flag of the main database if we're attaching or
detaching another database since these actions don't alter the original
database.
See issue #1249.
The same fix for BOM detection in startsWithBom as already applied in
c9c848e995 for removeBom, otherwise binary
data is considered text.
Fixed also check for "\x00\x00\xFE\xFF" and "\xFF\xFE\x00\x00", that are
the problematic BOMs since they contain the null character.
This fixes a bug introduced in 27c657902e.
In that commit we are checking if a string starts with a Unicode BOM and
remove the BOM if necessary. Apparently though Qt's startsWith()
function doesn't work as exected here, so it's changed to a manual
comparison in this commit which seems to work fine.
The first person who can explain that behaviour to me gets a free beer
if we meet in person.
See issue #1279.
See issue #1282.
In the Structure tab you can drag & drop entire tables. This copies the
CREATE statement of the table along with the INSERT statements for the
table data. However, for the table data we would use the data as shown
in the table view cells, i.e. 'NULL' for NULL values or truncated data
for very long strings. This is at least partly improved by this commit.
It doesn't treat NULL or BLOB values 100% correctly but fixes the
truncation problem and at least makes the issues in the other cases a
bit more obvious.
* Allow users to drag and drop fields from DB Schema dock to editor
This is the first attempt to provide the functionality described in #119.
Drag in the dock is enabled (it was only enabled in the Database Structure
tab). Then the fields are enabled for dragging and finally the MIME data
exported for the drag and drop is tailored for exporting only the escaped
field identifier.
This may interfere to other uses of drag&drop in the Database Structure.
* Allow the user to drag individual items from the DB Schema dock
By allowing extended selections of individual items in the dock version,
we let users select what they want to drag and drop. When dragging a list
of items from the Name column, a list of escaped identifiers with commas is
exported, making easier the composition of SELECT and other statements.
In this way, every item name can be dropped, without loosing the ability
of exporting the SQL statement for the item. It will just depend on which
column is selected.
For the DB Structure tab, the original behaviour of single row selection
is maintained. In that case, only the SQL column is exported, as before.
See issue #119.
Detect some Unicode BOMs and always treat data starting with a BOM as
text. We might need to fine-tune this later but it should be an
improvement already.
In the Edit Dialog remove the BOM from the text editor but keep it in
the hex editor. Also add it back to the text when saving changes in text
mode. This way the BOM is out of the way for text edits but is not lost
either when editing a cell.
There are two places in the code where we check for binary data in
database cells. This commit takes the code and moves it into a separate
function so it's easier to improve the situation in both function
simultaneously.
The current table encoding is used in the binary check, so text encoded in
8-bit encodings is properly recognised as text in the table widget.
Make it possible to reset the encoding used in the way suggested to the
user: "Leave the field empty for using the database encoding". Currently it
was rejecting it with the message: "This encoding is either not valid or
not supported."
See issue #1279
For table cells with text larger than 32768 characters, the data gets
truncated. If the user doesn't notice this somehow and hits the Escape
key the truncated data is written back to the database resulting in a
possible data loss.
This problem is fixed by this commit in two ways:
1) The maximum length of the editor widgets is increased to the maximum
value making this problem much more unlikely.
2) If the user is still hitting this value, i.e. the text is truncated
anyway, the widget is put into read only mode and no data is written
back to the database.
See issue #1281.