well, yes I forgot about that query even may change in translate
statement, so to store the positions is not always a good solution, you
are right. Maybe we could simply put the comments after the query
string, still the user is able to store comments, and the query is ok,
however the original position is lost, but the order of comments is
keeped, so I guess it's not such a bad thing. But in this case to use a
vector is needless, just a simply OUString is enough to store the
comments. And yes, my problem was about this case, but somehow my former
patch worked before, is it possible that translate statement has just
been modified? I guess you should comment out some lines in my patch,
and put all the comments after the query.
Gabor
2011. 09. 02. 10:09 keltezéssel, Eike Rathke írta:
Hi Jenei,
On Thursday, 2011-09-01 22:08:33 +0200, Jenei Gábor wrote:
LibreOffice Base if you turn on running SQL query in SQL edit view
it will pass the SQL query directly to HSQL without any type of
modification, or check, so if you push this button it should work
totally as a HSQL prompt.
Played a bit with those, while delComment() in parseTree() seems to
work, the getComment()/concatComment() in translateStatement() does not
because
sTranslatedStmt = m_xComposer->getComposedQuery();
never includes LFs in its normalized return, so the following
sTranslatedStmt = concatComment( sTranslatedStmt,
sComments);
doesnt do anything. This may be what you experienced earlier as well
when you wondered that something was eating the LFs. With the positional
approach not searching for LFs it may have worked accidentally if
original query and composed query were identical except one trailing
comment.
Without messing with the parser itself (and even then we wouldn't know
if following stages would handle the result) I don't see a clean way to
solve this, so I suggest to keep delComment() in parseTree() and discard
getComment()/concatComment(), unfortunately that will lose comments at
some (unimportant?) stage, but the query form seems to remember the
original query at least.
If no objection, I'll commit this evening.
Eike
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice