This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 129271 - Eliminate unneeded properties in ColumnDef
Summary: Eliminate unneeded properties in ColumnDef
Status: RESOLVED INVALID
Alias: None
Product: db
Classification: Unclassified
Component: SQL Editor (show other bugs)
Version: 6.x
Hardware: All Windows Vista
: P4 blocker (vote)
Assignee: Andrei Badea
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-05 13:13 UTC by josecefe
Modified: 2008-08-18 17:02 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description josecefe 2008-03-05 13:13:13 UTC
With Netbeans 6.1dev you are shipping the 5.1.5 version of mysql-connector jdbc driver. But there is a problem with this
driver with Netbeans: the alias in the SELECT clause of a query are not working.

For example:

SELECT atributo AS atrib FROM confflota

it should return (with 5.0.7 and 5.0.8 in fact it does):

---------
| atrib |
---------
| xxxxx |
| xxxxx |
| ..... |
---------

but this is the result:

------------
| atributo |
------------
| xxxxxxxx |
| xxxxxxxx |
| ........ |
------------

That is clearly wrong. This makes that every query that uses alias cannot work well with the ResultSet. This is also
affecting other components (visual web, ...).
Comment 1 David Vancouvering 2008-03-05 17:31:08 UTC
Well, this surprised me, but see this bug report: 

http://bugs.mysql.com/bug.php?id=34034

<quote>
Hi Steve and thanks for your report. I believe it is a duplicate of Bug#31499 (Bug#32504
and many more). The behavior you ask for isn't actually JDBC-compliant (which is why there
was a change in behavior in 5.1). If you want the old, non-compliant behavior, you should
add "useOldAliasMetadataBehavior=true" as a configuration parameter in your JDBC URL.

Note: The JDBC-compliant way of getting the information you're asking for, i.e. the
"alias" for the column is by calling ResultSetMetaData.getColumnLabel(), not
getColumnName(). The reason that getColumnName() is _not_ supposed to return the alias, is
because it is supposed to be possible for a consumer of this API to generate a DML
statement based on the metadata present in the ResultSet and ResultSetMetaData, and thus
getColumnName() should return the _physical_ column name, not the alias.
</quote>

I will fix the code to do things in the compliant way, and get the column label versus the column name, when displaying
results.  If visualweb is using getColumnName(), then this should be changed as well.  I'll open an associated bug
against visualweb.
Comment 2 David Vancouvering 2008-03-05 17:32:42 UTC
Since a reasonable workaround exists (change your URL to include the property "useOldAliasMetadataBehavior=true") I am
downgrading this to a P3.
Comment 3 David Vancouvering 2008-03-05 17:38:47 UTC
Logged issue 129330 for visualweb to get us to start using getColumnLabel() instead of getColumnName()
Comment 4 David Vancouvering 2008-03-06 00:31:13 UTC
http://hg.netbeans.org/main?cmd=changeset;node=dd399e6aa6ea
Comment 5 Andrei Badea 2008-03-24 18:47:05 UTC
Since the label is used everywhere, the name property of ColumnDef is not used now, just making the class more complex.
Would have been better to just pass rsmd.getColumnLabel() to ColumnDef's constructor instead of introducing a new property.
Comment 6 David Vancouvering 2008-03-24 19:24:01 UTC
Yes, fair enough.  Re-opening as a P4
Comment 7 Andrei Badea 2008-08-18 17:02:44 UTC
Applies to code that was obsoleted by dataview, so not applicable anymore.