You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
would love if we were able to edit(UPDATE) the returned SQL records from a SELECT query without having to manually issue an UPDATE statement or switching back to the data editor tab.
When i run a SELECT query, the results are not editable. Double-clicking in the cells does nothing. Would be awesome if i could edit the results in-place.
Actually changing the database would be a part of this issue as far as I can see because @Volkanite mentions UPDATE statements (which would write to the database file).
This feature is definitely nice to have but unfortunately rather difficult to implement. The problem is that you can form quite complex SELECT statements for quering the database but you can't simply transform then into an UPDATE statement for modifying the database because SQLite doesn't support that complex UPDATE statements (no joins in them etc.). So we'd have to somehow transform the SELECT statement into an UPDATE statement by trying to interpret the SELECT statement and guessing which cell of the result view originates from which column of which table. We'd probably also have to modify each SELECT statement prior to execution to always include the primary key of each table (and then hide it in the view) because this is the only way I can think of which allows us to find out which row the edited cell belongs to.
So, in short, this is possible but would require a lot of work for parsing and understanding SELECT statements which we currently don't do at all. We could maybe try to support this for some SELECT statements and not all of them but it'd still require some effort 😃 I'd suggest keeping this issue open but don't count on this being finished soon ;)
I just realised that this is actually a lot easier to implement than I thought. I'll leave this link here in case I forget about this until I find the time to actually implement this: https://sqlite.org/c3ref/column_database_name.html
Don't forget this line, "These APIs are only available if the library was compiled with the SQLITE_ENABLE_COLUMN_METADATA C-preprocessor symbol." otherwise you'll be looking at the code on your flashy new monitor scratching your head wondering why it's not working. 😉😉😜
Activity
justinclift commentedon Aug 4, 2015
Hmmm... trying to imagine how that would work. 😄
Are you ok to explain that in more detail, so we get a better understanding of what you mean?
Volkanite commentedon Aug 5, 2015
When i run a SELECT query, the results are not editable. Double-clicking in the cells does nothing. Would be awesome if i could edit the results in-place.
justinclift commentedon Aug 6, 2015
Ahhh, you're meaning to just allow editing in the result widget yeah? Not meaning actually changing the database data when you edit the result?
MKleusberg commentedon Aug 6, 2015
Actually changing the database would be a part of this issue as far as I can see because @Volkanite mentions UPDATE statements (which would write to the database file).
This feature is definitely nice to have but unfortunately rather difficult to implement. The problem is that you can form quite complex SELECT statements for quering the database but you can't simply transform then into an UPDATE statement for modifying the database because SQLite doesn't support that complex UPDATE statements (no joins in them etc.). So we'd have to somehow transform the SELECT statement into an UPDATE statement by trying to interpret the SELECT statement and guessing which cell of the result view originates from which column of which table. We'd probably also have to modify each SELECT statement prior to execution to always include the primary key of each table (and then hide it in the view) because this is the only way I can think of which allows us to find out which row the edited cell belongs to.
So, in short, this is possible but would require a lot of work for parsing and understanding SELECT statements which we currently don't do at all. We could maybe try to support this for some SELECT statements and not all of them but it'd still require some effort 😃 I'd suggest keeping this issue open but don't count on this being finished soon ;)
Volkanite commentedon Aug 7, 2015
I understand the difficulties. Thank you for at least considering it.
MKleusberg commentedon Mar 15, 2021
I just realised that this is actually a lot easier to implement than I thought. I'll leave this link here in case I forget about this until I find the time to actually implement this: https://sqlite.org/c3ref/column_database_name.html
chrisjlocke commentedon Mar 15, 2021
Don't forget this line, "These APIs are only available if the library was compiled with the SQLITE_ENABLE_COLUMN_METADATA C-preprocessor symbol." otherwise you'll be looking at the code on your flashy new monitor scratching your head wondering why it's not working. 😉😉😜