peedeeboy edited a comment on pull request #2558:
URL: https://github.com/apache/netbeans/pull/2558#issuecomment-743103282


   @ebresie - DB metadata in NB is fetched lazily and cached as required, and 
this appears to be a very deliberate engineering decision in the existing code. 
 Perhaps it would make sense to fetch more (e.g. table / view names metadata) 
at connection time, but what is unfortunate, is that the metadata doesn't 
currently appear shared between all components that need it.
   
   e.g. monitoring an Oracle session I can see that if I expand a Table node in 
the DB explorer, the DB gets queried for the Column metadata. If I then type 
`[tablename].` in the SQL editor, it gets queried again for Code Completion, 
rather than the Column metadata that has already been retrieved being re-used.  
And vice-versa.
   
   There a list of SQL-99 keywords in 
`org.netbeans.modules.db.api.sql.SQLKeywords` which are used by the SQL Lexer 
for syntax colouring (and some other places in NB, like preventing JPA entities 
being created with reserved keyword names in JEE), but not SQL Code Completion. 
 `org.netbeans.modules.db.sql.editor.completion.SQLCompletionQuery` has 
hard-coded Keywords for the completion contexts it understands (basic CREATE, 
SELECT, INSERT, DROP, DELETE scenarios etc.), and gets the database metadata 
for schema/tables/columns...
   
   To me, these are bigger issues, and this PR is a quick win-win (if @isarthur 
could take a look at those couple of bits I mentioned) as:
   
   1) It solves the JIRA ticket, making the existing (albeit limited) SQL Code 
Completion popup automatically, for those who want it
   2) Enables users to disable to disable SQL Code Completion querying the DB 
for metadata completely, for those concerned about it (e.g. @matthiasblaesing ).
   
   Apologies all for butting in on this PR. I'll take a step back now.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to