-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow viewing via the EditDialog for executed sql statements #570
Conversation
Editing is disallowed, becuase we do not know which table the freeform query operates on
@@ -32,7 +34,8 @@ class SqlExecutionArea : public QWidget | |||
SqliteTableModel* getModel() { return model; } | |||
QTextEdit* getResultView(); | |||
SqlTextEdit* getEditor(); | |||
|
|||
ExtendedTableWidget *getTableResult(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, this seems to be using embedded tabs instead of spaces.
Would you be ok to fix that (for the other files you're touching too)? 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, sorry. These are the (retarded) whitespace settings I had to configure for work.
Should be fixed
Thanks, trying it out here now. 😄 |
Hmmm, I must be blind... I'm not noticing a change from an end user point of view? Er.... clue me in? 😀 |
@@ -989,7 +989,8 @@ void MainWindow::mainTabSelected(int tabindex) | |||
} else if(tabindex == 3) { | |||
SqlExecutionArea* sqlWidget = qobject_cast<SqlExecutionArea*>(ui->tabSqlAreas->currentWidget()); | |||
|
|||
m_currentTabTableModel = sqlWidget->getModel(); | |||
if (sqlWidget) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops! 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got me. It's late.
Ah. I think there is a double-click action missing, so I have to admit it is nonobvious: To see what I am trying to accomplish:
I use this for a db that has lots of JSON blobs that I need to inspect. |
Ahhh, interesting addition. Found a bug in it though, where it's not clearing the existing Edit Cell data when a new field on the same row is clicked. The test database I'm using is very small (516KB). Just emailed it to you, along with the SQL used to trigger the bug. Hopefully it's something simple. 😄 |
Yes, please. Also, I'll look into adding a double click action so that the Edit Dialog opens when a cell is double clicked. That would make the new functionality much more discoverable. (But not today, I'll look into it tomorrow) |
Sure, no worries at all. It's late here for me too. 😄 |
I added the double click action (much better). But I can not reproduce your bug on my machine. In any case, I don't understand how I could have introduced that sort of bug - this pull request mostly only connects the edit dialog with the result table. Can you reproduce your bug when browsing the table? |
Cool. 😄 For the weird bug behaviour, @MKleusberg returned from holidays yesterday, so he's probably the right person to review bits. (there is a large queue for him through 😵 ) I really should get around to learning C++ eh? 😉 |
Hi Lars! I'm not sure either how the bug mentioned by Justin could be introduced by this. But maybe he can help us out here debugging this - though I assume the bug is to be found somewhere else, most likely in my code for the edit cell panel itself, not in your code. So I probably won't be worrying about that too much for this pull request. |
Thanks for the quick thumbs-up (to both of you) If you have suggestions regarding code style, do let me know and I will update the pull request |
@@ -270,7 +270,8 @@ QSet<int> ExtendedTableWidget::selectedCols() | |||
void ExtendedTableWidget::cellClicked(const QModelIndex& index) | |||
{ | |||
// If Alt key is pressed try to jump to the row referenced by the foreign key of the clicked cell | |||
if(qApp->keyboardModifiers().testFlag(Qt::ControlModifier) && qApp->keyboardModifiers().testFlag(Qt::ShiftModifier) && model()) | |||
if(qApp->keyboardModifiers().testFlag(Qt::ControlModifier) && qApp->keyboardModifiers().testFlag(Qt::ShiftModifier) | |||
&& model()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to keep this line as it was. Since there is no code changed in this file, changing the formatting of this line could be confusing later: it looks like the code in this file was changed by this commit when in reality it wasn't. Hope this makes sense 😀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry - that was just an automatism on my part. I'll revert that change
I've put some comments concerning the code-style in your commits. Nothing major, though 😃 There's one more techical suggestion in there, too. Despite those I just noticed one more thing: if you have multiple SQL tabs opened, each showing a query result with a selected cell, the edit cell panel isn't updated when you switch between the tabs. This might be a bit confusing for the user to see the 'old' value there. But again, nothing major 😀 If you're interested you could maybe add a new slot which is getting triggered when the selected SQL tab changes and which just updates the panel to the current selection. Sorry again for the nitpicking parts 😃 I actually think this is quite a good pull request which I hope we can merge as soon as possible 👍 |
Hi @MKleusberg: I've made the changes you suggested - thank you for your thorough review. I'll look into the new slot for multiple SQL tabs this evening, but I'd prefer to open a new pull request for that. |
Awesome! Looks good 👍 Thank you very much for this 😃 If you should need any help with your next pull request feel free to always open an issue or email me directly - I'd be glad to help out. |
This patch allows to view result data from the Execute SQL tab in the EditDialog.
This patch is lightweight and already useful to me - and hopefully other people
Ideally, I'd like to be able to edit the data too, but I couldn't get it to work, because when the user enters freeform SQL, it is nontrivial to determine what the underlying table is (see http://www.sqlite.org/sessions/lang_select.html).