Bug 21074

Summary: malformated dates
Product: Taglibs Reporter: Carl Viktorsson <calvi416>
Component: Standard TaglibAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED WORKSFORME    
Severity: minor    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

Description Carl Viktorsson 2003-06-25 08:37:34 UTC
When retrieving datetime columns from a mysql database with the JSTL/sql 
taglib the results are malformated if the results are ordered by the datetime-
column and the datetime column are formatted with the mysql DATE_FORMAT 
function.

Example that produces malformed output (the date looks like "[B@da9ea4"):
SELECT DATE_FORMAT(race.date, '%Y-%m-%d') AS racedate FROM race ORDER BY 
race.date

Example that produces correct but unsorted output:
SELECT DATE_FORMAT(race.date, '%Y-%m-%d') AS racedate FROM race

Both queries work if I execute them in the mysql-prompt.
Comment 1 Pierre Delisle 2003-07-12 14:40:23 UTC
From what I understood of the bug report, could not reproduce the problem. 
Everything worked fine for me. Snippets of the JSP code used to try to
reproduce the problem are show below.

Please provide specific sample code it you still think there is a bug.

---
<sql:update>
  CREATE TABLE CUSTOMER (
      ID int auto_increment primary key,
      NAME varchar(80),
      COUNTRY varchar(30),
      REGIS_DATETIME datetime
  )
</sql:update>

<sql:update>
  INSERT INTO CUSTOMER VALUES
    (null, 'Oakenfold, Paul', 'USA', '2003-01-01 01:01:01'),
    (null, 'Tremblay, Michel', 'Canada', '2003-02-02 02:02:02'),
    (null, 'Durand, Francois', 'France', '2003-03-03 03:03:03')
</sql:update> 

---
<sql:query var="result">
select NAME, DATE_FORMAT(REGIS_DATETIME, '%Y-%m-%d') AS racedate 
FROM customer
ORDER BY REGIS_DATETIME;
</sql:query>

<h4>Customer List</h4>
<table>
<c:forEach var="row" items="${result.rows}">
  <tr>
    <td><a href="View.jsp?id=${row.ID}">${row.NAME}</a></td>
    <td><a href="View.jsp?id=${row.ID}">${row.racedate}</a></td>
    <td><a href="Delete.jsp?id=${row.ID}">Delete</a></td>
  </tr>
</c:forEach>
<p>
</table>

---
Customer List

Oakenfold, Paul 	2003-01-01 	Delete
Tremblay, Michel 	2003-02-02 	Delete
Durand, Francois 	2003-03-03 	Delete