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, 20 Jun 2021 16:10:44 GMT
Regarding https://github.com/apache/netbeans/pull/2820

Adding currently identified reviewers to "To"

I realize everyone has other priorities and that the comments/discussions
on the PR may be a little chaotic and confusing so in summary, I have:
(1) Resolved issues adding logic to account for cases when connection is
not available and allow sql autocomplete to work even without an active
connection
(2) This no longer shows the dialog asking for connection which prevented
autocompletion previously, but still shows when attempting to "execute" a
query where a connection is really needed (similar to how other sql editor
type applications may do things [i.e. wait until such time as absolutely
needed]
(3) I removed any unnecessary changes (i.e. hints - created ticket
NETBEANS-5474
Add SQL Hints to address this),
(4) I have squashed [to the best of my abilities] and reduced the changed
files to only applicable 3 files in the Sql Editor project, and
(5) I have adjusted the quoter logic to no longer return an empty string
and have a minimum form of quoter/unquoter which still works in the unit
tests for the SQL projects
(6) I have not re-architected to introduce any kind of "Standard SQL
Quoter" class at this time as I believe this is likely a larger effort
which I propose raising a new ticket to create a Standard SQL Quoter class
and retrofit the code as part of that work.

*Assume this would involve developing a new class for such and
handle standardized quoting of identifiers similar to what is discussed (
https://www.w3resource.com/sql/sql-syntax.php#IDENTIF
<https://www.w3resource.com/sql/sql-syntax.php#IDENTIF> ).  *
*For this I (or whoever takes this on) would need to better understand what
the expected input/outputs are for this and what kind of tests would be
needed to confirm this does as expected beyond the existing sql tests. *

(7) There may also be another SQL improvements ticket to raise as mentioned
in this comment in the discussion

*Looking at one of the w3 resources SQL syntax page in identifier section
<https://www.w3resource.com/sql/sql-syntax.php#IDENTIF> it does look more
complicated.*

*The w3 reference mentions after "SELECT" there can be optionally "DISTINCT
| ALL" and either a wildcard ("*") or select List (i.e. identifiers).
Unless I've missed it, I'm not sure these cases are handled. Is a new issue
for adding that worth wild?*


Does this seem acceptable?  If not, what (besides maybe raising above
tickets) is still needed?

Eric Bresie
ebresie@gmail.com


On Fri, Jun 18, 2021 at 4:46 PM Eric Bresie <ebresie@gmail.com> wrote:

> Can anyone respond to this?
>
> As is, the PR from my perspective fixes the problem.
>
> The last change requested in the PR was made multiple times in multiple
> ways with the request was against an “out of date” version of files so not
>  sure if the PR discussion is ready or able to be closed down.
>
> I believe re-architecting sql autocomplete functionality for connection vs
> connection less session to address quoting and/or sql standard quotes issue
> is probably  out of scope of this ticket.  If that is really preferred then
> maybe a new ticket to address that with more specific would be better for
> that.
>
> What do I need to do to get this accepted for inclusion?
>
> Eric
>
> On Sun, Jun 6, 2021 at 11:00 AM Eric Bresie <ebresie@gmail.com> wrote:
>
>> 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
>>>
>> --
> Eric Bresie
> ebresie@gmail.com
>

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