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.
Don't copy images or other binary data to the text MIME type of the
system clipboard. They are still copied into the internal buffer and
into the HTML MIME type though. We don't copy them into the text-only
clipboard because that doesn't really work well. Neither the original
binary data nor a "BLOB" string nor the BASE64 encoded data seem to be a
safe bet, so we just omit these cells.
At the time of pasting, use the generator and date meta tags in the HTML
version for knowing whether our data in the system clipboard has been
overwritten. If not, the internal buffer has better data, so we use it.
Since the binary data is not excluded in the system clipboard, images
are also included embedded in the HTML table. Other binary data are encoded
as base64 strings.
SQL and JSON text editor classes have been refactored. A new parent class
for both editors have been added for the common logic implementable without
depending on the specific lexer.
The only visible effect of this change should be that the JSON editor
(issue #1173) now has the same find/replace dialog as the SQL editor.
This prepares for the implementation of the XML editor (issue #1253).
The shortcut is constrained to the Widget context so it does not conflict
with other SqlTextEdit widgets in the application. Now all SqlTextEdit
widgets are able of opening the dialog with the same shortcut and behave
in the same way (do not block the parent window).
The find/replace dialog can now be discovered by the user in the context
menu at the SqlTextEdit widgets.
Avoid inheriting the style sheet in child widgets by naming the widget
type where it is set.
This had the effect, reported in issue #838, of setting an unwanted style
in child widgets, like the tool-tip of the "Load all data" button, the
tool-tip of the SQL results pane or the context menu of the search-bar
edit line.
This crash was introduced in 6d3228a0e3. It
happened when no previous settings were saved for the plot.
Additionally the plot interaction are set once for the plot widget.
This was reported at issue #838.
Warn user if not all data has been fetched and hint about the button for
loading all the data. The attention to this button is attracted changing
its background to a reddish colour and showing a warning in its tool-tip,
which is automatically shown for its default duration.
Default message is simplified and the button is only enabled when it is
useful (users of non-big databases would never be distracted about the
fetching mechanism).
Since this button is also useful for resetting the zoom and axis range,
it is also enabled if the user performs one of these interactions over the
plot.
See discussion at issue #838.
A new setting allows the user to set the text for BLOB data in the cell.
The existing line-edit for setting the NULL text and the new one for BLOB
are updated with the cell background and foreground colors, providing a
preview of the desired changes. An additional preview-only box is added for
the regular fields.
See issue #1263
Settings in Database tab are left-aligned for consistency to other tabs.
See comment in #1173.
This was mistakenly introduced in 7ed1b1db05
The unwanted effect was two new duplicate records inserted.
Additionally the shortcut is made self-documented for the user in the
corresponding context menu.