Skip to content

editable returned SQL SELECT records #393

Open

Description

@Volkanite

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.

Activity

  1. justinclift commented on Aug 4, 2015

    @justinclift
    Member

    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?

  2. Volkanite commented on Aug 5, 2015

    @Volkanite
    Author

    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.

  3. justinclift commented on Aug 6, 2015

    @justinclift
    Member

    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?

  4. MKleusberg commented on Aug 6, 2015

    @MKleusberg
    Member

    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 ;)

  5. Volkanite commented on Aug 7, 2015

    @Volkanite
    Author

    I understand the difficulties. Thank you for at least considering it.

  6. MKleusberg commented on Mar 15, 2021

    @MKleusberg
    Member

    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

  7. chrisjlocke commented on Mar 15, 2021

    @chrisjlocke
    Member

    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. 😉😉😜

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions