Bug 42713 - query design view loses SQL comments
Summary: query design view loses SQL comments
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
3.4.3 release
Hardware: Other All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Database-Queries
  Show dependency treegraph
 
Reported: 2011-11-08 08:24 UTC by Lionel Elie Mamane
Modified: 2018-12-20 09:51 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lionel Elie Mamane 2011-11-08 08:24:25 UTC
SQL comments are lost when going through design view and back.

There would be two ways to fix that:

1) Don't throw comments away to form the SQL parse tree, but introduce a "comment" node. This is robust against changes to the SQL, but can introduce all kinds of bugs in code that does not expect a "comment" node.

2) In general, don't touch parts of the SQL string that are not modified. That is, each SQL parse tree node is decorated with the string that it was parsed from, and the parse tree -> string transformation function uses these to regenerate the original string; a new node (that was added directly, not from parsing a string) would not have this annotation and the parse tree -> string transformation would then fallback to generating a fresh string. This would at least not loose comments that are not just before (or after, dependending on whether the comment is grouped with the node before or after it) a modified node.

   If we take this route, we will probably need to fork the parse tree -> string function into two variants:
   1) with the current behaviour;
   2) with the behaviour above.
   Number 1 would be used for generating SQL to be sent to the DB engine, and number 2 for SQL to show the user and/or being stored.

   It would also be nice to have a UI way to manually force a string -> parse tree -> string round-trip with the last step being done by number 1, if the user wishes so. Call it e.g. "canonicalise SQL". For this use, it would be nice for number 1 to *not* strip off comments, while for sending to DB, comments stripped off is good. So make it a boolean option in that function.
Comment 1 Alex Thurgood 2015-01-03 17:38:51 UTC Comment hidden (no-value)
Comment 2 QA Administrators 2016-01-17 20:03:40 UTC Comment hidden (obsolete)
Comment 3 QA Administrators 2017-03-06 14:12:33 UTC Comment hidden (obsolete)
Comment 4 Alex Thurgood 2018-12-20 09:51:45 UTC
Problem still unresolved in LO6132