netbeans-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Bresie <ebre...@gmail.com>
Subject Re: SQL Autocompletion - Quoter Refactoring breaks quoter check
Date Sun, 06 Jun 2021 16:00:37 GMT
Okay...I've concluded my connectionless refactoring is breaking more unit
tests than preferred and is not a good viable option.

I've reverted back to the state as of the last commit for the PR and would
like some guidance from someone more well versed than I on how to handle
this.

Assume can either
(1) take it as is in the PR and maybe write a new ticket on the refactor
aspect (Refactor SQL quoter to handle connection or connection less cases)
or
(2) if someone more well verses in the sql code can provide suggestions for
a new approach I would be welcome to.

Some help/suggestion/mentoring is appreciated.

Eric Bresie
ebresie@gmail.com


On Sat, May 15, 2021 at 11:59 AM Eric Bresie <ebresie@gmail.com> wrote:

> 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
> ebresie@gmail.com
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message