Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 195880 - SQL Command tab is more descriptive of connection
SQL Command tab is more descriptive of connection
Status: RESOLVED FIXED
Product: db
Classification: Unclassified
Component: Code
6.x
PC Windows 7
: P2 (vote)
: 7.4
Assigned To: Jaroslav Havlin
issues@db
: NETFIX, UI
: 212583 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-02-23 17:10 UTC by borlak
Modified: 2013-03-01 02:00 UTC (History)
3 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
Proposed Patch (15.17 KB, patch)
2013-02-22 13:33 UTC, Jaroslav Havlin
Details | Diff
Proposed Patch v2 (15.85 KB, patch)
2013-02-22 13:51 UTC, Jaroslav Havlin
Details | Diff
proposed patch v1 (mb) (13.29 KB, patch)
2013-02-23 21:55 UTC, matthias42
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description borlak 2011-02-23 17:10:38 UTC
I have multiple database servers with multiple databases.

After connecting to them in NetBeans and doing an "Execute Command", it will open a tab with the name "SQL Command 1", and subsequent Execute Commands will be numbered similarly.

It would be greatly helpful if these could be slightly more descriptive.  Ideally I would like to have 5+ of these open, and I would quickly lose track of what they are linked to.  

So I have a database name "vader" and the current schema is "force", when I do an "Execute Command" on this connection it will open up a tab that says "vader - force" instead of "SQL Command 1".
Comment 1 Jiri Rechtacek 2011-02-24 08:25:11 UTC
Right, it's RFE makes sense to me. Will be consider while planning phase of the next NetBeans release.
Comment 2 matthias42 2012-05-17 11:55:03 UTC
*** Bug 212583 has been marked as a duplicate of this bug. ***
Comment 3 Jaroslav Havlin 2013-02-22 13:33:29 UTC
Created attachment 131737 [details]
Proposed Patch

The proposed patch changes format of SQL tab names (and file names), examples:

SQL SCH.TABLE_NAME      - if catalog/schema and table name are available
SQL SCH.TABLE_NAME (2)  - as above, plus number if more tabs exist
SQL MyConnectionName    - if connection name contains only letters and numbers (*)
SQL Command 1           - otherwise

(*) Because tab names are also used as file names, instead of using letters that could be unsafe on some filesystems, legacy "SQL Command {n}" is used.
Comment 4 Jaroslav Havlin 2013-02-22 13:51:08 UTC
Created attachment 131739 [details]
Proposed Patch v2

Updated spec. version for library.
Comment 5 Jaroslav Havlin 2013-02-22 13:55:51 UTC
The following changes are in APIs that are not public,
but if you are interested, please review them.


db.metadata.model (friend private API, compatible change)
-----------------

specification version increased to 1.1

packge org.netbeans.modules.db.metadata.model.api:
 - new method MetadataElementHandle#getNonNullNames()


db (changes in non-public packages only, one incompatible change)
--

specification version increased to 1.54

package org.netbeans.modules.db.explorer.sql.editor:
 - new method SQLEditorSupport#openSQLEditor(
      DatabaseConnection, String, boolean, MetadataElementHandle<?>)

package org.netbeans.modules.db.spi.sql.editor:
 - changed interface method SQLEditorProvider#openSQLEditor(
      DatabaseConnection, String, boolean execute, MetadataElementHandle<?>)
Comment 6 matthias42 2013-02-23 21:55:11 UTC
Created attachment 131785 [details]
proposed patch v1 (mb)

I had a look at it and had another idea. I think its a bit closer to the the title "more descriptive of connection". I think passing around the metadata element is not such a good idea, you can switch the connection at runtime and at latest after a netbeans restart, your connection is gone. What is more I got away without changing api :-).

The change in "SQL Editor" module is minimal (-> produce a shorter name for the console title, as it will get longer anyway). This could be dropped or changed to another label, but it should be short.

The SQL Editor TopComponent has knowledge about it's associated DatabaseConnection. It's therefore possible to extract the connection info and display it. The display name is constructed as "SQL CON <Number> [<ConnectionName>]". In the tooltip window I display: The "name" (SQL CON <Number>, the name of the connection and the full JDBC URL).

The realwork is done in SQLEditorSupport#messageToolTip and SQLEditorSupport#messageName, the change in SQLClonabelEditor is needed to update TopComponent name after restart.
Comment 7 Jaroslav Havlin 2013-02-26 15:36:12 UTC
(In reply to comment #6)
> Created attachment 131785 [details]
> proposed patch v1 (mb)
Thank you!

> I had a look at it and had another idea. I think its a bit closer to the the
> title "more descriptive of connection". I think passing around the metadata
> element is not such a good idea, you can switch the connection at runtime 
> and at latest after a netbeans restart, your connection is gone. What is 
> more I got away without changing api :-).
Very good idea, let's use it.

> The change in "SQL Editor" module is minimal (-> produce a shorter name for 
> the console title, as it will get longer anyway). This could be dropped or 
> changed to another label, but it should be short.
What about using only "SQL n.sql" for file name? Is it too minimalistic?

Integrated as http://hg.netbeans.org/core-main/rev/f0fae2a401b7
Comment 8 matthias42 2013-02-26 18:46:54 UTC
(In reply to comment #7)
> > The change in "SQL Editor" module is minimal (-> produce a shorter name for 
> > the console title, as it will get longer anyway). This could be dropped or 
> > changed to another label, but it should be short.
> What about using only "SQL n.sql" for file name? Is it too minimalistic?

I like it - basicly everything wasted for additional characters takes screen space. The potential conflict with a local name seems to be negligible. If a user really saves saves as "SQL 1.sql" he most probably gets worse problems than potential visual conflicts.
Comment 9 Jaroslav Havlin 2013-02-27 10:01:58 UTC
(In reply to comment #8)
> > What about using only "SQL n.sql" for file name? Is it too minimalistic?
> I like it - basicly everything wasted for additional characters takes screen
> space. The potential conflict with a local name seems to be negligible. If a
> user really saves saves as "SQL 1.sql" he most probably gets worse problems
> than potential visual conflicts.
Changed in http://hg.netbeans.org/core-main/rev/e765529286dd
Thank you, Matthias.
Comment 10 Quality Engineering 2013-02-27 16:13:59 UTC
Integrated into 'main-golden', will be available in build *201302270948* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/f0fae2a401b7
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #195880: SQL Command tab is more descriptive of connection
Comment 11 Quality Engineering 2013-03-01 02:00:47 UTC
Integrated into 'main-golden', will be available in build *201302282300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/e765529286dd
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #195880: Shorter file names for SQL commands


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo