As part of NETBEANS-189 / https://github.com/apache/netbeans/pull/2820,

The basic PR I believe addresses the main concern of the ticket to allow
autocomplete when no connection is set yet.  These changes are limited to
the SQL Editor project.

However, requested PR review change suggests refactoring and better
handling "connected" vs "unconnected" cases a little better rather than in
the lower level handling when connections aren't available.

So I'm trying to refactor the SqlIdentifier to account for connected and
nonconnected DB sessions for quoting purposes.  This expands the scope of
the changes to include the "SQL Explorer" project.  This seems to make it a
little more complicated than needed.  Should this refactoring be captured
as a separate bug?

While trying to work something out for the refactoring...

I'm moving some methods out from DatabaseMetaDataQuoter into the
"SQLIdentifier.Quoter" to be shareable where applicable for use in
"non-connected" cases.  And also brought in one of the unit test classes
"NonASCIIQuoter" in as wellwith hopes some of this is usable with/without a
connection context.

However, when running the "SQL99-Quoting check"
"testQuoteIdentifierContainingQuotingChar()", it fails on
assertEquals(quoted, quoter.quoteAlways(unquoted)); due to "quoted" = ""test
*""*xx"" vs quoteAlways(unquoted) = ""test*"*xx"" which don't match.

I think the root of this is the "quoteAlways" calling to alreadyQuoted()
which seems to check ends and no quotes within.

In this case there may be a "<table>.<column>" type scenario.  Assume there
is a full identifier which in some context are broken up into
"sub-identifiers [tokens]" each of which may need to handled separately
(i.e. each token checked as opposed to the whole identifier being check)
but now it's handled as the "whole" identifier.

This test worked prior to all the refactoring so assume it's related to
some of the changes but I'm just wondering if this highlights a new bug
that maybe was not accounted for previously.

Should it account for "internal quotes" as well?

Hope this makes sense

Eric Bresie
ebre...@gmail.com

Reply via email to