| Bug #34913 | getNativeTimestamp returns random Month and Day versions 5.1.1 through 5.1.5 | ||
|---|---|---|---|
| Submitted: | 28 Feb 0:08 | Modified: | 1 Mar 13:31 |
| Reporter: | Harald Rudell | ||
| Status: | Closed | ||
| Category: | Connector/J | Severity: | S2 (Serious) |
| Version: | 5.1.5 | OS: | Any |
| Assigned to: | Target Version: | ||
| Tags: | date, random, timestamp | ||
[28 Feb 6:34]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/43127
[1 Mar 13:31]
MC Brown
A note has been added to the 5.1.6 changelog: ResultSet.getTimestamp() returns incorrect values for month/day of TIMESTAMPs when using server-side prepared statements (not enabled by default).

Description: On examining timestamp fields in text form, the month and the day from the timetamp have random values in com.mysql.jdbc.ResultSetRow.getNativeTimestamp, lines 646, 647 the offset variable is missing: correct month = bits[offset + 2]; day = bits[offset + 3]; incorrect (5.1.1-5.1.5) month = bits[2]; day = bits[3]; so a ResultSet.getString("myTimestampFieldname") produces random month and day values, while year and time of day are correct How to repeat: test case goes here Suggested fix: correct lines 646,647 of ResultSetRow.java month = bits[offset + 2]; day = bits[offset + 3];