Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
1.3.0
-
None
-
None
-
Windows, MariaDB 10.1
Description
MariaDB Connector/J introduced new DATETIME implementation in version 1.3.0 which breaks legacy code even though useLegacyDatetimeCode is set to true. Before, we have used version 1.1.8 in the following manner (simplified):
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); |
statement.setTimestamp(index, timestamp, calendar);
|
Thus, we instructed to always use UTC regardless of the server/client TimeZone. After upgrading to the version 1.4.2 the above-mentioned code stopped working even with useLegacyDatetimeCode set to true. This is rather obvious if we take a look at TimestampParameter source code:
public void writeBinary(PacketOutputStream writeBuffer) { |
if (options.useLegacyDatetimeCode) { |
calendar = Calendar.getInstance();
|
}
|
calendar.setTimeInMillis(ts.getTime());
|
writeBuffer.writeTimestampLength(calendar, ts);
|
}
|
As you can see, this code completely disregards calendar passed to it as a parameter (it saved in the constructor). As I see it, it is a breaking change.
If I set useLegacyDatetimeCode to false it will use server's time zone, which also is not a behavior we are trying to achieve.