You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by bu...@apache.org on 2007/11/09 21:59:48 UTC

DO NOT REPLY [Bug 43831] New: - Unexpected Result with mysql jdbc 5.1.5, column aliases not reported

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43831>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43831

           Summary: Unexpected Result with mysql jdbc 5.1.5, column aliases
                    not reported
           Product: Taglibs
           Version: 1.1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Standard Taglib
        AssignedTo: taglibs-dev@jakarta.apache.org
        ReportedBy: eq@ti.com


Unexpected Result with mysql jdbc 5.1.5, column aliases not reported
see http://bugs.mysql.com/bug.php?id=21596

I suggest changing getColumnName to getColumnLabel.

Index: C:/dev/jee/workspace/standard/src/javax/servlet/jsp/jstl/sql/ResultImpl.java
===================================================================
---
C:/dev/jee/workspace/standard/src/javax/servlet/jsp/jstl/sql/ResultImpl.java
(revision 593646)
+++
C:/dev/jee/workspace/standard/src/javax/servlet/jsp/jstl/sql/ResultImpl.java
(working copy)
@@ -67,7 +67,7 @@
         // Create the column name array
         columnNames = new String[noOfColumns];
         for (int i = 1; i <= noOfColumns; i++) {
-            columnNames[i-1] = rsmd.getColumnName(i);
+            columnNames[i-1] = rsmd.getColumnLabel(i);
         }
 
         // Throw away all rows upto startRow

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 43831] - Unexpected Result with mysql jdbc 5.1.5, column aliases not reported

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43831>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43831





------- Additional Comments From eq@ti.com  2007-11-09 13:35 -------
(In reply to comment #2)
> If anyone can point to some definitive documentation, that would help.

couldn't find anything in the jdbc4 jsr but found this in the java6 doc
http://java.sun.com/javase/6/docs/api/java/sql/ResultSetMetaData.html#getColumnLabel(int)




-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 43831] - Unexpected Result with mysql jdbc 5.1.5, column aliases not reported

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43831>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43831





------- Additional Comments From eq@ti.com  2007-11-13 12:38 -------
found mysql bug report that the useOldAliasMetadataBehavior default changes from
true to false from version 5.0 to 5.1.
http://bugs.mysql.com/bug.php?id=31406

---
/dev/jee/workspace/mysql-connector-java-5.0.8/src/com/mysql/jdbc/ConnectionProperties.j
ava     2007-11-13 13:36:49.473056600 -0600
+++
/dev/jee/workspace/mysql-connector-java-5.1.5/src/com/mysql/jdbc/ConnectionPropertiesIm
pl.java 2007-11-13 13:41:30.707431600 -0600
 
        private BooleanConnectionProperty useOldAliasMetadataBehavior = new
BooleanConnectionProperty(
-                       "useOldAliasMetadataBehavior",
-                       true,
-                       "Should the driver use the legacy behavior for \"AS\"
clauses on columns and tables, and only "
-                   + "return aliases (if any) for
ResultSetMetaData.getColumnName() or ResultSetMetaData.getTableName()
 "
-                   + "rather than the original column/table name?",
-                   "5.0.4",
+                       "useOldAliasMetadataBehavior", //$NON-NLS-1$
+                       false,
+                      
Messages.getString("ConnectionProperties.useOldAliasMetadataBehavior"),
//$NON-NLS-1$
+                   "5.0.4", //$NON-NLS-1$
                    MISC_CATEGORY,
                    Integer.MIN_VALUE);
 

I would still suggest changing the accessor from getColumnName to getColumnLabel
since this would reflect the intent of the developer.





-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 43831] - Unexpected Result with mysql jdbc 5.1.5, column aliases not reported

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43831>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43831





------- Additional Comments From bayard@apache.org  2007-12-07 05:37 -------
Looking at the spec, I see two uses for the name.

The first is to do ${row.lastName} and the second is to list the column names.

The latter is very obviously going to be improved by the change below. The
former is going to be improved in so much as presumably there's a bug when a
select statement has two entries with the same column names.

The people hurt by this change are ones with code like:

"SELECT id as identifier ..." and then using ${row.id}.

We could either:

a) Warn such people in the release notes.
b) Try to implement something whereby we get label + name and support both. As
it's not a part of the API, This would mean a custom SortedMap that allowed a
backup key.

If desirable, b) doesn't seem that hard to implement to support the ${row.id}
use case, though anyone relying on getRows() as a Map is going to see a change
in keys unless they use the same API as row.id (presumably get(Object)).

Thoughts?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 43831] - Unexpected Result with mysql jdbc 5.1.5, column aliases not reported

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43831>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43831





------- Additional Comments From eq@ti.com  2007-12-07 07:36 -------
(In reply to comment #5)
> Thoughts?
I see no reason to change the api. When I alias the column, I never need to
access the field using the real column name.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 43831] - Unexpected Result with mysql jdbc 5.1.5, column aliases not reported

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43831>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43831





------- Additional Comments From kris@dotech.com  2007-11-09 13:21 -------
(In reply to comment #1)
> Is this potentially a JDBC driver issue?

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

It looks like there's supposed to be a "backwards-compatible option" for the
driver that should make this work. There's also a comment that "some
frameworks/libraries don't follow the JDBC spec in using column names and
labels." So maybe column label really should be used? If anyone can point to
some definitive documentation, that would help.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 43831] - Unexpected Result with mysql jdbc 5.1.5, column aliases not reported

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43831>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43831


bayard@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From bayard@apache.org  2007-12-30 22:11 -------
Resolving this bug as suggested:

svn ci -m "Switching from getColumnName to getColumnLabel as per #43831. JDBC
spec indicates that the name should be returned rather than the label, and it
seems far more likely that a JSTL user will want the label despite the name of
the variable 'columnNames'. " src/javax 

Sending        src/javax/servlet/jsp/jstl/sql/ResultImpl.java
Transmitting file data .
Committed revision 607683.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 43831] - Unexpected Result with mysql jdbc 5.1.5, column aliases not reported

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43831>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43831





------- Additional Comments From bayard@apache.org  2007-12-30 22:09 -------
I've submitted a unit test to show this - the only problem is that Derby does
not do what MySQL do, so my test which should fail for MySQL in fact passes for
Derby. 

svn ci -m "Unit test to show this bug - if it were run against mysql. Derby does
not exhibit the JDBC change that MySQL has" test

Adding         test/org/apache/taglibs/standard/tag/el/sql/Test43831.java
Adding         test/web/org/apache/taglibs/standard/tag/el/sql/Test43831.jsp
Transmitting file data ..
Committed revision 607682.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 43831] - Unexpected Result with mysql jdbc 5.1.5, column aliases not reported

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43831>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43831





------- Additional Comments From kris@dotech.com  2007-11-09 13:13 -------
(In reply to comment #0)
> I suggest changing getColumnName to getColumnLabel.

What, specifically, is the issue with getColumnName? Did it return null or an
empty string? Is this potentially a JDBC driver issue? I wouldn't support
swapping getColumnName for getColumnLabel, but if column name is null or empty,
perhaps column label could be used as a backup.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org